Skip to content

Commit

Permalink
Improvements to unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Binara-Sachin committed Oct 8, 2024
1 parent ef551e1 commit b3cd30c
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,15 @@ public String[] missingConfigDataProvider() {

return new String[] {
"identity_err1.xml",
"identity_err2.xml",
"identity.xml" // Finally loading correct identity.xml file to be used for other tests.
"identity_err2.xml"
};
}

@Test(dataProvider = "MissingConfigDataProvider")
public void testMissingConfigs(String fileName) {

try {
// Set instance to null for creating a new instance
// Set current instance to null before creating a new instance
Field identityKeyStoreResolverInstance = IdentityKeyStoreResolver.class.getDeclaredField("instance");
identityKeyStoreResolverInstance.setAccessible(true);
identityKeyStoreResolverInstance.set(null, null);
Expand All @@ -191,7 +190,7 @@ public void testMissingConfigs(String fileName) {
// Test instance creation --> Config read.
IdentityKeyStoreResolver.getInstance();
} catch (Exception e) {
fail();
fail("Test failed due to exception: " + e);
}
}

Expand Down Expand Up @@ -268,5 +267,4 @@ private void setPrivateStaticField(Class<?> clazz, String fieldName, Object newV
field.setAccessible(true);
field.set(null, newValue);
}

}

0 comments on commit b3cd30c

Please sign in to comment.