summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-02-16 13:14:30 (EST)
committer sefftinge2009-02-16 13:14:30 (EST)
commit05b49faf050fed047dbf07cbbbe4a462b68f9bcc (patch)
treebf4d30ad9f51135b94629103c892c364f0137421
parentfea85682c76ce475717cb824c2042f5325031580 (diff)
downloadorg.eclipse.xtext-05b49faf050fed047dbf07cbbbe4a462b68f9bcc.zip
org.eclipse.xtext-05b49faf050fed047dbf07cbbbe4a462b68f9bcc.tar.gz
org.eclipse.xtext-05b49faf050fed047dbf07cbbbe4a462b68f9bcc.tar.bz2
Cleanup (added missing @Overrides, final modifier, removed redundant casts)
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/XtextGrammarTestLanguageRuntimeModule.java4
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/AbstractPartialParserTest.java2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/datatyperules/ValueConverterTest.java2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/PackratParserGenUtilTest.java71
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java17
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java29
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/AbstractNodeTest.java73
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/LengthOffsetLineTest.java20
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java8
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java2
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java16
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientHandler.java7
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java1
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java1
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java31
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTest.java13
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/ResourceTests.java3
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java19
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java17
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TailWriterTest.java19
-rw-r--r--tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/AbstractDeclarativeValidatorTest.java16
21 files changed, 191 insertions, 180 deletions
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/XtextGrammarTestLanguageRuntimeModule.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/XtextGrammarTestLanguageRuntimeModule.java
index 452550f..b464509 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/XtextGrammarTestLanguageRuntimeModule.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/XtextGrammarTestLanguageRuntimeModule.java
@@ -3,8 +3,6 @@ Generated with Xtext
*/
package org.eclipse.xtext;
-import org.eclipse.xtext.parser.IParser;
-
import com.google.inject.Binder;
/**
@@ -15,7 +13,7 @@ public class XtextGrammarTestLanguageRuntimeModule extends AbstractXtextGrammarT
@Override
public void configure(Binder binder) {
super.configure(binder);
-
+
// extend configuration here
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/AbstractPartialParserTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/AbstractPartialParserTest.java
index 00c8940..2fb1dad 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/AbstractPartialParserTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/AbstractPartialParserTest.java
@@ -9,14 +9,12 @@
package org.eclipse.xtext.parser;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.parser.antlr.IAntlrParser;
import org.eclipse.xtext.parsetree.LeafNode;
import org.eclipse.xtext.tests.AbstractGeneratorTest;
import org.eclipse.xtext.util.EmfStructureComparator;
/**
* @author Jan Köhnlein - Initial contribution and API
- *
*/
public abstract class AbstractPartialParserTest extends AbstractGeneratorTest {
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/datatyperules/ValueConverterTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/datatyperules/ValueConverterTest.java
index 7f6ba23..eb8c309 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/datatyperules/ValueConverterTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/datatyperules/ValueConverterTest.java
@@ -50,7 +50,7 @@ public class ValueConverterTest extends TestCase {
}
}
- public void testSimpleToString() throws ValueConverterException {
+ public void testSimpleToString() {
String expected = "123";
BigDecimal bd = BigDecimal.valueOf(123);
assertEquals(expected, valueConverter.toString(bd));
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/PackratParserGenUtilTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/PackratParserGenUtilTest.java
index 8e3cfc3..3c211be 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/PackratParserGenUtilTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/PackratParserGenUtilTest.java
@@ -16,9 +16,10 @@ import org.eclipse.xtext.XtextFactory;
* @author Sebastian Zarnekow - Initial contribution and API
*/
public class PackratParserGenUtilTest extends TestCase {
-
+
private AbstractRule rule;
-
+
+ @Override
protected void setUp() {
rule = XtextFactory.eINSTANCE.createParserRule();
}
@@ -27,165 +28,165 @@ public class PackratParserGenUtilTest extends TestCase {
rule.setName("Test");
assertEquals("TestConsumer", PackratParserGenUtil.getConsumerClassName(rule));
}
-
+
public void testGetConsumerClassName_test() {
rule.setName("test");
assertEquals("TestConsumer", PackratParserGenUtil.getConsumerClassName(rule));
}
-
+
public void testGetConsumerClassName__() {
rule.setName("_");
assertEquals("_Consumer", PackratParserGenUtil.getConsumerClassName(rule));
}
-
+
public void testGetConsumerClassName_Null() {
rule.setName(null);
assertEquals("Consumer", PackratParserGenUtil.getConsumerClassName(rule));
}
-
+
public void testGetConsumerClassName_Unnamed() {
rule.setName("");
assertEquals("Consumer", PackratParserGenUtil.getConsumerClassName(rule));
}
-
+
public void testGetConsumerFieldName_ML_COMMENT() {
rule.setName("ML_COMMENT");
assertEquals("mlCommentConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_ML__COMMENT() {
rule.setName("ML__COMMENT");
assertEquals("ml_commentConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_ml_comment() {
rule.setName("ml_comment");
assertEquals("mlCommentConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName__() {
rule.setName("_");
assertEquals("_Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName___() {
rule.setName("__");
assertEquals("__Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName____() {
rule.setName("___");
assertEquals("___Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName___12() {
rule.setName("__12");
assertEquals("__12Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName__12() {
rule.setName("_12");
assertEquals("_12Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_STRING() {
rule.setName("STRING");
assertEquals("stringConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_ID() {
rule.setName("ID");
assertEquals("idConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_Grammar() {
rule.setName("Grammar");
assertEquals("grammarConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_grammar() {
rule.setName("grammar");
assertEquals("grammarConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_AbstractRule() {
rule.setName("AbstractRule");
assertEquals("abstractRuleConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_AbstractID() {
rule.setName("AbstractID");
assertEquals("abstractIdConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_AbstractIDElement() {
rule.setName("AbstractIDElement");
assertEquals("abstractIdElementConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_IElement() {
rule.setName("IElement");
assertEquals("iElementConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_IDElement() {
rule.setName("IDElement");
assertEquals("idElementConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_a1() {
rule.setName("a1");
assertEquals("a1Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234() {
rule.setName("A1234");
assertEquals("a1234Consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_Null() {
rule.setName(null);
assertEquals("consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_Unnamed() {
rule.setName("");
assertEquals("consumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234TEST() {
rule.setName("A1234TEST");
assertEquals("a1234TestConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234Test() {
rule.setName("A1234Test");
assertEquals("a1234TestConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234test() {
rule.setName("A1234test");
assertEquals("a1234TestConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234T() {
rule.setName("A1234T");
assertEquals("a1234TConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234IElement() {
rule.setName("A1234IElement");
assertEquals("a1234IElementConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234t() {
rule.setName("A1234t");
assertEquals("a1234TConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
public void testGetConsumerFieldName_A1234iElement() {
rule.setName("A1234iElement");
assertEquals("a1234IElementConsumer", PackratParserGenUtil.getConsumerFieldName(rule));
}
-
+
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java
index c364aba..f3dc76c 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStatePerformanceTest.java
@@ -19,21 +19,22 @@ import junit.framework.TestCase;
public class RecoveryStatePerformanceTest extends TestCase {
private static int ITEMS = 75;
-
+
private static int LOOPS = 10000;
private static int COPY_LOOPS = LOOPS * 5;
-
+
private static int STEPS = 5;
-
+
private ArrayList<Integer> stack;
private RecoveryState recoveryState;
-
+
+ @Override
protected void setUp() {
recoveryState = new RecoveryState();
stack = new ArrayList<Integer>();
}
-
+
public void testStack() {
for (int l = 0; l < LOOPS; l++) {
for (int i = 0; i < ITEMS; i++) {
@@ -50,7 +51,7 @@ public class RecoveryStatePerformanceTest extends TestCase {
}
}
}
-
+
public void testCopyStack() {
for (int i = 0; i < ITEMS; i++) {
stack.add(-1);
@@ -65,7 +66,7 @@ public class RecoveryStatePerformanceTest extends TestCase {
}
}
}
-
+
public void testRecoveryState() {
for (int l = 0; l < LOOPS; l++) {
for (int i = 0; i < ITEMS; i++) {
@@ -82,7 +83,7 @@ public class RecoveryStatePerformanceTest extends TestCase {
}
}
}
-
+
public void testCopyRecoveryState() {
for (int i = 0; i < ITEMS; i++) {
recoveryState.announceNextLevel();
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java
index e416a93..4d895d9 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parser/packrat/consumers/RecoveryStateTest.java
@@ -17,13 +17,14 @@ import junit.framework.TestCase;
* @author Sebastian Zarnekow - Initial contribution and API
*/
public abstract class RecoveryStateTest extends TestCase {
-
+
private RecoveryState recoveryState;
+ @Override
protected void setUp() {
recoveryState = createRecoveryState();
}
-
+
protected abstract RecoveryState createRecoveryState();
public void testSimple_01() {
@@ -34,7 +35,7 @@ public abstract class RecoveryStateTest extends TestCase {
// no exception
recoveryState.assertLevelIsReset();
}
-
+
public void testSimple_02() {
for (int i = 0; i < 100; i++) {
recoveryState.announceNextLevel();
@@ -49,7 +50,7 @@ public abstract class RecoveryStateTest extends TestCase {
// no exception
recoveryState.assertLevelIsReset();
}
-
+
public void testAnnounceNextLevel() {
recoveryState.announceNextLevel();
assertEquals(-1, recoveryState.getCurrentValue());
@@ -64,7 +65,7 @@ public abstract class RecoveryStateTest extends TestCase {
recoveryState.announceNextStep();
assertEquals(1, recoveryState.getCurrentValue());
}
-
+
public void testAnnounceNextPath() {
recoveryState.announceNextLevel();
recoveryState.announceNextPath();
@@ -80,7 +81,7 @@ public abstract class RecoveryStateTest extends TestCase {
recoveryState.announceLevelFinished();
assertEquals(5, recoveryState.getCurrentValue());
}
-
+
public void testOrder() {
for (int i = 0; i < 100; i++) {
recoveryState.announceNextLevel();
@@ -95,7 +96,7 @@ public abstract class RecoveryStateTest extends TestCase {
}
assertEquals(100, i);
}
-
+
public void testCopyAndOrder() {
for (int i = 0; i < 100; i++) {
recoveryState.announceNextLevel();
@@ -111,12 +112,12 @@ public abstract class RecoveryStateTest extends TestCase {
}
assertEquals(100, i);
}
-
+
public void testCopyEmpty() {
RecoveryState copy = recoveryState.copy();
assertEquals(0, copy.size());
}
-
+
public void testException_01() {
try {
recoveryState.announceNextPath();
@@ -125,7 +126,7 @@ public abstract class RecoveryStateTest extends TestCase {
// nothing to do
}
}
-
+
public void testException_02() {
try {
recoveryState.announceNextStep();
@@ -134,21 +135,21 @@ public abstract class RecoveryStateTest extends TestCase {
// nothing to do
}
}
-
+
public static class Simple extends RecoveryStateTest {
@Override
protected RecoveryState createRecoveryState() {
return new RecoveryState();
}
}
-
+
public static class CopyEmpty extends RecoveryStateTest {
@Override
protected RecoveryState createRecoveryState() {
return new RecoveryState().copy();
}
}
-
+
public static class CopyFilled extends RecoveryStateTest {
@Override
protected RecoveryState createRecoveryState() {
@@ -162,7 +163,7 @@ public abstract class RecoveryStateTest extends TestCase {
return result.copy();
}
}
-
+
public static class CopyFilledWithOne extends RecoveryStateTest {
@Override
protected RecoveryState createRecoveryState() {
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/AbstractNodeTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/AbstractNodeTest.java
index 3947db2..991a6af 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/AbstractNodeTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/AbstractNodeTest.java
@@ -16,15 +16,16 @@ import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSet
public class AbstractNodeTest extends AbstractXtextTests {
private AbstractNode rootNode;
-
+
private AbstractNode kindLeaf;
-
+
private AbstractNode kindNode;
private AbstractNode hiddenLeaf;
-
+
private String model;
+ @Override
protected void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
@@ -42,133 +43,133 @@ public class AbstractNodeTest extends AbstractXtextTests {
hiddenLeaf = kindLeaf.getParent().getChildren().get(kindLeaf.getParent().getChildren().indexOf(kindLeaf) + 1);
kindNode = kindLeaf.getParent();
}
-
+
public void testRootGetOffset() {
assertEquals(model.indexOf("spielplatz"), rootNode.getOffset());
}
-
+
public void testRootGetTotalOffset() {
assertEquals(0, rootNode.getTotalOffset());
}
-
+
public void testRootGetLength() {
assertEquals(model.indexOf('}') - model.indexOf("spielplatz") + 1, rootNode.getLength());
}
-
+
public void testRootGetTotalLength() {
assertEquals(model.length(), rootNode.getTotalLength());
}
-
+
public void testRootGetLine() {
assertEquals(3, rootNode.getLine());
}
-
+
public void testRootGetTotalLine() {
assertEquals(1, rootNode.getTotalLine());
}
-
+
public void testRootEndLine() {
assertEquals(8, rootNode.endLine());
}
-
+
public void testRootTotalEndLine() {
assertEquals(10, rootNode.totalEndLine());
}
-
+
public void testCompositeGetOffset() {
assertEquals(model.indexOf("kind"), kindNode.getOffset());
}
-
+
public void testCompositeGetTotalOffset() {
assertEquals(model.indexOf("{") + 1, kindNode.getTotalOffset());
}
-
+
public void testCompositeGetLength() {
assertEquals(model.indexOf(')') - model.indexOf("kind") + 1, kindNode.getLength());
}
-
+
public void testCompositeGetTotalLength() {
assertEquals(model.indexOf(')') - model.indexOf("{"), kindNode.getTotalLength());
}
-
+
public void testCompositeGetLine() {
assertEquals(5, kindNode.getLine());
}
-
+
public void testCompositeGetTotalLine() {
assertEquals(3, kindNode.getTotalLine());
}
-
+
public void testCompositeEndLine() {
assertEquals(6, kindNode.endLine());
}
-
+
public void testCompositeTotalEndLine() {
assertEquals(6, kindNode.totalEndLine());
}
-
+
public void testLeafGetOffset() {
assertEquals(model.indexOf("kind"), kindLeaf.getOffset());
}
-
+
public void testLeafGetTotalOffset() {
assertEquals(model.indexOf("kind"), kindLeaf.getOffset());
}
-
+
public void testLeafGetLength() {
assertEquals("kind".length(), kindLeaf.getLength());
}
-
+
public void testLeafGetTotalLength() {
assertEquals("kind".length(), kindLeaf.getLength());
}
-
+
public void testLeafGetLine() {
assertEquals(5, kindLeaf.getLine());
}
-
+
public void testLeafGetTotalLine() {
assertEquals(5, kindLeaf.getTotalLine());
}
-
+
public void testLeafEndLine() {
assertEquals(5, kindLeaf.endLine());
}
-
+
public void testLeafTotalEndLine() {
assertEquals(5, kindLeaf.totalEndLine());
}
-
+
public void testHiddenLeafGetOffset() {
assertEquals(model.indexOf("kind") + "kind".length(), hiddenLeaf.getOffset());
}
-
+
public void testHiddenLeafGetTotalOffset() {
assertEquals(model.indexOf("kind") + "kind".length(), hiddenLeaf.getOffset());
}
-
+
public void testHiddenLeafGetLength() {
assertEquals(" ".length(), hiddenLeaf.getLength());
}
-
+
public void testHiddenLeafGetTotalLength() {
assertEquals(" ".length(), hiddenLeaf.getLength());
}
-
+
public void testHiddenLeafGetLine() {
assertEquals(5, hiddenLeaf.getLine());
}
-
+
public void testHiddenLeafGetTotalLine() {
assertEquals(5, hiddenLeaf.getTotalLine());
}
-
+
public void testHiddenLeafEndLine() {
assertEquals(5, hiddenLeaf.endLine());
}
-
+
public void testHiddenLeafTotalEndLine() {
assertEquals(5, kindLeaf.totalEndLine());
}
-
+
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/LengthOffsetLineTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/LengthOffsetLineTest.java
index ad554d1..094012a 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/LengthOffsetLineTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/LengthOffsetLineTest.java
@@ -18,7 +18,7 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
public void testOffset() throws Exception {
String model = "element foo;\nelement bar;";
- CompositeNode node = (CompositeNode) getRootNode(model);
+ CompositeNode node = getRootNode(model);
EList<LeafNode> leafNodes = node.getLeafNodes();
Iterator<LeafNode> iter = leafNodes.iterator();
assertEquals(0,iter.next().getTotalOffset());
@@ -31,10 +31,10 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
assertEquals(21,iter.next().getTotalOffset());
assertEquals(24,iter.next().getTotalOffset());
}
-
+
public void testOffset2() throws Exception {
String model = "element foo;\nelement bar;";
- CompositeNode node = (CompositeNode) getRootNode(model);
+ CompositeNode node = getRootNode(model);
Iterator<AbstractNode> iter = node.getChildren().iterator();
assertEquals(0,iter.next().getTotalOffset());
assertEquals(12,iter.next().getTotalOffset());
@@ -43,7 +43,7 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
public void testLineForLeafnodes() throws Exception {
String model = "element foo;\nelement bar;";
- CompositeNode node = (CompositeNode) getRootNode(model);
+ CompositeNode node = getRootNode(model);
EList<LeafNode> leafNodes = node.getLeafNodes();
Iterator<LeafNode> iter = leafNodes.iterator();
assertEquals(1,iter.next().getTotalLine());
@@ -57,10 +57,10 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
assertEquals(2,iter.next().getTotalLine());
assertFalse(iter.hasNext());
}
-
+
public void testLineForCompositeNodes() throws Exception {
String model = "element foo;\nelement bar;\nelement bar;\nelement bar;";
- CompositeNode node = (CompositeNode) getRootNode(model);
+ CompositeNode node = getRootNode(model);
Iterator<AbstractNode> iter = node.getChildren().iterator();
assertEquals(1,iter.next().getTotalLine());
//Note: because preceding whitespace is added to the following node,
@@ -70,11 +70,11 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
assertEquals(3,iter.next().getTotalLine());
assertFalse(iter.hasNext());
}
-
-
+
+
public void testErrors1() throws Exception {
String model = "element # ;";
- CompositeNode node = (CompositeNode) getRootNode(model);
+ CompositeNode node = getRootNode(model);
assertEquals(model, node.serialize());
EList<LeafNode> nodes = node.getLeafNodes();
assertEquals(5,nodes.size());
@@ -84,7 +84,7 @@ public class LengthOffsetLineTest extends AbstractGeneratorTest {
offset += leafNode.getTotalLength();
}
}
-
+
@Override
protected void setUp() throws Exception {
super.setUp();
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
index 1662d1d..165bfa2 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
@@ -53,7 +53,7 @@ public class ComplexReconstrTest extends AbstractGeneratorTest {
}
private String parseAndSerialize(String model) throws Exception {
- EObject result = (EObject) getModel(model);
+ EObject result = getModel(model);
if (logger.isTraceEnabled())
logger.trace(EmfFormater.objToStr(result));
return serialize(result);
@@ -63,17 +63,17 @@ public class ComplexReconstrTest extends AbstractGeneratorTest {
reconstructAndCompare("a");
reconstructAndCompare("a + b");
}
-
+
public void testTrickyGSimple() throws Exception {
String model = "TG [[2]]";
assertEquals(model, parseAndSerialize(model));
}
-
+
public void testTrickyGWithNull() throws Exception {
String model = "TG [0,[2,0],3,4,0]";
assertEquals(model, parseAndSerialize(model));
}
-
+
public void testTrickyGComplex() throws Exception {
String model = "TG [2, [2,3,45,6],242,[23423,[34,34,[242343],234]]]";
assertEquals(model, parseAndSerialize(model));
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
index f329870..b496785 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
@@ -40,7 +40,7 @@ public class SimpleReconstrTest extends AbstractGeneratorTest {
}
private String parseAndSerialize(String model) throws Exception {
- EObject result = (EObject) getModel(model);
+ EObject result = getModel(model);
if (logger.isTraceEnabled()) {
logger.trace(EmfFormater.objToStr(result));
logger.trace(EmfFormater.objToStr(NodeUtil.getRootNode(result)));
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
index 1657bbb..31ad572 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
@@ -18,20 +18,20 @@ public class WhitespacePreservingCallbackTest extends AbstractGeneratorTest {
check("a \t /* foo bar */ + b");
}
-
+
// FIXME: Make this test work again
-
+
// public void testFail1() throws Exception {
// IAstFactory f = getASTFactory();
// failsWith(f.create("Add"), XtextSerializationException.class);
// }
-
+
// FIXME: Make this test work again
-
+
// public void testFail2() throws Exception {
// IAstFactory f = getASTFactory();
// EObject add = f.create("Add");
-//
+//
// // one operand INVALID
// EObject atom1 = f.create("Atom");
// f.set(atom1, "name", "x");
@@ -43,20 +43,20 @@ public class WhitespacePreservingCallbackTest extends AbstractGeneratorTest {
// f.set(atom2, "name", "x");
// f.add(add, "addOperands", atom2);
// assertNotNull(serialize(add));
-//
+//
// // three operands INVALID
// EObject atom3 = f.create("Atom");
// f.set(atom3, "name", "x");
// f.add(add, "addOperands", atom3);
// failsWith(add, XtextSerializationException.class);
// }
-
+
private void check(String m1) throws Exception {
assertEquals(m1, parseAndSerialize(m1));
}
private String parseAndSerialize(String model) throws Exception {
- EObject result = (EObject) getModel(model);
+ EObject result = getModel(model);
return serialize(result);
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientHandler.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientHandler.java
index 9bf9ce5..b021efa 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientHandler.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientHandler.java
@@ -1,5 +1,5 @@
/**
- *
+ *
*/
package org.eclipse.xtext.parsetree.transientvalues;
@@ -14,8 +14,8 @@ import org.eclipse.xtext.parsetree.reconstr.impl.DefaultTransientValueService;
*/
public class TransientHandler extends DefaultTransientValueService {
- public boolean isTransient(EObject owner, EStructuralFeature feature,
- int index) {
+ @Override
+ public boolean isTransient(EObject owner, EStructuralFeature feature, int index) {
// System.out.println("isTransient " + feature.getName()
// + ((index >= 0) ? "[" + index + "]" : ""));
final String n = feature.getName();
@@ -30,6 +30,7 @@ public class TransientHandler extends DefaultTransientValueService {
return super.isTransient(owner, feature, index);
}
+ @Override
public boolean isMixedList(EObject owner, EStructuralFeature feature) {
// System.out.println("isMixedList " + feature.getName());
if ("TestList".equals(owner.eClass().getName()))
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
index 31bd6fd..fd74258 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
@@ -8,6 +8,7 @@ import org.eclipse.xtext.tests.AbstractGeneratorTest;
*/
public class TransientValuesTest extends AbstractGeneratorTest {
+ @Override
protected void setUp() throws Exception {
with(TransientValuesTestStandaloneSetup.class);
super.setUp();
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
index 4e9b9e9..8785192 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
@@ -18,6 +18,7 @@ public class XtextResourcePerformanceTest extends AbstractGeneratorTest {
private static final int NUM_ELEMENTS = 190;
private String model;
+ @Override
protected void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
index a3f273f..1f77c75 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
@@ -20,14 +20,15 @@ import org.eclipse.xtext.tests.AbstractGeneratorTest;
public class XtextResourceTest extends AbstractGeneratorTest {
private XtextResource resource;
- private String simpleModel = "spielplatz 1 { kind ( Bob 0 ) }";
+ private final String simpleModel = "spielplatz 1 { kind ( Bob 0 ) }";
+ @Override
protected void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
resource = getResourceFromString("");
}
-
+
public void testInitialState() throws Exception {
assertNotNull(resource);
assertTrue(resource.isLoaded());
@@ -35,7 +36,7 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertFalse(resource.isModified());
assertTrue(resource.getErrors().isEmpty());
assertTrue(resource.getWarnings().isEmpty());
-
+
IParseResult parseResult = resource.getParseResult();
assertNotNull("parseResult", parseResult);
assertNotNull(parseResult.getRootNode());
@@ -43,36 +44,36 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertEquals(0, parseResult.getRootNode().getTotalLength());
assertNull(parseResult.getRootASTElement());
}
-
+
public void testModify_01() throws Exception {
resource.update(0, 0, simpleModel);
assertFalse(resource.isModified());
}
-
+
public void testModify_02() throws Exception {
resource.reparse(simpleModel);
assertFalse(resource.isModified());
}
-
+
public void testModify_03() throws Exception {
resource.reparse(simpleModel);
assertFalse(resource.isModified());
modifySpielplatz();
assertFalse(resource.isModified());
}
-
+
public void testModify_04() throws Exception {
resource.setTrackingModification(true);
resource.update(0, 0, simpleModel);
assertFalse(resource.isModified());
}
-
+
public void testModify_05() throws Exception {
resource.setTrackingModification(true);
resource.reparse(simpleModel);
assertFalse(resource.isModified());
}
-
+
public void testModify_06() throws Exception {
resource.setTrackingModification(true);
resource.reparse(simpleModel);
@@ -80,7 +81,7 @@ public class XtextResourceTest extends AbstractGeneratorTest {
modifySpielplatz();
assertTrue(resource.isModified());
}
-
+
private void modifySpielplatz() {
EObject obj = resource.getParseResult().getRootASTElement();
assertNotNull(obj);
@@ -90,7 +91,7 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertEquals(1, obj.eGet(feature));
obj.eSet(feature, 3);
}
-
+
public void testUnload() throws Exception {
resource.reparse(simpleModel);
IParseResult parseResult = resource.getParseResult();
@@ -98,10 +99,10 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertNull(resource.getParseResult());
assertTrue(parseResult.getRootASTElement().eIsProxy());
}
-
+
public void testUpdate() throws Exception {
resource.update(0, 0, simpleModel);
-
+
IParseResult parseResult = resource.getParseResult();
assertNotNull("parseResult", parseResult);
assertNotNull(parseResult.getRootNode());
@@ -109,7 +110,7 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertEquals(simpleModel.length(), parseResult.getRootNode().getTotalLength());
assertNotNull(parseResult.getRootASTElement());
}
-
+
public void testErrorMarkers() throws Exception {
String model = "spielplatz 1 {kind(B 1) erwachsener(E 1) familie(F E E B, C)}";
resource.update(0, 0, model);
@@ -118,6 +119,6 @@ public class XtextResourceTest extends AbstractGeneratorTest {
assertEquals(model.indexOf("C)"), diag.getOffset());
assertEquals(1, diag.getLength());
}
-
+
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTest.java
index 732e4d6..287a52a 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/MultiValueFeatureTest.java
@@ -19,12 +19,13 @@ import org.eclipse.xtext.tests.AbstractGeneratorTest;
* @author Sebastian Zarnekow - Initial contribution and API
*/
public class MultiValueFeatureTest extends AbstractGeneratorTest {
-
+
+ @Override
protected void setUp() throws Exception {
super.setUp();
with(MultiValueFeatureTestLanguageStandaloneSetup.class);
}
-
+
public void testMetamodel() {
EPackage generated = getMetamodelAccess().getGeneratedEPackages()[0];
assertEquals("MultiValueFeatureTestLanguage", generated.getName());
@@ -35,16 +36,16 @@ public class MultiValueFeatureTest extends AbstractGeneratorTest {
assertTrue(feature.isMany());
assertFalse(feature.isUnique());
}
-
+
@SuppressWarnings("unchecked")
public void testModel() throws Exception {
String model = "idA idB idA";
EObject parsedModel = getModel(model);
List<String> values = (List<String>) parsedModel.eGet(parsedModel.eClass().getEStructuralFeature("featureA"));
assertEquals(3, values.size());
- assertEquals("idA", values.get(0));
- assertEquals("idB", values.get(1));
- assertEquals("idA", values.get(2));
+ assertEquals("idA", values.get(0));
+ assertEquals("idB", values.get(1));
+ assertEquals("idA", values.get(2));
}
}
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/ResourceTests.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/ResourceTests.java
index 7c01c58..e2eec28 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/ResourceTests.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/resource/metamodel/ResourceTests.java
@@ -16,11 +16,12 @@ import org.eclipse.xtext.tests.AbstractGeneratorTest;
*/
public class ResourceTests extends AbstractGeneratorTest {
+ @Override
protected void setUp() throws Exception {
super.setUp();
with(LangATestLanguageStandaloneSetup.class);
}
-
+
public void testFragmentsWorkInBothDirections() throws Exception {
EObject model = getModel("type A extends B type B extends A");
EObject typeA1 = (EObject) invokeWithXtend("types.first()", model);
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
index 767e40e..131082f 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
@@ -23,24 +23,25 @@ import junit.framework.TestCase;
public class FilteringIteratorTest extends TestCase implements Filter<String> {
private String matchMe;
-
+
private List<String> list;
-
+
+ @Override
protected void setUp() throws Exception {
super.setUp();
matchMe = "matchMe";
list = new ArrayList<String>();
}
-
+
public boolean matches(String param) {
return param.equals(matchMe);
}
-
+
public void testEmptyList() {
Iterator<String> iter = new FilteringIterator<String>(list, this);
assertFalse(iter.hasNext());
}
-
+
public void testConcurrentModificationException() {
Iterator<String> iter = new FilteringIterator<String>(list, this);
list.add("null");
@@ -50,7 +51,7 @@ public class FilteringIteratorTest extends TestCase implements Filter<String> {
} catch (ConcurrentModificationException ex) {
}
}
-
+
public void testRemove() {
list.add(matchMe);
Iterator<String> iter = new FilteringIterator<String>(list, this);
@@ -61,7 +62,7 @@ public class FilteringIteratorTest extends TestCase implements Filter<String> {
} catch (UnsupportedOperationException ex) {
}
}
-
+
public void testHasNext() {
list.add("null");
list.add(matchMe);
@@ -72,7 +73,7 @@ public class FilteringIteratorTest extends TestCase implements Filter<String> {
assertEquals(matchMe, iter.next());
assertFalse(iter.hasNext());
}
-
+
public void testNext() {
list.add("null");
list.add(matchMe);
@@ -85,7 +86,7 @@ public class FilteringIteratorTest extends TestCase implements Filter<String> {
assertEquals(matchMe, iter.next());
assertFalse(iter.hasNext());
}
-
+
public void testNextCallsHasNext() {
list.add("null");
list.add(matchMe);
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
index ac08d68..fb922db 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
@@ -20,25 +20,26 @@ public class SimpleCacheTest extends TestCase implements Function<String, String
private SimpleCache<String, String> cache;
private String expectedParam;
-
+
private int callCount;
-
+
+ @Override
protected void setUp() throws Exception {
this.cache = new SimpleCache<String, String>(this);
expectedParam = null;
callCount = 0;
}
-
+
public String exec(String param) {
assertEquals(expectedParam, param);
callCount++;
return param + param;
}
-
+
public void testInitial() {
assertEquals(0, cache.getSize());
}
-
+
public void testGet() {
expectedParam = new String("param"); // is not interned
String cached = cache.get(expectedParam);
@@ -49,20 +50,20 @@ public class SimpleCacheTest extends TestCase implements Function<String, String
assertEquals(1, callCount);
assertEquals(1, cache.getSize());
}
-
+
public void testDiscard() {
String first = new String("first"); // is not interned
expectedParam = first;
cache.get(expectedParam);
String second = new String("second"); // is not interned
- expectedParam = second;
+ expectedParam = second;
cache.get(expectedParam);
assertEquals(2, cache.getSize());
cache.discard(expectedParam);
assertEquals(1, cache.getSize());
assertFalse(cache.hasCachedValue(expectedParam));
}
-
+
public void testClear() {
expectedParam = new String("param"); // is not interned
cache.get(expectedParam);
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TailWriterTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TailWriterTest.java
index ba9b098..22ab3ae 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TailWriterTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/util/TailWriterTest.java
@@ -17,7 +17,7 @@ import junit.framework.TestCase;
* @author Sebastian Zarnekow - Initial contribution and API
*/
public class TailWriterTest extends TestCase {
-
+
private StringWriter writer;
private BufferedWriter buff;
@@ -25,21 +25,22 @@ public class TailWriterTest extends TestCase {
protected void setUp() {
writer = new StringWriter();
}
-
+
+ @Override
protected void tearDown() {
writer = null;
buff = null;
}
-
+
protected void initWriter(int ignoreLines) {
buff = new BufferedWriter(new TailWriter(writer, ignoreLines));
}
-
+
protected void write(String s) throws IOException {
buff.write(s);
buff.flush();
}
-
+
protected void check(String s) {
assertEquals(s, writer.getBuffer().toString());
}
@@ -50,26 +51,26 @@ public class TailWriterTest extends TestCase {
write(s);
check(s);
}
-
+
public void testSuppressNegative() throws Exception {
initWriter(-1);
String s = "foo\nbar\n";
write(s);
check(s);
}
-
+
public void testSuppressOne() throws Exception {
initWriter(1);
write("foo\nbar\n");
check("bar\n");
}
-
+
public void testSuppressTwo() throws Exception {
initWriter(2);
write("foo\nbar\nzonk\n");
check("zonk\n");
}
-
+
public void testSuppressAll() throws Exception {
initWriter(4);
write("foo\nbar\nzonk\n");
diff --git a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/AbstractDeclarativeValidatorTest.java b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/AbstractDeclarativeValidatorTest.java
index 872ea69..717f52f 100644
--- a/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/AbstractDeclarativeValidatorTest.java
+++ b/tests/org.eclipse.xtext.generator.tests/src/org/eclipse/xtext/validator/AbstractDeclarativeValidatorTest.java
@@ -24,17 +24,18 @@ import org.eclipse.emf.ecore.EcorePackage;
*
*/
public class AbstractDeclarativeValidatorTest extends TestCase {
-
+
public void testSimpleDispatch() throws Exception {
-
+
AbstractDeclarativeValidator test = new TestValidator();
TestChain chain = chain();
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, null);
assertMatch(chain, 1, 3);
}
-
+
public void testDeeperHierarchyWithOverwrittenJavaMethods() throws Exception {
AbstractDeclarativeValidator test = new TestValidator() {
+ @Override
@Check
public void foo(Object x) {
error("fooObject",5);
@@ -44,9 +45,10 @@ public class AbstractDeclarativeValidatorTest extends TestCase {
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, null);
assertMatch(chain, 1, 5);
}
-
+
public void testSkipExpensive() throws Exception {
AbstractDeclarativeValidator test = new TestValidator() {
+ @SuppressWarnings("unused")
@Check(CheckType.EXPENSIVE)
public void bar(Object x) {
error("fooObject",27);
@@ -55,11 +57,11 @@ public class AbstractDeclarativeValidatorTest extends TestCase {
TestChain chain = chain();
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.singletonMap((Object)CheckMode.KEY, (Object)CheckMode.FAST));
assertMatch(chain, 1, 3);
-
+
chain = chain();
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.singletonMap((Object)CheckMode.KEY, (Object)CheckMode.ALL));
assertMatch(chain, 1, 3, 27);
-
+
chain = chain();
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, null);
assertMatch(chain, 1, 3, 27);
@@ -75,7 +77,7 @@ public class AbstractDeclarativeValidatorTest extends TestCase {
private TestChain chain() {
return new TestChain();
}
-
+
@SuppressWarnings("unused")
private class TestValidator extends AbstractDeclarativeValidator {
@Check