PrologTestCase: Convert to use Google Truth
Change-Id: I77b3b27a40624b39ab4ac1e7dde16da3bb64111c
This commit is contained in:
		| @@ -137,7 +137,9 @@ java_library( | |||||||
|   deps = [ |   deps = [ | ||||||
|     ':server', |     ':server', | ||||||
|     '//gerrit-common:server', |     '//gerrit-common:server', | ||||||
|  |     '//lib:guava', | ||||||
|     '//lib:junit', |     '//lib:junit', | ||||||
|  |     '//lib:truth', | ||||||
|     '//lib/guice:guice', |     '//lib/guice:guice', | ||||||
|     '//lib/prolog:runtime', |     '//lib/prolog:runtime', | ||||||
|   ], |   ], | ||||||
|   | |||||||
| @@ -14,9 +14,8 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.rules; | package com.google.gerrit.rules; | ||||||
|  |  | ||||||
| import static org.junit.Assert.assertEquals; | import static com.google.common.truth.Truth.assert_; | ||||||
| import static org.junit.Assert.assertTrue; | import static com.google.common.truth.Truth.assertThat; | ||||||
| import static org.junit.Assert.fail; |  | ||||||
|  |  | ||||||
| import com.google.gerrit.common.TimeUtil; | import com.google.gerrit.common.TimeUtil; | ||||||
| import com.google.inject.Guice; | import com.google.inject.Guice; | ||||||
| @@ -78,7 +77,7 @@ public abstract class PrologTestCase { | |||||||
|     for (Term[] pair : env.all(Prolog.BUILTIN, "clause", head, new VariableTerm())) { |     for (Term[] pair : env.all(Prolog.BUILTIN, "clause", head, new VariableTerm())) { | ||||||
|       tests.add(pair[0]); |       tests.add(pair[0]); | ||||||
|     } |     } | ||||||
|     assertTrue("has tests", tests.size() > 0); |     assertThat(tests).isNotEmpty(); | ||||||
|     machine = PrologMachineCopy.save(env); |     machine = PrologMachineCopy.save(env); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -173,14 +172,15 @@ public abstract class PrologTestCase { | |||||||
|         tests.size(), errors, (end - start) / 1000.0); |         tests.size(), errors, (end - start) / 1000.0); | ||||||
|     System.out.println(); |     System.out.println(); | ||||||
|  |  | ||||||
|     assertEquals("No Errors", 0, errors); |     assertThat(errors).isEqualTo(0); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private void call(BufferingPrologControl env, String name) { |   private void call(BufferingPrologControl env, String name) { | ||||||
|     StructureTerm head = SymbolTerm.create(pkg, name, 0); |     StructureTerm head = SymbolTerm.create(pkg, name, 0); | ||||||
|     if (!env.execute(Prolog.BUILTIN, "call", head)) { |     assert_() | ||||||
|       fail("Cannot invoke " + pkg + ":" + name); |       .withFailureMessage("Cannot invoke " + pkg + ":" + name) | ||||||
|     } |       .that(env.execute(Prolog.BUILTIN, "call", head)) | ||||||
|  |       .isTrue(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private Term removePackage(Term test) { |   private Term removePackage(Term test) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 David Pursehouse
					David Pursehouse