Search in sources :

Example 81 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project assertj-core by joel-costigliola.

the class Paths_assertHasBinaryContent_Test method should_fail_if_actual_is_not_readable.

@Test
@DisabledOnOs(value = WINDOWS, disabledReason = "gh-2312")
void should_fail_if_actual_is_not_readable() throws IOException {
    // GIVEN
    Path actual = createFile(tempDir.resolve("actual"));
    actual.toFile().setReadable(false);
    byte[] expected = "expected".getBytes();
    // WHEN
    AssertionError error = expectAssertionError(() -> paths.assertHasBinaryContent(info, actual, expected));
    // THEN
    then(error).hasMessage(shouldBeReadable(actual).create());
}
Also used : Path(java.nio.file.Path) AssertionsUtil.expectAssertionError(org.assertj.core.util.AssertionsUtil.expectAssertionError) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.jupiter.api.Test)

Example 82 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project assertj-core by joel-costigliola.

the class Paths_assertHasDigest_with_String_and_String_Test method should_fail_if_actual_is_not_readable.

@Test
@DisabledOnOs(value = WINDOWS, disabledReason = "gh-2312")
void should_fail_if_actual_is_not_readable() throws IOException {
    // GIVEN
    Path actual = createFile(tempDir.resolve("actual"));
    actual.toFile().setReadable(false);
    String algorithm = "MD5";
    String expected = "";
    // WHEN
    AssertionError error = expectAssertionError(() -> paths.assertHasDigest(info, actual, algorithm, expected));
    // THEN
    then(error).hasMessage(shouldBeReadable(actual).create());
}
Also used : Path(java.nio.file.Path) AssertionsUtil.expectAssertionError(org.assertj.core.util.AssertionsUtil.expectAssertionError) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.jupiter.api.Test)

Example 83 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project assertj-core by joel-costigliola.

the class Paths_assertHasSameBinaryContentAs_Test method should_fail_if_actual_is_not_readable.

@Test
@DisabledOnOs(value = WINDOWS, disabledReason = "gh-2312")
void should_fail_if_actual_is_not_readable() throws IOException {
    // GIVEN
    Path actual = createFile(tempDir.resolve("actual"));
    actual.toFile().setReadable(false);
    Path expected = createFile(tempDir.resolve("expected"));
    // WHEN
    AssertionError error = expectAssertionError(() -> paths.assertHasSameBinaryContentAs(info, actual, expected));
    // THEN
    then(error).hasMessage(shouldBeReadable(actual).create());
}
Also used : Path(java.nio.file.Path) AssertionsUtil.expectAssertionError(org.assertj.core.util.AssertionsUtil.expectAssertionError) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 84 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project assertj-core by joel-costigliola.

the class Paths_assertHasDigest_with_String_and_Byte_array_Test method should_fail_if_actual_is_not_readable.

@Test
@DisabledOnOs(value = WINDOWS, disabledReason = "gh-2312")
void should_fail_if_actual_is_not_readable() throws IOException {
    // GIVEN
    Path actual = createFile(tempDir.resolve("actual"));
    actual.toFile().setReadable(false);
    String algorithm = "MD5";
    byte[] expected = {};
    // WHEN
    AssertionError error = expectAssertionError(() -> paths.assertHasDigest(info, actual, algorithm, expected));
    // THEN
    then(error).hasMessage(shouldBeReadable(actual).create());
}
Also used : Path(java.nio.file.Path) AssertionsUtil.expectAssertionError(org.assertj.core.util.AssertionsUtil.expectAssertionError) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.jupiter.api.Test)

Example 85 with DisabledOnOs

use of org.junit.jupiter.api.condition.DisabledOnOs in project assertj-core by joel-costigliola.

the class Paths_assertHasDigest_with_MessageDigest_and_Byte_array_Test method should_fail_if_actual_is_not_readable.

@Test
@DisabledOnOs(value = WINDOWS, disabledReason = "gh-2312")
void should_fail_if_actual_is_not_readable() throws Exception {
    // GIVEN
    Path actual = createFile(tempDir.resolve("actual"));
    actual.toFile().setReadable(false);
    MessageDigest digest = MessageDigest.getInstance("MD5");
    byte[] expected = {};
    // WHEN
    AssertionError error = expectAssertionError(() -> paths.assertHasDigest(info, actual, digest, expected));
    // THEN
    then(error).hasMessage(shouldBeReadable(actual).create());
}
Also used : Path(java.nio.file.Path) AssertionsUtil.expectAssertionError(org.assertj.core.util.AssertionsUtil.expectAssertionError) MessageDigest(java.security.MessageDigest) DisabledOnOs(org.junit.jupiter.api.condition.DisabledOnOs) PathsBaseTest(org.assertj.core.internal.PathsBaseTest) Test(org.junit.jupiter.api.Test)

Aggregations

DisabledOnOs (org.junit.jupiter.api.condition.DisabledOnOs)87 Test (org.junit.jupiter.api.Test)80 Path (java.nio.file.Path)39 File (java.io.File)26 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 PathsBaseTest (org.assertj.core.internal.PathsBaseTest)12 AssertionsUtil.expectAssertionError (org.assertj.core.util.AssertionsUtil.expectAssertionError)11 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)6 PageSwapperFactory (org.neo4j.io.pagecache.PageSwapperFactory)6 PageSwapperTest (org.neo4j.io.pagecache.PageSwapperTest)6 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)5 DelegatingStoreChannel (org.neo4j.io.fs.DelegatingStoreChannel)5 StoreChannel (org.neo4j.io.fs.StoreChannel)5 DisabledForRoot (org.neo4j.test.extension.DisabledForRoot)5 Closeable (java.io.Closeable)4 URI (java.net.URI)4 FileUtils.writeByteArrayToFile (org.apache.commons.io.FileUtils.writeByteArrayToFile)4 ShouldBeFile.shouldBeFile (org.assertj.core.error.ShouldBeFile.shouldBeFile)4 FilesBaseTest (org.assertj.core.internal.FilesBaseTest)4 Files.newFile (org.assertj.core.util.Files.newFile)4