I have this method in one of my classes:
...
protected Timer timer;
...
public void pauseResume()
{
    if (this.timer.isRunning()) {
        this.timer.stop();
    }
    else
        this.timer.start();
}
And then I am trying to test if this works using JUnit:
@Test
public void testPauseMethod()
{
    NewClass class1 = new NewClass();
    class1.pauseResume();
    assertTrue(class1.timer.isRunning());
}
The JUnitTest fails at class1.pauseResume(); and gives me a NullPointerException. Anyone knows what the problem is?
 
    