Can You Write a Simple Class for JUnit Testing in 1 Minute?

Answer

You need to write a class with less than 10 lines. Here is a nice example provided in the article "Writing a JUnit Test in 5 minutes" by Kamal Mettananda with some minor changes:

package com.parcelhouse.myproj;
public class Calc {
public int add(int a, int b) {
// errorneous method
return a+b+1;
}
public int multiply(int a, int b) {
return a*b;
}
}

All unit-testing Questions

Ask your interview questions on unit-testing

Write Your comment or Questions if you want the answers on unit-testing from unit-testing Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---