aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java
diff options
context:
space:
mode:
authorGravatar ruperts <ruperts@google.com>2017-10-17 00:26:29 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-10-18 10:27:59 +0200
commit8986b6e307a071ee8883afd0f1b6f2c4054ea17d (patch)
tree23983b7b9e351b7ce2a3613df7d832686306812f /src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java
parent7cd9e883dd31f54cd505844aa1f1e0ed7bd9f380 (diff)
Extend from an abstract base class to avoid duplication of utility methods in RuleErrorConsumers
RELNOTES: None. PiperOrigin-RevId: 172387755
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java25
1 files changed, 3 insertions, 22 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java
index a60cd7c01b..7fe406660d 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java
@@ -16,7 +16,7 @@ package com.google.devtools.build.lib.analysis;
import static com.google.common.truth.Truth.assertThat;
-import com.google.devtools.build.lib.packages.RuleClass.ConfiguredTargetFactory.RuleErrorException;
+import com.google.devtools.build.lib.packages.AbstractRuleErrorConsumer;
import com.google.devtools.build.lib.packages.RuleErrorConsumer;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +27,8 @@ import org.junit.runners.JUnit4;
/** Unit tests for {@link LocationExpander}. */
@RunWith(JUnit4.class)
public class LocationExpanderTest {
- private static final class Capture implements RuleErrorConsumer {
+ private static final class Capture extends AbstractRuleErrorConsumer
+ implements RuleErrorConsumer {
private final List<String> warnsOrErrors = new ArrayList<>();
@Override
@@ -51,29 +52,9 @@ public class LocationExpanderTest {
}
@Override
- public RuleErrorException throwWithRuleError(String message) throws RuleErrorException {
- ruleError(message);
- throw new RuleErrorException();
- }
-
- @Override
- public RuleErrorException throwWithAttributeError(String attrName, String message)
- throws RuleErrorException {
- attributeError(attrName, message);
- throw new RuleErrorException();
- }
-
- @Override
public boolean hasErrors() {
return !warnsOrErrors.isEmpty();
}
-
- @Override
- public void assertNoErrors() throws RuleErrorException {
- if (hasErrors()) {
- throw new RuleErrorException();
- }
- }
}
private LocationExpander makeExpander(RuleErrorConsumer ruleErrorConsumer) throws Exception {