From d586edbb3fb56d911af032ff6661492209d57c81 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 26 Jul 2016 15:15:04 +0200 Subject: [PATCH] use assertJ instead of hamcrest --- java-decompiler-engine.iml | 2 +- .../java/decompiler/DecompilerTestFixture.java | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/java-decompiler-engine.iml b/java-decompiler-engine.iml index 5880ebf..dc3ddfe 100644 --- a/java-decompiler-engine.iml +++ b/java-decompiler-engine.iml @@ -9,6 +9,6 @@ - + \ No newline at end of file diff --git a/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java b/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java index 58f6db0..1621142 100644 --- a/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java +++ b/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java @@ -15,7 +15,6 @@ */ package org.jetbrains.java.decompiler; -import org.hamcrest.Matchers; import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.util.InterpreterUtil; @@ -26,8 +25,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import static org.junit.Assert.assertTrue; public class DecompilerTestFixture { @@ -37,7 +35,7 @@ public class DecompilerTestFixture { private ConsoleDecompiler decompiler; public void setUp(String... optionPairs) throws IOException { - assertEquals(0, optionPairs.length % 2); + assertThat(optionPairs.length % 2).isEqualTo(0); testDataDir = new File("testData"); if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData"); @@ -49,10 +47,10 @@ public class DecompilerTestFixture { //noinspection SSBasedInspection tempDir = File.createTempFile("decompiler_test_", "_dir"); - assertTrue(tempDir.delete()); + assertThat(tempDir.delete()).isTrue(); targetDir = new File(tempDir, "decompiled"); - assertTrue(targetDir.mkdirs()); + assertThat(targetDir.mkdirs()).isTrue(); Map options = new HashMap(); options.put(IFernflowerPreferences.LOG_LEVEL, "warn"); @@ -106,13 +104,13 @@ public class DecompilerTestFixture { public static void assertFilesEqual(File expected, File actual) { if (expected.isDirectory()) { String[] children = Objects.requireNonNull(expected.list()); - assertThat(actual.list(), Matchers.arrayContainingInAnyOrder(children)); + assertThat(actual.list()).contains(children); for (String name : children) { assertFilesEqual(new File(expected, name), new File(actual, name)); } } else { - assertEquals(getContent(expected), getContent(actual)); + assertThat(getContent(actual)).isEqualTo(getContent(expected)); } }