I have a connector class (SVNConnector) which should be junit tested. There is a private map called private Map<String, SVNRepository> connectionMap which should be accessed in JUnit, but this map doesn’t have a getter method. So I have to use reflections to do that. My question is: How does that work? I tried the following:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
svnConnector = new SVNConnector(user, pwd);
Field connectionMapField = SVNConnector.class.getDeclaredField("connectionMap");
connectionMapField.setAccessible(true);
//AND NOW?
}
There are not any Collection specific getters or setters to check the size of the collectionMap or similar. So how can I access it?
Thanks.
Do you mean you want to get the value of the field?