Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

JUnit Interview Questions and Answers

Ques. How To Write a Simple JUnit Test Class?
Ans. You should be able to write this simple test class with one test method:

import org.junit.*;

public class LoginTest


@Test public void testLogin()


String username = \\\"withoutbook\\\";

Assert.assertEquals(\\\"withoutbook\\\", username);



Here first argument in assertEquals is the known parameter which should be equal to username. If both are same it will send me true and if both are not equal sends me false.
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook