I made a small Java program using JUnit 4. I wrote two methods, one with a @Before
annotation and one with @Test
.
I created an object of a class obj
but it says obj
can't be resolved.
@Before
public void objectCreation() {
Main obj = new Main(msg);
}
@Test
public void testPrintMessage() {
assertTrue("Expected true got false",obj.printMessage());
}