@Test public void test_call_with_BigInteger_less_than_max_doesnt_throw_AssertionError() throws Exception { BigInteger value = BigInteger.valueOf(9); sut.assertViolation(getAnnotationMax10(), value); }
@Test public void testCannotHandleAnnotation() throws Exception { Annotation notNull = getAnnotationNotNull(); boolean result = sut.canHandle(notNull); assertFalse(result); }
@Test public void testCanHandleAnnotation() throws Exception { Annotation max = getAnnotationMax10(); boolean result = sut.canHandle(max); assertTrue(result); }
@Test public void test_call_with_wrong_value_type_throws_IllegalArgumentException() throws Exception { double value = 3.14; thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Type is not considered supported by @Max"); sut.assertViolation(getAnnotationMax10(), value); }
@Test public void test_call_with_long_greater_than_max_throws_AssertionError() throws Exception { long value = 11L; thrown.handleAssertionErrors(); thrown.expect(AssertionError.class); thrown.expectMessage("Called @Max(10) parameter with 11"); sut.assertViolation(getAnnotationMax10(), value); }
@Test(expected = AssertionError.class) public void test_call_with_int_greater_than_max_throws_AssertionError() throws Exception { int value = 11; sut.assertViolation(getAnnotationMax10(), value); }
@Test public void test_call_with_long_less_than_max_doesnt_throw_AssertionError() throws Exception { long value = 9L; sut.assertViolation(getAnnotationMax10(), value); }
@Test public void test_call_with_null_doesnt_throw_AssertionError() throws Exception { Object value = null; sut.assertViolation(getAnnotationMaxMinus10(), value); }
@Test(expected = IllegalArgumentException.class) public void test_call_with_wrong_annotation_throws_IllegalArgumentException() throws Exception { Object value = null; sut.assertViolation(getAnnotationNotNull(), value); }
@Test(expected = AssertionError.class) public void test_call_with_BigInteger_greater_than_max_throws_AssertionError() throws Exception { BigInteger value = BigInteger.valueOf(11); sut.assertViolation(getAnnotationMax10(), value); }