JUnit Question:
Download Job Interview Questions and Answers PDF
How To Wirte a Simple JUnit Test Class?
Answer:
This is a common test in a job interview. You should be able to write this simple test class with one test method:
import org.junit.*;
public class HelloTest {
@Test public void testHello() {
String message = "Hello World!";
Assert.assertEquals(12, message.length());
}
}
import org.junit.*;
public class HelloTest {
@Test public void testHello() {
String message = "Hello World!";
Assert.assertEquals(12, message.length());
}
}
Download JUnit Interview Questions And Answers
PDF
Previous Question | Next Question |
How Do You Install JUnit? | How To Compile a JUnit Test Class? |