PrologTestCase: Convert to use Google Truth

Change-Id: I77b3b27a40624b39ab4ac1e7dde16da3bb64111c
This commit is contained in:
David Pursehouse
2015-05-29 17:18:34 +09:00
parent c54249e352
commit b64ff5ae50
2 changed files with 10 additions and 8 deletions

View File

@@ -137,7 +137,9 @@ java_library(
deps = [
':server',
'//gerrit-common:server',
'//lib:guava',
'//lib:junit',
'//lib:truth',
'//lib/guice:guice',
'//lib/prolog:runtime',
],

View File

@@ -14,9 +14,8 @@
package com.google.gerrit.rules;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertThat;
import com.google.gerrit.common.TimeUtil;
import com.google.inject.Guice;
@@ -78,7 +77,7 @@ public abstract class PrologTestCase {
for (Term[] pair : env.all(Prolog.BUILTIN, "clause", head, new VariableTerm())) {
tests.add(pair[0]);
}
assertTrue("has tests", tests.size() > 0);
assertThat(tests).isNotEmpty();
machine = PrologMachineCopy.save(env);
}
@@ -173,14 +172,15 @@ public abstract class PrologTestCase {
tests.size(), errors, (end - start) / 1000.0);
System.out.println();
assertEquals("No Errors", 0, errors);
assertThat(errors).isEqualTo(0);
}
private void call(BufferingPrologControl env, String name) {
StructureTerm head = SymbolTerm.create(pkg, name, 0);
if (!env.execute(Prolog.BUILTIN, "call", head)) {
fail("Cannot invoke " + pkg + ":" + name);
}
assert_()
.withFailureMessage("Cannot invoke " + pkg + ":" + name)
.that(env.execute(Prolog.BUILTIN, "call", head))
.isTrue();
}
private Term removePackage(Term test) {