Refactor tests to use modern assertions
This commit is contained in:
parent
efb0329fda
commit
4ccdf9c959
6
pom.xml
6
pom.xml
|
@ -69,6 +69,12 @@
|
||||||
<version>1.16.1</version>
|
<version>1.16.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-all</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>1.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
|
@ -2,10 +2,10 @@ package testutil;
|
||||||
|
|
||||||
import static error.ErrorManager.Severity.ERROR;
|
import static error.ErrorManager.Severity.ERROR;
|
||||||
import static function.builtin.EVAL.eval;
|
import static function.builtin.EVAL.eval;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.hamcrest.Matchers.isEmptyOrNullString;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.hamcrest.Matchers.not;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertThat;
|
||||||
import static sexpression.Nil.NIL;
|
import static sexpression.Nil.NIL;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -85,17 +85,16 @@ public final class TestUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertSExpressionsMatch(SExpression one, SExpression two) {
|
public static void assertSExpressionsMatch(SExpression one, SExpression two) {
|
||||||
assertEquals(one.toString(), two.toString());
|
assertThat(one.toString(), is(two.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertSExpressionsDoNotMatch(SExpression one, SExpression two) {
|
public static void assertSExpressionsDoNotMatch(SExpression one, SExpression two) {
|
||||||
assertNotEquals(one.toString(), two.toString());
|
assertThat(one.toString(), not(two.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertIsErrorWithMessage(LispException e) {
|
public static void assertIsErrorWithMessage(LispException e) {
|
||||||
assertEquals(ERROR, e.getSeverity());
|
assertThat(e.getSeverity(), is(ERROR));
|
||||||
assertNotNull(e.getMessage());
|
assertThat(e.getMessage(), not(isEmptyOrNullString()));
|
||||||
assertTrue(e.getMessage().length() > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue