diff --git a/build.gradle b/build.gradle index 22a84ef..2a0ed21 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,6 @@ dependencies { implementation("io.micronaut.serde:micronaut-serde-jackson") implementation("org.eclipse.emfatic:org.eclipse.emfatic.core:1.1.0") implementation("org.eclipse.platform:org.eclipse.core.resources:3.13.700") - testImplementation('org.hamcrest:hamcrest:2.2') runtimeOnly("ch.qos.logback:logback-classic") } diff --git a/src/test/java/org/eclipse/emfatic/cli/Ecore2EmfaticCommandTest.java b/src/test/java/org/eclipse/emfatic/cli/Ecore2EmfaticCommandTest.java index 1bd9d91..1562bac 100644 --- a/src/test/java/org/eclipse/emfatic/cli/Ecore2EmfaticCommandTest.java +++ b/src/test/java/org/eclipse/emfatic/cli/Ecore2EmfaticCommandTest.java @@ -12,8 +12,7 @@ import io.micronaut.configuration.picocli.PicocliRunner; import io.micronaut.context.ApplicationContext; import io.micronaut.context.env.Environment; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; +import static org.junit.jupiter.api.Assertions.fail; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -29,12 +28,17 @@ public void testStandaloneMetamodel() throws Exception { try (ApplicationContext ctx = ApplicationContext.run(Environment.CLI, Environment.TEST)) { String[] args = new String[] { "src/test/resources/OO.ecore" }; PicocliRunner.run(Ecore2EmfaticCommand.class, ctx, args); - assertThat("Should see a PackageableElement in the output", - baos.toString(), containsString("PackageableElement")); + assertContains("Should see a PackageableElement in the output", baos.toString(), "PackageableElement"); } } - @Test + private void assertContains(String reason, String text, String substring) { + if (!text.contains(substring)) { + fail(String.format("%s, but did not contain '%s':\n%s", reason, substring, text)); + } + } + + @Test public void testMetamodelWithPlatformImport() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.setOut(new PrintStream(baos)); @@ -46,8 +50,8 @@ public void testMetamodelWithPlatformImport() throws Exception { "src/test/resources/platformImport/example2/ColoredTree.ecore" }; PicocliRunner.run(Ecore2EmfaticCommand.class, ctx, args); - assertThat("Should see 'extends Trees.Tree' in the output", - baos.toString(), containsString("extends Trees.Tree")); + assertContains("Should see 'extends Trees.Tree' in the output", + baos.toString(), "extends Trees.Tree"); } } }