diff --git a/auth0/src/test/java/com/auth0/android/provider/IdTokenVerifierTest.java b/auth0/src/test/java/com/auth0/android/provider/IdTokenVerifierTest.java index 27bf6b5d..b4bef0fc 100644 --- a/auth0/src/test/java/com/auth0/android/provider/IdTokenVerifierTest.java +++ b/auth0/src/test/java/com/auth0/android/provider/IdTokenVerifierTest.java @@ -306,12 +306,16 @@ public void shouldNotFailWhenOrganizationNameClaimIsRequiredAndHasSameValue() th @Test public void shouldFailWhenInputClaimHasDifferentCaseThanOrgNameReceived() throws Exception { - Map jwtBody = createJWTBody(); - jwtBody.put("org_name", "__tESt_OrG_nAme__"); - String token = createTestJWT("none", jwtBody); - Jwt jwt = new Jwt(token); - options.setOrganization(EXPECTED_ORGANIZATION_NAME); - idTokenVerifier.verify(jwt, options, true); + String message = "Organization Name (org_name) claim mismatch in the ID token; expected \"__test_org_name__\", found \"__tESt_OrG_nAme__\""; + Exception e = Assert.assertThrows(message, OrgNameClaimMismatchException.class, () -> { + Map jwtBody = createJWTBody(); + jwtBody.put("org_name", "__tESt_OrG_nAme__"); + String token = createTestJWT("none", jwtBody); + Jwt jwt = new Jwt(token); + options.setOrganization(EXPECTED_ORGANIZATION_NAME); + idTokenVerifier.verify(jwt, options, true); + }); + assertEquals("com.auth0.android.provider.TokenValidationException: " + message, e.toString()); } @Test