Advertisement
JeffGrigg

IntRangeTest

May 12th, 2018
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.96 KB | None | 0 0
  1. import org.junit.Test;
  2. import static org.junit.Assert.*;
  3.  
  4. public class IntRangeTest {
  5.  
  6.     public static boolean decideWithIfOneTwoOrThree(int number) {
  7.         return (number >= 1 && number <= 3);
  8.     }
  9.  
  10.     @Test
  11.     public void test() {
  12.         assertFalse(decideWithIfOneTwoOrThree(Integer.MIN_VALUE));
  13.         assertFalse(decideWithIfOneTwoOrThree(-100));
  14.         assertFalse(decideWithIfOneTwoOrThree(-10));
  15.         assertFalse(decideWithIfOneTwoOrThree(-1));
  16.         assertFalse(decideWithIfOneTwoOrThree(0));
  17.  
  18.         assertTrue(decideWithIfOneTwoOrThree(1));
  19.         assertTrue(decideWithIfOneTwoOrThree(2));
  20.         assertTrue(decideWithIfOneTwoOrThree(3));
  21.  
  22.         assertFalse(decideWithIfOneTwoOrThree(4));
  23.         assertFalse(decideWithIfOneTwoOrThree(5));
  24.         assertFalse(decideWithIfOneTwoOrThree(10));
  25.         assertFalse(decideWithIfOneTwoOrThree(100));
  26.         assertFalse(decideWithIfOneTwoOrThree(Integer.MAX_VALUE));
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement