How to access a private Map in JUnit using reflections?

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:

public static void setUpBeforeClass() throws Exception {
    svnConnector = new SVNConnector(user, pwd);
    Field connectionMapField = SVNConnector.class.getDeclaredField("connectionMap");

There are not any Collection specific getters or setters to check the size of the collectionMap or similar. So how can I access it?



Do you mean you want to get the value of the field?

Map<String, SVNRepository> connectionMap = 
    (Map<String, SVNRepository>) connectionMapField.get(svnConnector);

Need Your Help

Cocoa OpenGL Texture Creation

cocoa opengl

I am working on my first OpenGL application using Cocoa (I have used OpenGL ES on the iPhone) and I am having trouble loading a texture from an image file. Here is my texture loading code:

CSS - Hyperlinks aren't going anywhere

css href clickable

For some reason that I've been trying to figure out, the links on my page are clickable, but aren't actually going anywhere. The markup itself looks fine, and I can't figure out if there's some i...