Skip to content

Instantly share code, notes, and snippets.

@obetron
Created August 24, 2017 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obetron/8ac9a195bc1c64b31789ba338952a190 to your computer and use it in GitHub Desktop.
Save obetron/8ac9a195bc1c64b31789ba338952a190 to your computer and use it in GitHub Desktop.
Java basic If-Else condition example test cases
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
*
* @author ErenBasaran
* Created on 25/08/2017
*/
public class IfElseTest {
private static IfElse ifElseObject;
private int number;
@BeforeClass
public static void beforeIfElseClass() {
ifElseObject = new IfElse();
}
@Test
public void testCase1() {
number = 42;
assertEquals("even number", ifElseObject.checkNumber(number));
}
@Test
public void testCase2() {
number = 1191;
assertEquals("odd number", ifElseObject.checkNumber(number));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment