1 16 package nl.hippo.asserts; 17 18 public class IntegerAsserts extends Asserts 19 { 20 21 public static void equal(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 22 { 23 if (first != second) 24 { 25 throw createException(exceptionFactory, firstIdentifier + " must be equal to " + secondIdentifier); 26 } 27 } 28 29 public static void notEqual(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 30 { 31 if (first == second) 32 { 33 throw createException(exceptionFactory, firstIdentifier + " must not be equal to " + secondIdentifier); 34 } 35 } 36 37 public static void lessThan(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 38 { 39 if (first >= second) 40 { 41 throw createException(exceptionFactory, firstIdentifier + " must be less than " + secondIdentifier); 42 } 43 } 44 45 public static void lessThanOrEqual(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 46 { 47 if (first > second) 48 { 49 throw createException(exceptionFactory, firstIdentifier + " must be less than or equal to " + secondIdentifier); 50 } 51 } 52 53 public static void greaterThan(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 54 { 55 if (first <= second) 56 { 57 throw createException(exceptionFactory, firstIdentifier + " must be greater than " + secondIdentifier); 58 } 59 } 60 61 public static void greaterThanOrEqual(int first, int second, ExceptionFactory exceptionFactory, String firstIdentifier, String secondIdentifier) 62 { 63 if (first < second) 64 { 65 throw createException(exceptionFactory, firstIdentifier + " must be greater than or equal to " + secondIdentifier); 66 } 67 } 68 69 private IntegerAsserts() 70 { 71 super(); 72 } 73 74 } 75 | Popular Tags |