Skip to content

Commit 71cee09

Browse files
committed
Fix OidcMetaData MissingImplementation error by removing flawed classpath-based test detection
1 parent 090c222 commit 71cee09

2 files changed

Lines changed: 14 additions & 34 deletions

File tree

kinde-core/src/main/java/com/kinde/client/KindeClientGuiceModule.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.google.inject.Provides;
55
import com.kinde.config.KindeConfig;
66
import com.kinde.config.KindeConfigImpl;
7-
import com.kinde.config.KindeParameters;
87
import com.kinde.KindeClient;
98
import com.kinde.client.oidc.OidcMetaDataImpl;
109
import com.kinde.guice.KindeAnnotations;
@@ -27,29 +26,10 @@ public Map<String, Object> provideParameters() {
2726

2827
@Override
2928
protected void configure() {
30-
// Only bind OidcMetaData if we're not in TEST mode (to avoid conflicts with test modules)
31-
// Check if we're in a test environment by looking for test modules in the classpath
32-
if (KindeEnvironmentSingleton.getInstance().getState() == KindeEnvironmentSingleton.State.ACTIVE &&
33-
!isTestEnvironment()) {
29+
if (KindeEnvironmentSingleton.getInstance().getState() == KindeEnvironmentSingleton.State.ACTIVE) {
3430
bind(OidcMetaData.class).to(OidcMetaDataImpl.class);
3531
}
3632
bind(KindeConfig.class).to(KindeConfigImpl.class);
3733
bind(KindeClient.class).to(KindeClientImpl.class);
3834
}
39-
40-
/**
41-
* Checks if we're running in a test environment.
42-
* This is a simple heuristic to avoid binding conflicts with test modules.
43-
*
44-
* @return true if we're in a test environment
45-
*/
46-
private boolean isTestEnvironment() {
47-
try {
48-
// Check if we're running in a test context by looking for JUnit classes
49-
Class.forName("org.junit.jupiter.api.Test");
50-
return true;
51-
} catch (ClassNotFoundException e) {
52-
return false;
53-
}
54-
}
5535
}

kinde-core/src/test/java/com/kinde/session/KindeClientCodeSessionImplTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
package com.kinde.session;
22

3+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
4+
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
5+
import static org.junit.jupiter.api.Assertions.assertNotNull;
6+
import static org.junit.jupiter.api.Assertions.assertTrue;
7+
import static org.junit.jupiter.api.Assertions.fail;
8+
9+
import org.junit.jupiter.api.AfterEach;
10+
import org.junit.jupiter.api.BeforeEach;
11+
import org.junit.jupiter.api.Test;
12+
313
import com.github.tomakehurst.wiremock.WireMockServer;
414
import com.github.tomakehurst.wiremock.client.WireMock;
515
import com.kinde.KindeClient;
@@ -8,25 +18,15 @@
818
import com.kinde.authorization.AuthorizationType;
919
import com.kinde.authorization.AuthorizationUrl;
1020
import com.kinde.client.KindeCoreGuiceTestModule;
11-
import com.kinde.client.oidc.OidcMetaDataImplTest;
1221
import com.kinde.guice.KindeEnvironmentSingleton;
1322
import com.kinde.guice.KindeGuiceSingleton;
14-
import com.kinde.token.KindeTokenGuiceTestModule;
1523
import com.kinde.token.AccessToken;
16-
import com.kinde.token.KindeToken;
24+
import com.kinde.token.KindeTokenGuiceTestModule;
1725
import com.kinde.token.KindeTokens;
18-
import com.kinde.token.RefreshToken;
19-
import com.kinde.token.jwt.JwtGenerator;
2026
import com.kinde.token.TestKeyGenerator;
2127
import com.kinde.token.TestTokenGenerator;
28+
import com.kinde.token.jwt.JwtGenerator;
2229
import com.kinde.user.UserInfo;
23-
import org.junit.jupiter.api.*;
24-
25-
import java.util.List;
26-
27-
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
28-
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
29-
import static org.junit.jupiter.api.Assertions.*;
3030

3131

3232
public class KindeClientCodeSessionImplTest {
@@ -39,7 +39,7 @@ public class KindeClientCodeSessionImplTest {
3939
public void setUp() {
4040
KindeGuiceSingleton.fin();
4141
KindeEnvironmentSingleton.fin();
42-
KindeEnvironmentSingleton.init(KindeEnvironmentSingleton.State.ACTIVE);
42+
KindeEnvironmentSingleton.init(KindeEnvironmentSingleton.State.TEST);
4343

4444
// Initialize Guice with test modules
4545
KindeGuiceSingleton.init(

0 commit comments

Comments
 (0)