Search in sources :

Example 11 with BinaryDiffResult

use of org.assertj.core.internal.BinaryDiffResult in project assertj-core by joel-costigliola.

the class Paths_assertHasBinaryContent_Test method should_fail_if_path_does_not_have_expected_binary_content.

@Test
public void should_fail_if_path_does_not_have_expected_binary_content() throws IOException {
    BinaryDiffResult binaryDiffs = new BinaryDiffResult(15, (byte) 0xCA, (byte) 0xFE);
    when(binaryDiff.diff(path, expected)).thenReturn(binaryDiffs);
    when(nioFilesWrapper.exists(path)).thenReturn(true);
    when(nioFilesWrapper.isReadable(path)).thenReturn(true);
    AssertionInfo info = someInfo();
    try {
        paths.assertHasBinaryContent(info, path, expected);
    } catch (AssertionError e) {
        verify(failures).failure(info, shouldHaveBinaryContent(path, binaryDiffs));
        return;
    }
    failBecauseExpectedAssertionErrorWasNotThrown();
}
Also used : AssertionInfo(org.assertj.core.api.AssertionInfo) BinaryDiffResult(org.assertj.core.internal.BinaryDiffResult) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.Test)

Aggregations

BinaryDiffResult (org.assertj.core.internal.BinaryDiffResult)11 Test (org.junit.Test)11 AssertionInfo (org.assertj.core.api.AssertionInfo)3 FilesBaseTest (org.assertj.core.internal.FilesBaseTest)2 PathsBaseTest (org.assertj.core.internal.PathsBaseTest)1 Delta (org.assertj.core.util.diff.Delta)1