Open source some skylark tests.
--
MOS_MIGRATED_REVID=103652672
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/BaseFunctionTest.java b/src/test/java/com/google/devtools/build/lib/syntax/BaseFunctionTest.java
index da709a0..5d437d6 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/BaseFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/BaseFunctionTest.java
@@ -17,6 +17,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java b/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java
index ecbb85b..b036e5a 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/BuildFileASTTest.java
@@ -23,6 +23,7 @@
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventCollector;
import com.google.devtools.build.lib.packages.CachingPackageLocator;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.vfs.Path;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EnvironmentTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EnvironmentTest.java
index 36fc761..fd52209 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EnvironmentTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EnvironmentTest.java
@@ -19,6 +19,7 @@
import static org.junit.Assert.fail;
import com.google.common.collect.Sets;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
index 14b26ec..aafbe7c 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java
@@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import com.google.devtools.build.lib.testutil.TestMode;
import org.junit.Test;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
index ade0bbf..ef87be7 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/FunctionTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertNotNull;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
index 1a11e4c..72fd205 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
@@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Before;
import org.junit.Test;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
index 9dc2a15..7b2759d 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ParserTest.java
@@ -24,6 +24,7 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.syntax.DictionaryLiteral.DictionaryEntryLiteral;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Before;
import org.junit.Test;
@@ -976,7 +977,7 @@
List<Statement> stmts3 = parseFile("[ i for (i, j, k) in [(1, 2, 3)] ]\n");
assertThat(stmts3).hasSize(1);
}
-
+
@Test
public void testReturnNone() throws Exception {
List<Statement> defNone = parseFileForSkylark("def foo():", " return None\n");
@@ -993,10 +994,10 @@
List<Statement> defNoExpr = parseFileForSkylark("def bar" + i + "():", " return" + end);
i++;
assertThat(defNoExpr).hasSize(1);
-
+
List<Statement> bodyNoExpr = ((FunctionDefStatement) defNoExpr.get(0)).getStatements();
assertThat(bodyNoExpr).hasSize(1);
-
+
ReturnStatement returnNoExpr = (ReturnStatement) bodyNoExpr.get(0);
Identifier none = (Identifier) returnNoExpr.getReturnExpression();
assertEquals("None", none.getName());
@@ -1149,7 +1150,7 @@
parseFileForSkylark("load('/foo', test3 = old)\n");
assertContainsEvent("syntax error at 'old': expected string");
}
-
+
@Test
public void testParseErrorNotComparison() throws Exception {
setFailFast(false);
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java
index 00bc347..dad7076 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkListTest.java
@@ -18,6 +18,7 @@
import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
index fbceff9..1eb1338 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/SkylarkNestedSetTest.java
@@ -19,6 +19,7 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -175,7 +176,7 @@
private SkylarkNestedSet get(String varname) throws Exception {
return (SkylarkNestedSet) lookup(varname);
}
-
+
@Test
public void testSetOuterOrderWins() throws Exception {
// The order of the outer set should define the final iteration order,
@@ -236,7 +237,7 @@
private boolean areOrdersCompatible(Order first, Order second) {
return first == Order.STABLE_ORDER || second == Order.STABLE_ORDER || first == second;
}
-
+
@Test
public void testSetOrderComplexUnion() throws Exception {
// {1, 11, {2, 22}, {3, 33}, {4, 44}}
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
similarity index 74%
rename from src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java
rename to src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
index fd3002e..3a9c4d5 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/ValidationTests.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/ValidationTest.java
@@ -20,6 +20,7 @@
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
import com.google.devtools.build.lib.syntax.SkylarkList.Tuple;
+import com.google.devtools.build.lib.syntax.util.EvaluationTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -29,7 +30,7 @@
* Tests for the validation process of Skylark files.
*/
@RunWith(JUnit4.class)
-public class ValidationTests extends EvaluationTestCase {
+public class ValidationTest extends EvaluationTestCase {
@Test
public void testAssignmentNotValidLValue() {
@@ -48,16 +49,14 @@
@Test
public void testTwoFunctionsWithTheSameName() throws Exception {
- checkError("Variable foo is read only",
- "def foo():",
- " return 1",
- "def foo(x, y):",
- " return 1");
+ checkError(
+ "Variable foo is read only", "def foo():", " return 1", "def foo(x, y):", " return 1");
}
@Test
public void testFunctionLocalVariable() throws Exception {
- checkError("name 'a' is not defined",
+ checkError(
+ "name 'a' is not defined",
"def func2(b):",
" c = b",
" c = a",
@@ -68,29 +67,17 @@
@Test
public void testFunctionLocalVariableDoesNotEffectGlobalValidationEnv() throws Exception {
- checkError("name 'a' is not defined",
- "def func1():",
- " a = 1",
- "def func2(b):",
- " b = a");
+ checkError("name 'a' is not defined", "def func1():", " a = 1", "def func2(b):", " b = a");
}
@Test
public void testFunctionParameterDoesNotEffectGlobalValidationEnv() throws Exception {
- checkError("name 'a' is not defined",
- "def func1(a):",
- " return a",
- "def func2():",
- " b = a");
+ checkError("name 'a' is not defined", "def func1(a):", " return a", "def func2():", " b = a");
}
@Test
public void testLocalValidationEnvironmentsAreSeparated() throws Exception {
- parse(
- "def func1():",
- " a = 1",
- "def func2():",
- " a = 'abc'\n");
+ parse("def func1():", " a = 1", "def func2():", " a = 'abc'\n");
}
@Test
@@ -100,51 +87,41 @@
@Test
public void testSkylarkGlobalVariablesAreReadonly() throws Exception {
- checkError("Variable a is read only",
- "a = 1",
- "a = 2");
+ checkError("Variable a is read only", "a = 1", "a = 2");
}
@Test
public void testFunctionDefRecursion() throws Exception {
- parse(
- "def func():",
- " func()\n");
+ parse("def func():", " func()\n");
}
@Test
public void testMutualRecursion() throws Exception {
- parse(
- "def foo(i):",
- " bar(i)",
- "def bar(i):",
- " foo(i)",
- "foo(4)");
+ parse("def foo(i):", " bar(i)", "def bar(i):", " foo(i)", "foo(4)");
}
@Test
public void testFunctionDefinedBelow() {
- parse(
- "def bar(): a = foo() + 'a'",
- "def foo(): return 1\n");
+ parse("def bar(): a = foo() + 'a'", "def foo(): return 1\n");
}
@Test
public void testFunctionDoesNotExist() {
- checkError("function 'foo' does not exist",
- "def bar(): a = foo() + 'a'");
+ checkError("function 'foo' does not exist", "def bar(): a = foo() + 'a'");
}
@Test
public void testStructMembersAreImmutable() {
- checkError("can only assign to variables and tuples, not to 's.x'",
+ checkError(
+ "can only assign to variables and tuples, not to 's.x'",
"s = struct(x = 'a')",
"s.x = 'b'\n");
}
@Test
public void testStructDictMembersAreImmutable() {
- checkError("can only assign to variables and tuples, not to 's.x['b']'",
+ checkError(
+ "can only assign to variables and tuples, not to 's.x['b']'",
"s = struct(x = {'a' : 1})",
"s.x['b'] = 2\n");
}
@@ -161,10 +138,7 @@
@Test
public void testNoneAssignment() throws Exception {
- parse("def func():",
- " a = None",
- " a = 2",
- " a = None\n");
+ parse("def func():", " a = None", " a = 2", " a = None\n");
}
@Test
@@ -180,7 +154,8 @@
@Test
public void testFuncReturningDictAssignmentAsLValue() throws Exception {
- checkError("can only assign to variables and tuples, not to 'my_dict()['b']'",
+ checkError(
+ "can only assign to variables and tuples, not to 'my_dict()['b']'",
"def my_dict():",
" return {'a': 1}",
"def func():",
@@ -190,22 +165,18 @@
@Test
public void testEmptyLiteralGenericIsSetInLaterConcatWorks() {
- parse("def func():",
- " s = {}",
- " s['a'] = 'b'\n");
+ parse("def func():", " s = {}", " s['a'] = 'b'\n");
}
@Test
public void testReadOnlyWorksForSimpleBranching() {
- parse("if 1:",
- " v = 'a'",
- "else:",
- " v = 'b'");
+ parse("if 1:", " v = 'a'", "else:", " v = 'b'");
}
@Test
public void testReadOnlyWorksForNestedBranching() {
- parse("if 1:",
+ parse(
+ "if 1:",
" if 0:",
" v = 'a'",
" else:",
@@ -219,58 +190,43 @@
@Test
public void testReadOnlyWorksForDifferentLevelBranches() {
- checkError("Variable v is read only",
- "if 1:",
- " if 1:",
- " v = 'a'",
- " v = 'b'\n");
+ checkError("Variable v is read only", "if 1:", " if 1:", " v = 'a'", " v = 'b'\n");
}
@Test
public void testReadOnlyWorksWithinSimpleBranch() {
- checkError("Variable v is read only",
- "if 1:",
- " v = 'a'",
- "else:",
- " v = 'b'",
- " v = 'c'\n");
+ checkError(
+ "Variable v is read only", "if 1:", " v = 'a'", "else:", " v = 'b'", " v = 'c'\n");
}
@Test
public void testReadOnlyWorksWithinNestedBranch() {
- checkError("Variable v is read only",
+ checkError(
+ "Variable v is read only",
"if 1:",
- " v = 'a'",
- "else:",
- " if 1:",
- " v = 'b'",
- " else:",
- " v = 'c'",
- " v = 'd'\n");
+ " v = 'a'",
+ "else:",
+ " if 1:",
+ " v = 'b'",
+ " else:",
+ " v = 'c'",
+ " v = 'd'\n");
}
@Test
public void testReadOnlyWorksAfterSimpleBranch() {
- checkError("Variable v is read only",
- "if 1:",
- " v = 'a'",
- "else:",
- " w = 'a'",
- "v = 'b'");
+ checkError("Variable v is read only", "if 1:", " v = 'a'", "else:", " w = 'a'", "v = 'b'");
}
@Test
public void testReadOnlyWorksAfterNestedBranch() {
- checkError("Variable v is read only",
- "if 1:",
- " if 1:",
- " v = 'a'",
- "v = 'b'");
+ checkError("Variable v is read only", "if 1:", " if 1:", " v = 'a'", "v = 'b'");
}
@Test
public void testReadOnlyWorksAfterNestedBranch2() {
- checkError("Variable v is read only",
+ checkError(
+ "Variable v is read only",
"if 1:",
" v = 'a'",
"else:",
@@ -281,20 +237,17 @@
@Test
public void testModulesReadOnlyInFuncDefBody() {
- parse("def func():",
- " cmd_helper = set()");
+ parse("def func():", " cmd_helper = set()");
}
@Test
public void testBuiltinGlobalFunctionsReadOnlyInFuncDefBody() {
- parse("def func():",
- " rule = 'abc'");
+ parse("def func():", " rule = 'abc'");
}
@Test
public void testBuiltinGlobalFunctionsReadOnlyAsFuncDefArg() {
- parse("def func(rule):",
- " return rule");
+ parse("def func(rule):", " return rule");
}
@Test
@@ -327,19 +280,17 @@
@Test
public void testLoadRelativePathMultipleSegments() throws Exception {
- checkError("Path 'pkg/extension.bzl' is not valid. It should either start with "
- + "a slash or refer to a file in the current directory.",
+ checkError(
+ "Path 'pkg/extension.bzl' is not valid. It should either start with "
+ + "a slash or refer to a file in the current directory.",
"load('pkg/extension', 'a')\n");
}
@Test
public void testDollarErrorDoesNotLeak() throws Exception {
setFailFast(false);
- parseFile("def GenerateMapNames():",
- " a = 2",
- " b = [3, 4]",
- " if a not b:",
- " print(a)");
+ parseFile(
+ "def GenerateMapNames():", " a = 2", " b = [3, 4]", " if a not b:", " print(a)");
assertContainsEvent("syntax error at 'b': expected in");
// Parser uses "$error" symbol for error recovery.
// It should not be used in error messages.
@@ -364,14 +315,14 @@
assertThat(EvalUtils.getParentWithSkylarkModule(tupleClass)).isEqualTo(Tuple.class);
// TODO(bazel-team): fix that?
- assertThat(ClassObject.class.isAnnotationPresent(SkylarkModule.class))
- .isFalse();
+ assertThat(ClassObject.class.isAnnotationPresent(SkylarkModule.class)).isFalse();
assertThat(ClassObject.SkylarkClassObject.class.isAnnotationPresent(SkylarkModule.class))
.isTrue();
- assertThat(EvalUtils.getParentWithSkylarkModule(ClassObject.SkylarkClassObject.class)
- == ClassObject.SkylarkClassObject.class).isTrue();
- assertThat(EvalUtils.getParentWithSkylarkModule(ClassObject.class))
- .isNull();
+ assertThat(
+ EvalUtils.getParentWithSkylarkModule(ClassObject.SkylarkClassObject.class)
+ == ClassObject.SkylarkClassObject.class)
+ .isTrue();
+ assertThat(EvalUtils.getParentWithSkylarkModule(ClassObject.class)).isNull();
}
@Test
@@ -386,20 +337,16 @@
assertThat(SkylarkType.of(tupleClass)).isEqualTo(SkylarkType.TUPLE);
assertThat(SkylarkType.TUPLE).isNotEqualTo(SkylarkType.LIST);
-
// Also for ClassObject
- assertThat(SkylarkType.of(ClassObject.SkylarkClassObject.class))
- .isEqualTo(SkylarkType.STRUCT);
+ assertThat(SkylarkType.of(ClassObject.SkylarkClassObject.class)).isEqualTo(SkylarkType.STRUCT);
// TODO(bazel-team): fix that?
- assertThat(SkylarkType.of(ClassObject.class))
- .isNotEqualTo(SkylarkType.STRUCT);
+ assertThat(SkylarkType.of(ClassObject.class)).isNotEqualTo(SkylarkType.STRUCT);
// Also test for these bazel classes, to avoid some regression.
// TODO(bazel-team): move to some other place to remove dependency of syntax tests on Artifact?
assertThat(SkylarkType.of(Artifact.SpecialArtifact.class))
.isEqualTo(SkylarkType.of(Artifact.class));
- assertThat(SkylarkType.of(RuleConfiguredTarget.class))
- .isNotEqualTo(SkylarkType.STRUCT);
+ assertThat(SkylarkType.of(RuleConfiguredTarget.class)).isNotEqualTo(SkylarkType.STRUCT);
}
@Test
@@ -411,15 +358,16 @@
SkylarkType combo1 = SkylarkType.Combination.of(SkylarkType.LIST, SkylarkType.INT);
assertThat(SkylarkType.LIST.includes(combo1)).isTrue();
- SkylarkType union1 = SkylarkType.Union.of(
- SkylarkType.MAP, SkylarkType.LIST, SkylarkType.STRUCT);
+ SkylarkType union1 =
+ SkylarkType.Union.of(SkylarkType.MAP, SkylarkType.LIST, SkylarkType.STRUCT);
assertThat(union1.includes(SkylarkType.MAP)).isTrue();
assertThat(union1.includes(SkylarkType.STRUCT)).isTrue();
assertThat(union1.includes(combo1)).isTrue();
assertThat(union1.includes(SkylarkType.STRING)).isFalse();
- SkylarkType union2 = SkylarkType.Union.of(
- SkylarkType.LIST, SkylarkType.MAP, SkylarkType.STRING, SkylarkType.INT);
+ SkylarkType union2 =
+ SkylarkType.Union.of(
+ SkylarkType.LIST, SkylarkType.MAP, SkylarkType.STRING, SkylarkType.INT);
SkylarkType inter1 = SkylarkType.intersection(union1, union2);
assertThat(inter1.includes(SkylarkType.MAP)).isTrue();
assertThat(inter1.includes(SkylarkType.LIST)).isTrue();
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
similarity index 92%
rename from src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java
rename to src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
index 553385d..be5317d 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
@@ -11,11 +11,12 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-package com.google.devtools.build.lib.syntax;
+package com.google.devtools.build.lib.syntax.util;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.truth.Ordered;
import com.google.devtools.build.lib.events.Event;
@@ -24,6 +25,13 @@
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.util.EventCollectionApparatus;
import com.google.devtools.build.lib.packages.PackageFactory;
+import com.google.devtools.build.lib.syntax.Environment;
+import com.google.devtools.build.lib.syntax.EvalException;
+import com.google.devtools.build.lib.syntax.Expression;
+import com.google.devtools.build.lib.syntax.Mutability;
+import com.google.devtools.build.lib.syntax.Parser;
+import com.google.devtools.build.lib.syntax.ParserInputSource;
+import com.google.devtools.build.lib.syntax.Statement;
import com.google.devtools.build.lib.testutil.TestMode;
import com.google.devtools.build.lib.testutil.TestRuleClassProvider;
@@ -43,7 +51,7 @@
protected Environment env;
protected Mutability mutability = Mutability.create("test");
- public EvaluationTestCase() {
+ public EvaluationTestCase() {
createNewInfrastructure();
}
@@ -88,12 +96,12 @@
if (testMode == null) {
throw new IllegalArgumentException(
"TestMode is null. Please set a Testmode via setMode() or set the "
- + "Environment manually by overriding newEnvironment()");
+ + "Environment manually by overriding newEnvironment()");
}
return testMode.createEnvironment(getEventHandler(), null);
}
- protected void createNewInfrastructure() {
+ protected void createNewInfrastructure() {
eventCollectionApparatus = new EventCollectionApparatus(EventKind.ALL_EVENTS);
factory = new PackageFactory(TestRuleClassProvider.getRuleClassProvider());
}
@@ -137,10 +145,10 @@
}
/** Parses an Expression from string without a supporting file */
- Expression parseExpression(String... input) {
+ @VisibleForTesting
+ public Expression parseExpression(String... input) {
return Parser.parseExpression(
- ParserInputSource.create(Joiner.on("\n").join(input), null),
- getEventHandler());
+ ParserInputSource.create(Joiner.on("\n").join(input), null), getEventHandler());
}
public EvaluationTestCase update(String varname, Object value) throws Exception {
@@ -189,24 +197,30 @@
eventCollectionApparatus.setFailFast(failFast);
return this;
}
+
public EvaluationTestCase assertNoEvents() {
eventCollectionApparatus.assertNoEvents();
return this;
}
+
public EventCollector getEventCollector() {
return eventCollectionApparatus.collector();
}
+
public Event assertContainsEvent(String expectedMessage) {
return eventCollectionApparatus.assertContainsEvent(expectedMessage);
}
- public List<Event> assertContainsEventWithFrequency(String expectedMessage,
- int expectedFrequency) {
+
+ public List<Event> assertContainsEventWithFrequency(
+ String expectedMessage, int expectedFrequency) {
return eventCollectionApparatus.assertContainsEventWithFrequency(
expectedMessage, expectedFrequency);
}
+
public Event assertContainsEventWithWordsInQuotes(String... words) {
return eventCollectionApparatus.assertContainsEventWithWordsInQuotes(words);
}
+
public EvaluationTestCase clearEvents() {
eventCollectionApparatus.collector().clear();
return this;
@@ -347,8 +361,8 @@
* @param exactMatch If true, the error message has to be identical to the expected error
* @return An instance of Testable that runs the error check
*/
- protected Testable errorTestable(final boolean exactMatch, final String error,
- final String... statements) {
+ protected Testable errorTestable(
+ final boolean exactMatch, final String error, final String... statements) {
return new Testable() {
@Override
public void run() throws Exception {
@@ -479,12 +493,13 @@
* @param value
*/
public void registerUpdate(final String name, final Object value) {
- setup.add(new Testable() {
- @Override
- public void run() throws Exception {
- EvaluationTestCase.this.update(name, value);
- }
- });
+ setup.add(
+ new Testable() {
+ @Override
+ public void run() throws Exception {
+ EvaluationTestCase.this.update(name, value);
+ }
+ });
}
/**
@@ -493,12 +508,13 @@
* @param statements
*/
public void registerEval(final String... statements) {
- setup.add(new Testable() {
- @Override
- public void run() throws Exception {
- EvaluationTestCase.this.eval(statements);
- }
- });
+ setup.add(
+ new Testable() {
+ @Override
+ public void run() throws Exception {
+ EvaluationTestCase.this.eval(statements);
+ }
+ });
}
/**