diff options
author | Ulf Adams <ulfjack@google.com> | 2015-03-03 11:11:43 +0000 |
---|---|---|
committer | Ulf Adams <ulfjack@google.com> | 2015-03-05 14:27:18 +0000 |
commit | 4e86f275ffd650a4a5a51f78e1de96422e0f2cd6 (patch) | |
tree | fbd428c2892bac6695227f9d898a3fed7bf930be /src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java | |
parent | 1e79b96be40d4a31d2da89ff7320ddf077494a77 (diff) |
Inline a couple of methods from FoundationTestCase. Having these convenience
methods available doesn't seem to carry its weight, and this makes it easier
for us to migrate to JUnit 4.
--
MOS_MIGRATED_REVID=87597162
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java b/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java index d6642e8dac..ec3c20e93e 100644 --- a/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/testutil/FoundationTestCase.java @@ -13,8 +13,6 @@ // limitations under the License. package com.google.devtools.build.lib.testutil; -import static com.google.common.truth.Truth.assertThat; - import com.google.common.io.Files; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventCollector; @@ -50,7 +48,7 @@ public abstract class FoundationTestCase extends TestCase { protected Reporter reporter; protected EventCollector eventCollector; - private Scratch scratch; + protected Scratch scratch; // Individual tests can opt-out of this handler if they expect an error, by @@ -75,11 +73,11 @@ public abstract class FoundationTestCase extends TestCase { protected void setUp() throws Exception { super.setUp(); scratch = new Scratch(createFileSystem()); - outputBase = scratchDir("/usr/local/google/_blaze_jrluser/FAKEMD5/"); - rootDirectory = scratchDir("/" + TestConstants.TEST_WORKSPACE_DIRECTORY); + outputBase = scratch.dir("/usr/local/google/_blaze_jrluser/FAKEMD5/"); + rootDirectory = scratch.dir("/" + TestConstants.TEST_WORKSPACE_DIRECTORY); scratchFile(rootDirectory.getRelative("WORKSPACE").getPathString()); copySkylarkFilesIfExist(); - actionOutputBase = scratchDir("/usr/local/google/_blaze_jrluser/FAKEMD5/action_out/"); + actionOutputBase = scratch.dir("/usr/local/google/_blaze_jrluser/FAKEMD5/action_out/"); eventCollector = new EventCollector(EventKind.ERRORS_AND_WARNINGS); reporter = new Reporter(eventCollector); reporter.addHandler(failFastHandler); @@ -153,13 +151,6 @@ public abstract class FoundationTestCase extends TestCase { } /** - * Deletes the specified scratch file, using the same specification as {@link Path#delete}. - */ - protected boolean deleteScratchFile(String pathName) throws IOException { - return scratch.deleteFile(pathName); - } - - /** * Create a scratch file in the given filesystem, with the given pathName, * consisting of a set of lines. The method returns a Path instance for the * scratch file. @@ -179,29 +170,6 @@ public abstract class FoundationTestCase extends TestCase { return scratch.file(fs, pathName, content); } - /** - * Create a directory in the scratch filesystem, with the given path name. - */ - public Path scratchDir(String pathName) throws IOException { - return scratch.dir(pathName); - } - - /** - * If "expectedSuffix" is not a suffix of "actual", fails with an informative - * assertion. - */ - protected void assertEndsWith(String expectedSuffix, String actual) { - assertThat(actual).endsWith(expectedSuffix); - } - - /** - * If "expectedPrefix" is not a prefix of "actual", fails with an informative - * assertion. - */ - protected void assertStartsWith(String expectedPrefix, String actual) { - assertThat(actual).startsWith(expectedPrefix); - } - // Mix-in assertions: protected void assertNoEvents() { |