Examples of BinaryDiffResult


Examples of org.assertj.core.internal.BinaryDiffResult

  @Test
  public void should_return_no_diff_if_inputstreams_have_equal_content() throws IOException {
    actual = stream(0xCA, 0xFE, 0xBA, 0xBE);
    expected = stream(0xCA, 0xFE, 0xBA, 0xBE);
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertTrue(result.hasNoDiff());
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

 
  @Test
  public void should_return_diff_if_inputstreams_differ_on_one_byte() throws IOException {
    actual = stream(0xCA, 0xFE, 0xBA, 0xBE);
    expected = stream(0xCA, 0xFE, 0xBE, 0xBE);
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(2, result.offset);
    assertEquals("0xBA", result.actual);
    assertEquals("0xBE", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

 
  @Test
  public void should_return_diff_if_actual_is_shorter() throws IOException {
    actual = stream(0xCA, 0xFE, 0xBA);
    expected = stream(0xCA, 0xFE, 0xBA, 0xBE);
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(3, result.offset);
    assertEquals("EOF", result.actual);
    assertEquals("0xBE", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

 
  @Test
  public void should_return_diff_if_expected_is_shorter() throws IOException {
    actual = stream(0xCA, 0xFE, 0xBA, 0xBE);
    expected = stream(0xCA, 0xFE, 0xBA);
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(3, result.offset);
    assertEquals("0xBE", result.actual);
    assertEquals("EOF", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

  @Test
  public void should_return_no_diff_if_file_and_array_have_equal_content() throws IOException {
    writer.write(actual, "test");
    // Note: writer inserts a new line after each line so we need it in our expected content
    expected = ("test" + LINE_SEPARATOR).getBytes();
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertTrue(result.hasNoDiff());
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

  @Test
  public void should_return_diff_if_inputstreams_differ_on_one_byte() throws IOException {
    writer.write(actual, "test");
    expected = ("fest" + LINE_SEPARATOR).getBytes();
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(0, result.offset);
    assertEquals("0x74", result.actual);
    assertEquals("0x66", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

  @Test
  public void should_return_diff_if_actual_is_shorter() throws IOException {
    writer.write(actual, "foo");
    expected = ("foo" + LINE_SEPARATOR + "bar").getBytes();
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(3 + LINE_SEPARATOR.length(), result.offset);
    assertEquals("EOF", result.actual);
    assertEquals("0x62", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

  @Test
  public void should_return_diff_if_expected_is_shorter() throws IOException {
    writer.write(actual, "foobar");
    expected = "foo".getBytes();
    BinaryDiffResult result = binaryDiff.diff(actual, expected);
    assertEquals(3, result.offset);
    assertEquals("0x62", result.actual);
    assertEquals("EOF", result.expected);
  }
View Full Code Here

Examples of org.assertj.core.internal.BinaryDiffResult

    }
  }

  @Test
  public void should_fail_if_file_does_not_have_expected_binary_content() throws IOException {
    BinaryDiffResult diff = new BinaryDiffResult(15, (byte) 0xCA, (byte) 0xFE);
    when(binaryDiff.diff(actual, expected)).thenReturn(diff);
    AssertionInfo info = someInfo();
    try {
      files.assertHasBinaryContent(info, actual, expected);
    } catch (AssertionError e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.