コード例 #1
0
 @Test
 public void should_fail_if_actual_starts_with_first_elements_of_sequence_only() {
   AssertionInfo info = someInfo();
   byte[] sequence = {6, 20};
   try {
     arrays.assertStartsWith(info, actual, sequence);
   } catch (AssertionError e) {
     verifyFailureThrownWhenSequenceNotFound(info, sequence);
     return;
   }
   throw expectedAssertionErrorNotThrown();
 }
コード例 #2
0
 @Test
 public void should_fail_if_sequence_is_bigger_than_actual() {
   AssertionInfo info = someInfo();
   byte[] sequence = {6, 8, 10, 12, 20, 22};
   try {
     arrays.assertStartsWith(info, actual, sequence);
   } catch (AssertionError e) {
     verifyFailureThrownWhenSequenceNotFound(info, sequence);
     return;
   }
   throw expectedAssertionErrorNotThrown();
 }
コード例 #3
0
 @Test
 public void should_fail_if_actual_does_not_start_with_sequence() {
   AssertionInfo info = someInfo();
   byte[] sequence = {8, 10};
   try {
     arrays.assertStartsWith(info, actual, sequence);
   } catch (AssertionError e) {
     verifyFailureThrownWhenSequenceNotFound(info, sequence);
     return;
   }
   throw expectedAssertionErrorNotThrown();
 }
コード例 #4
0
 @Test
 public void should_fail_if_actual_is_null() {
   thrown.expectAssertionError(actualIsNull());
   arrays.assertStartsWith(someInfo(), null, array(8));
 }
コード例 #5
0
 @Test
 public void should_throw_error_if_sequence_is_empty() {
   thrown.expectIllegalArgumentException(valuesToLookForIsEmpty());
   arrays.assertStartsWith(someInfo(), actual, emptyArray());
 }
コード例 #6
0
 @Test
 public void should_throw_error_if_sequence_is_null() {
   thrown.expectNullPointerException(valuesToLookForIsNull());
   arrays.assertStartsWith(someInfo(), actual, null);
 }
コード例 #7
0
 @Test
 public void should_pass_if_actual_and_sequence_are_equal() {
   arrays.assertStartsWith(someInfo(), actual, array(6, 8, 10, 12));
 }
コード例 #8
0
 @Test
 public void should_pass_if_actual_starts_with_sequence() {
   arrays.assertStartsWith(someInfo(), actual, array(6, 8, 10));
 }