() {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/SerializeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/SerializeTest.java
index 7464ad5f6..ce775c670 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/SerializeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/SerializeTest.java
@@ -1,23 +1,24 @@
package org.eclipse.xtext.parsetree;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
+import org.junit.Test;
public class SerializeTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
}
- public void testUncompleteComment() throws Exception {
+ @Test public void testUncompleteComment() throws Exception {
String model ="a /* comment *";
checkSerialize(model, 1);
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
String model = "/* foo */ x + y * ( /* stuff */ a /* end */\n * b)";
int x = model.length();
while (x>0) {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/ElementMatcherTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/ElementMatcherTest.java
index e7708ed47..fa7b16842 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/ElementMatcherTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/ElementMatcherTest.java
@@ -20,15 +20,15 @@ import org.eclipse.xtext.formatting.IElementMatcherProvider.IBetweenElements;
import org.eclipse.xtext.formatting.IElementMatcherProvider.IElementMatcherExtension;
import org.eclipse.xtext.formatting.IElementMatcherProvider.IElementPattern;
import org.eclipse.xtext.formatting.impl.AbstractTokenStream;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.formatter.services.ElementMatcherTestLanguageGrammarAccess;
import org.eclipse.xtext.parsetree.formatter.services.ElementMatcherTestLanguageGrammarAccess.LoopElements;
import org.eclipse.xtext.parsetree.formatter.services.ElementMatcherTestLanguageGrammarAccess.OptionalCallsElements;
import org.eclipse.xtext.parsetree.formatter.services.ElementMatcherTestLanguageGrammarAccess.RuleCallsElements;
import org.eclipse.xtext.parsetree.formatter.services.ElementMatcherTestLanguageGrammarAccess.SimpleElements;
-import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.Tuples;
+import org.junit.Test;
import com.google.common.collect.Lists;
@@ -37,19 +37,6 @@ import com.google.common.collect.Lists;
*/
public class ElementMatcherTest extends AbstractXtextTests {
- @Override
- protected boolean shouldTestSerializer(XtextResource resource) {
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=361355
- if ("testRecursion".equals(getName()))
- return false;
-
- // missing values for unassigned rule call.
- if ("testRuleCalls2a".equals(getName()) || "testRuleCalls2b".equals(getName())
- || "testRuleCalls2c".equals(getName()))
- return false;
- return true;
- }
-
private ElementMatcherTestLanguageGrammarAccess g;
private static class Patterns {
@@ -140,20 +127,20 @@ public class ElementMatcherTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ElementMatcherTestLanguageStandaloneSetup.class);
g = (ElementMatcherTestLanguageGrammarAccess) getGrammarAccess();
}
- public void testSimple1() throws Exception {
+ @Test public void testSimple1() throws Exception {
Patterns pattern = new Patterns();
pattern.after(g.getSimpleAccess().getNumberSignDigitOneKeyword_0());
pattern.before(g.getSimpleAccess().getKw1Keyword_2_0());
assertEquals("#1 ! abc ! kw1 efg long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleAssignments() throws Exception {
+ @Test public void testSimpleAssignments() throws Exception {
Patterns pattern = new Patterns();
pattern.after(g.getSimpleAccess().getNameAssignment_1());
pattern.before(g.getSimpleAccess().getOptionalAssignment_2_1());
@@ -161,40 +148,40 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#1 abc ! kw1 ! efg ! long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleGroup1() throws Exception {
+ @Test public void testSimpleGroup1() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getSimpleAccess().getGroup_2());
assertEquals("#1 abc ! kw1 efg long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleGroup2() throws Exception {
+ @Test public void testSimpleGroup2() throws Exception {
Patterns pattern = new Patterns();
pattern.after(g.getSimpleAccess().getGroup_2());
assertEquals("#1 abc kw1 efg ! long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleGroup3() throws Exception {
+ @Test public void testSimpleGroup3() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getSimpleAccess().getGroup());
pattern.after(g.getSimpleAccess().getGroup());
assertEquals("! #1 abc kw1 efg long.name !", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleBetween1() throws Exception {
+ @Test public void testSimpleBetween1() throws Exception {
SimpleElements se = g.getSimpleAccess();
Patterns pattern = new Patterns();
pattern.between(se.getNumberSignDigitOneKeyword_0(), se.getNameIDTerminalRuleCall_1_0());
assertEquals("#1 ! abc kw1 efg long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleBetween2() throws Exception {
+ @Test public void testSimpleBetween2() throws Exception {
SimpleElements se = g.getSimpleAccess();
Patterns pattern = new Patterns();
pattern.between(se.getNumberSignDigitOneKeyword_0(), se.getNameAssignment_1());
assertEquals("#1 ! abc kw1 efg long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleBetween3() throws Exception {
+ @Test public void testSimpleBetween3() throws Exception {
SimpleElements se = g.getSimpleAccess();
Patterns pattern = new Patterns();
pattern.between(se.getNameIDTerminalRuleCall_1_0(), se.getDatatypeAssignment_3());
@@ -202,7 +189,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#1 abc kw1 efg long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testSimpleBetween4() throws Exception {
+ @Test public void testSimpleBetween4() throws Exception {
SimpleElements se = g.getSimpleAccess();
Patterns pattern = new Patterns();
pattern.between(se.getGroup_2(), se.getDatatypeFQNParserRuleCall_3_0());
@@ -210,14 +197,14 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#1 abc kw1 efg ! long.name", match("#1 abc kw1 efg long.name", pattern));
}
- public void testRuleCalls1() throws Exception {
+ @Test public void testRuleCalls1() throws Exception {
RuleCallsElements rce = g.getRuleCallsAccess();
Patterns pattern = new Patterns();
pattern.before(rce.getRuleCallsSubParserRuleCall_1());
assertEquals("#2 ! sub foo", match("#2 sub foo", pattern));
}
- public void testRuleCalls2() throws Exception {
+ @Test public void testRuleCalls2() throws Exception {
RuleCallsElements rce = g.getRuleCallsAccess();
Patterns pattern = new Patterns();
pattern = new Patterns();
@@ -225,7 +212,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#2 sub ! foo", match("#2 sub foo", pattern));
}
- public void testRuleCalls3() throws Exception {
+ @Test public void testRuleCalls3() throws Exception {
RuleCallsElements rce = g.getRuleCallsAccess();
Patterns pattern = new Patterns();
pattern.between(rce.getNameAssignment_2(), rce.getCall1Assignment_3());
@@ -234,63 +221,63 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#2 sub foo ! ass2 zonk", match("#2 sub foo ass2 zonk", pattern));
}
- public void testRuleCalls4() throws Exception {
+ @Test public void testRuleCalls4() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsSubAccess().getSubAssignment());
pattern.after(g.getRuleCallsSubAccess().getSubAssignment());
assertEquals("#2 ! sub ! foo", match("#2 sub foo", pattern));
}
- public void testRuleCalls5() throws Exception {
+ @Test public void testRuleCalls5() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsAss1Access().getGroup());
pattern.after(g.getRuleCallsAss1Access().getGroup());
assertEquals("#2 sub foo ! ass1 foo !", match("#2 sub foo ass1 foo", pattern));
}
- public void testRuleCalls6() throws Exception {
+ @Test public void testRuleCalls6() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsAss2Access().getGroup());
pattern.after(g.getRuleCallsAss2Access().getGroup());
assertEquals("#2 sub foo ass1 bar ! ass2 zonk !", match("#2 sub foo ass1 bar ass2 zonk", pattern));
}
- public void testRuleCalls7() throws Exception {
+ @Test public void testRuleCalls7() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsAccess().getCall1Assignment_3());
pattern.after(g.getRuleCallsAccess().getCall1Assignment_3());
assertEquals("#2 sub foo ! ass1 bar ! ass2 zonk", match("#2 sub foo ass1 bar ass2 zonk", pattern));
}
- public void testRuleCalls8() throws Exception {
+ @Test public void testRuleCalls8() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsAccess().getCall2Assignment_4());
pattern.after(g.getRuleCallsAccess().getCall2Assignment_4());
assertEquals("#2 sub foo ass1 bar ! ass2 zonk !", match("#2 sub foo ass1 bar ass2 zonk", pattern));
}
- public void testRuleCalls9() throws Exception {
+ @Test public void testRuleCalls9() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsSubAccess().getSubAssignment());
pattern.after(g.getRuleCallsSubAccess().getSubAssignment());
assertEquals("#2 ! sub ! foo", match("#2 sub foo", pattern));
}
- public void testRuleCalls10() throws Exception {
+ @Test public void testRuleCalls10() throws Exception {
Patterns pattern = new Patterns();
pattern.before(g.getRuleCallsAccess().getCall1Assignment_3());
pattern.after(g.getRuleCallsAccess().getCall1Assignment_3());
assertEquals("#2 sub foo ass2 bar", match("#2 sub foo ass2 bar", pattern));
}
- public void testOptionalCalls1() throws Exception {
+ @Test public void testOptionalCalls1() throws Exception {
OptionalCallsElements oce = g.getOptionalCallsAccess();
Patterns pattern = new Patterns();
pattern.between(oce.getNumberSignDigitThreeKeyword_0(), oce.getNameAssignment_3());
assertEquals("#3 ! foo", match("#3 foo", pattern));
}
- public void testOptionalCalls2() throws Exception {
+ @Test public void testOptionalCalls2() throws Exception {
OptionalCallsElements oce = g.getOptionalCallsAccess();
Patterns pattern = new Patterns();
pattern.between(oce.getNumberSignDigitThreeKeyword_0(), g.getOptionalCallsSub1Access().getSubKeyword_2());
@@ -298,7 +285,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#3 ! sub ! foo", match("#3 sub foo", pattern));
}
- public void testOptionalCalls3() throws Exception {
+ @Test public void testOptionalCalls3() throws Exception {
OptionalCallsElements oce = g.getOptionalCallsAccess();
Patterns pattern = new Patterns();
pattern.between(oce.getNumberSignDigitThreeKeyword_0(), g.getOptionalCallsSub2Access().getSub2Keyword_0());
@@ -306,91 +293,92 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#3 ! sub2 foo sub sub3 bar ! baz", match("#3 sub2 foo sub sub3 bar baz", pattern));
}
- public void testRecursion() throws Exception {
+ @Test public void testRecursion() throws Exception {
+ disableSerializerTest();
Patterns p = new Patterns();
p.after(g.getRecursionSubAccess().getLeftCurlyBracketKeyword_1());
p.before(g.getRecursionSubAccess().getRightCurlyBracketKeyword_3());
assertEquals("#4 { ! bar { ! foo ! } { ! { ! zonk ! } ! } ! }", match("#4 { { foo } bar { { zonk } } }", p));
}
- public void testLoop1() throws Exception {
+ @Test public void testLoop1() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.before(le.getNamesAssignment_1());
assertEquals("#5 ! foo ! bar ! baz", match("#5 foo bar baz", p));
}
- public void testLoop2() throws Exception {
+ @Test public void testLoop2() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.after(le.getNamesAssignment_1());
assertEquals("#5 foo ! bar ! baz !", match("#5 foo bar baz", p));
}
- public void testLoop3() throws Exception {
+ @Test public void testLoop3() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getNamesAssignment_1(), le.getNamesAssignment_1());
assertEquals("#5 foo ! bar ! baz", match("#5 foo bar baz", p));
}
- public void testLoop4() throws Exception {
+ @Test public void testLoop4() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.before(le.getGroup_2());
assertEquals("#5 foo bar ! gr grfoo ! gr grbar", match("#5 foo bar gr grfoo gr grbar", p));
}
- public void testLoop5() throws Exception {
+ @Test public void testLoop5() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.after(le.getGroup_2());
assertEquals("#5 foo bar gr grfoo ! gr grbar !", match("#5 foo bar gr grfoo gr grbar", p));
}
- public void testLoop6() throws Exception {
+ @Test public void testLoop6() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getGroup_2(), le.getGroup_2());
assertEquals("#5 foo bar gr grfoo ! gr grbar", match("#5 foo bar gr grfoo gr grbar", p));
}
- public void testLoop7() throws Exception {
+ @Test public void testLoop7() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getNamesAssignment_1(), le.getGroup_2());
assertEquals("#5 foo bar ! gr grfoo gr grbar", match("#5 foo bar gr grfoo gr grbar", p));
}
- public void testLoop8() throws Exception {
+ @Test public void testLoop8() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.before(le.getAlternatives_3());
assertEquals("#5 x gr gf gr gb ! '1' ! '2' ! 1 ! 2", match("#5 x gr gf gr gb '1' '2' 1 2", p));
}
- public void testLoop9() throws Exception {
+ @Test public void testLoop9() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.after(le.getAlternatives_3());
assertEquals("#5 x gr gf gr gb '1' ! '2' ! 1 ! 2 !", match("#5 x gr gf gr gb '1' '2' 1 2", p));
}
- public void testLoop10() throws Exception {
+ @Test public void testLoop10() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getAlternatives_3(), le.getAlternatives_3());
assertEquals("#5 x gr gf gr gb '1' ! '2' ! 1 ! 2", match("#5 x gr gf gr gb '1' '2' 1 2", p));
}
- public void testLoop11() throws Exception {
+ @Test public void testLoop11() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getGroup_2(), le.getAlternatives_3());
assertEquals("#5 x gr gf gr gb ! '1' '2' 1 2", match("#5 x gr gf gr gb '1' '2' 1 2", p));
}
- public void testLoop12() throws Exception {
+ @Test public void testLoop12() throws Exception {
LoopElements le = g.getLoopAccess();
Patterns p = new Patterns();
p.between(le.getNamesAssignment_1(), le.getAlternatives_3());
@@ -398,7 +386,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#5 x ! '1' '2' 1 2", match("#5 x '1' '2' 1 2", p));
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
Patterns p = new Patterns();
p.before("", g.getAddAccess().getPlusSignKeyword_1_1());
@@ -408,7 +396,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals(expected1, match("#6 1 + 2 * 4 * ((3 + 4) + foo(4, 6 +7))", p));
}
- public void testExpression2() throws Exception {
+ @Test public void testExpression2() throws Exception {
Patterns p = new Patterns();
p.before("<", g.getPrimAccess().getValAssignment_0_1());
p.after(">", g.getPrimAccess().getValAssignment_0_1());
@@ -416,7 +404,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals(expected2, match("#6 1 + 2 * 4 * ((3 + 4) + foo(4, 6 +7))", p));
}
- public void testExpression3() throws Exception {
+ @Test public void testExpression3() throws Exception {
Patterns p = new Patterns();
p.before("<", g.getPrimAccess().getAddParserRuleCall_3_1());
p.after(">", g.getPrimAccess().getAddParserRuleCall_3_1());
@@ -424,7 +412,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals(expected3, match("#6 (1 + 2) * 4 * ((3 + 4 * (5 + 5)) + foo(4, 6 * (7 + 9)))", p));
}
- public void testExpression4() throws Exception {
+ @Test public void testExpression4() throws Exception {
Patterns p = new Patterns();
p.before("(", g.getPrimAccess().getTargetAssignment_2_2());
p.after(")", g.getPrimAccess().getTargetAssignment_2_2());
@@ -432,7 +420,7 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals(expected4, match("#6 => => => => 5", p));
}
- public void testExpression5() throws Exception {
+ @Test public void testExpression5() throws Exception {
Patterns p = new Patterns();
p.before("<", g.getAddAccess().getRightAssignment_1_2());
p.after(">", g.getAddAccess().getRightAssignment_1_2());
@@ -444,13 +432,14 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals(expected, match("#6 (1 + 2) * 4 * ((3 + 4 * (5 + 5)) + foo(4, 6 * (7 + 9)))", p));
}
- public void testExpression6() throws Exception {
+ @Test public void testExpression6() throws Exception {
Patterns p = new Patterns();
p.between(g.getPrimAccess().getRightParenthesisKeyword_3_2(), g.getMultAccess().getAsteriskKeyword_1_1());
assertEquals("#6 ( 5 + 4 ) ! * 7", match("#6 (5 + 4) * 7", p));
}
- public void testRuleCalls2a() throws Exception {
+ @Test public void testRuleCalls2a() throws Exception {
+ disableSerializerTest();
Patterns p = new Patterns();
p.before(g.getConstructorRule().getAlternatives());
p.after(g.getConstructorRule().getAlternatives());
@@ -460,7 +449,8 @@ public class ElementMatcherTest extends AbstractXtextTests {
// assertEquals("#7 ! ! foo kw3", match("#7 foo kw3", p));
}
- public void testRuleCalls2b() throws Exception {
+ @Test public void testRuleCalls2b() throws Exception {
+ disableSerializerTest();
Patterns p = new Patterns();
p.before(g.getFieldRule().getAlternatives());
p.after(g.getFieldRule().getAlternatives());
@@ -470,7 +460,8 @@ public class ElementMatcherTest extends AbstractXtextTests {
assertEquals("#7 ! foo ! kw3", match("#7 foo kw3", p));
}
- public void testRuleCalls2c() throws Exception {
+ @Test public void testRuleCalls2c() throws Exception {
+ disableSerializerTest();
Patterns p = new Patterns();
p.before(g.getParameterRule().getAlternatives());
p.after(g.getParameterRule().getAlternatives());
@@ -480,13 +471,13 @@ public class ElementMatcherTest extends AbstractXtextTests {
// assertEquals("#7 foo ! ! kw3", match("#7 foo kw3", p));
}
- public void testNestedStart() throws Exception {
+ @Test public void testNestedStart() throws Exception {
Patterns p = new Patterns();
p.after(g.getNestedStartSubAccess().getGroup());
assertEquals("#8 ! foo", match("#8 foo", p));
}
- public void testNestedStart2() throws Exception {
+ @Test public void testNestedStart2() throws Exception {
Patterns p = new Patterns();
p.after(g.getNestedStartAccess().getGroup());
p.before(g.getNestedStartAccess().getGroup());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java
index acb59e484..508ae0ca2 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/FormatterTest.java
@@ -7,8 +7,8 @@ import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.formatting.INodeModelFormatter.IFormattedRegion;
import org.eclipse.xtext.formatting.impl.AbstractTokenStream;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.util.ParseHelper;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.util.ParseHelper;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.parsetree.formatter.formattertestlanguage.Decl;
@@ -23,6 +23,7 @@ import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic;
import org.eclipse.xtext.serializer.sequencer.IHiddenTokenSequencer;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer;
+import org.junit.Test;
public class FormatterTest extends AbstractXtextTests {
@@ -53,7 +54,7 @@ public class FormatterTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(FormatterTestLanguageStandaloneSetup.class);
}
@@ -110,7 +111,7 @@ public class FormatterTest extends AbstractXtextTests {
// assertEquals(ptcTb.toString(), nmsTb.toString());
}
- public void testLinewrap() throws Exception {
+ @Test public void testLinewrap() throws Exception {
final String model = "test linewrap float val; int x; double y;";
final String expected = "test linewrap\nfloat val;\nint x;\ndouble y;";
assertFormattedPTC(expected, model);
@@ -119,7 +120,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testKeepComments() throws Exception {
+ @Test public void testKeepComments() throws Exception {
// final String model = "test linewrap float val; int x; double y;";
final String model = "// begincomment \ntest linewrap// comment1\n" + "float val;//comment2\n" + "int x;"
+ "double y; //yoyoyo!\n// endcomment.";
@@ -131,7 +132,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testIndentation() throws Exception {
+ @Test public void testIndentation() throws Exception {
final String model = "test indentation { float val; double y; indentation { int x; } }";
final String expected = "test indentation {\n float val;\n double y;\n indentation {\n int x;\n }\n}";
assertFormattedPTC(expected, model);
@@ -140,7 +141,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testAssociation() throws Exception {
+ @Test public void testAssociation() throws Exception {
final String model = "test indentation { var = [0,1,2,3,4]; }";
final String expected = "test indentation {\n var=[ 0, 1, 2, 3, 4 ];\n}";
assertFormattedPTC(expected, model);
@@ -149,7 +150,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testIndentationAndComments() throws Exception {
+ @Test public void testIndentationAndComments() throws Exception {
final String model = "test /* xxx */ indentation { float val; // some float\n double /* oo */ y; indentation { // some block\n int x; // xxx\n } } // final comment";
final String expected = "test /* xxx */ indentation {\n float val; // some float\n double /* oo */ y;\n indentation { // some block\n int x; // xxx\n }\n} // final comment";
assertFormattedPTC(expected, model);
@@ -158,7 +159,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testIndentationAndLineWrap() throws Exception {
+ @Test public void testIndentationAndLineWrap() throws Exception {
final String model = "test indentation { void func(x:int,y:int,s:javalangString, foo:javasqlDate, blupp:mylongtype, msads:adshdjkhsakdasdkslajdlsask, x:x, a:b, c:d ); }";
final String expected = "test indentation {\n void func(x:int, y:int,\n\t s:javalangString,\n\t foo:javasqlDate,\n\t blupp:mylongtype,\n\t msads:adshdjkhsakdasdkslajdlsask,\n\t x:x, a:b, c:d);\n}";
assertFormattedPTC(expected, model);
@@ -167,7 +168,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testBetween1() throws Exception {
+ @Test public void testBetween1() throws Exception {
final String model = "test indentation { indentation { x x; }; }";
final String expected = "test indentation {\n indentation {\n x x;\n };\n}";
assertFormattedPTC(expected, model);
@@ -176,7 +177,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testBetween2() throws Exception {
+ @Test public void testBetween2() throws Exception {
final String model = "test indentation { indentation { x x; } }";
final String expected = "test indentation {\n indentation {\n x x;\n }\n}";
assertFormattedPTC(expected, model);
@@ -185,7 +186,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapDatatypeRule() throws Exception {
+ @Test public void testLinewrapDatatypeRule() throws Exception {
final String model = "test linewrap fqn ab; fqn xx.yy.zz;";
final String expected = "test linewrap\nfqn\nab;\nfqn\nxx.yy.zz;";
assertFormattedPTC(expected, model);
@@ -194,43 +195,43 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapDatatypeRulePartial1() throws Exception {
+ @Test public void testLinewrapDatatypeRulePartial1() throws Exception {
final String model = "test linewrap fqn ab . xx .yy .zz;";
final String expected = "test linewrap fqn ab.xx.yy.zz;";
assertFormattedNM(expected, model, 22, 2);
}
- public void testLinewrapDatatypeRulePartial2() throws Exception {
+ @Test public void testLinewrapDatatypeRulePartial2() throws Exception {
final String model = "test linewrap fqn ab . xx .yy .zz;fqn xxx;";
final String expected = "test linewrap fqn\nab.xx.yy.zz;fqn xxx;";
assertFormattedNM(expected, model, 15, 10);
}
- public void testLinewrapDatatypeRulePartial3() throws Exception {
+ @Test public void testLinewrapDatatypeRulePartial3() throws Exception {
final String model = "test linewrap fqn ab . xx .yy .zz;fqn xxx;";
final String expected = "test linewrap fqn ab.xx.yy.zz;\nfqn xxx;";
assertFormattedNM(expected, model, 25, 12);
}
- public void testFormatSegment1() throws Exception {
+ @Test public void testFormatSegment1() throws Exception {
final String model = "test\nindentation {\n indentation { x x ; } }";
final String expected = "test\nindentation {\n indentation {\n x x;\n } }";
assertFormattedNM(expected, model, 30, 18);
}
- public void testFormatSegment2() throws Exception {
+ @Test public void testFormatSegment2() throws Exception {
final String model = "test indentation {\n indentation { x x ; } }";
// final String expected = "test\nindentation {\n indentation {\n x x;\n } }";
assertFormattedNM(model, model, 7, 10);
}
- public void testFormatSegment3() throws Exception {
+ @Test public void testFormatSegment3() throws Exception {
final String model = " test indentation {\n indentation { x x ; } }";
final String expected = "test indentation {\n indentation {\n x x;\n }\n}";
assertFormattedNM(expected, model, 0, model.length());
}
- public void testLinewrapDatatypeRuleRef1() throws Exception {
+ @Test public void testLinewrapDatatypeRuleRef1() throws Exception {
final String model = "test linewrap fqn ab .cd .ef; fqnref ab. cd. ef;";
final String expected = "test linewrap\nfqn\nab.cd.ef;\nfqnref\nab.cd.ef;";
// assertFormattedPTC(expected, model);
@@ -238,7 +239,7 @@ public class FormatterTest extends AbstractXtextTests {
// assertEqualTokenStreams(model);
}
- public void testLinewrapDatatypeRuleRef2() throws Exception {
+ @Test public void testLinewrapDatatypeRuleRef2() throws Exception {
final String model = "test linewrap fqn ab.cd.ef; fqnref ab.cd.ef;";
final String expected = "test linewrap\nfqn\nab.cd.ef;\nfqnref\nab.cd.ef;";
assertFormattedPTC(expected, model);
@@ -247,7 +248,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapDatatypeRuleComments() throws Exception {
+ @Test public void testLinewrapDatatypeRuleComments() throws Exception {
final String model = "test linewrap/* 1 */fqn/* 2 */ab.cd.ef/* 3 */;/* 4 */fqnref/* 5 */ab.cd.ef/* 6 */;/* 7 */";
final String expected = "test linewrap /* 1 */ fqn\n\t/* 2 */\nab.cd.ef /* 3 */; /* 4 */\n\tfqnref /* 5 */ ab.cd.ef\n\t/* 6 */; /* 7 */";
assertFormattedPTC(expected, model);
@@ -256,7 +257,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testEnumeration() throws Exception {
+ @Test public void testEnumeration() throws Exception {
final String model = "test linewrap enum lit1,lit2,lit3,lit1;";
final String expected = "test linewrap\nenum lit1 ,\nlit2,\nlit3,\nlit1;";
assertFormattedPTC(expected, model);
@@ -266,7 +267,7 @@ public class FormatterTest extends AbstractXtextTests {
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=312559
- public void testSuppressedWhitespace() throws Exception {
+ @Test public void testSuppressedWhitespace() throws Exception {
final String model = "test linewrap `f%%a` post;";
final String expected = "test linewrap\n`f%< b >%a` post;";
assertFormattedPTC(expected, model);
@@ -275,7 +276,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testSuppressedLinewrap() throws Exception {
+ @Test public void testSuppressedLinewrap() throws Exception {
final String model = "test linewrap\n`foo%abcd%foo%< b\n\t>%abcd%foo%abcd%foo%abcd%"
+ "foo%abcd%foo%abcd%foo%abcd%foo%abcd%foo%abcd%foo%xx%foo%abcd%foo%abcd%"
+ "foo%abcd%foo%<\n\tb >%foo%abcd` post;";
@@ -285,7 +286,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapMin() throws Exception {
+ @Test public void testLinewrapMin() throws Exception {
final String model = "test wrapminmax foo bar;";
final String expected = "test wrapminmax\n\nfoo bar;";
assertFormattedPTC(expected, model);
@@ -294,7 +295,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapMax() throws Exception {
+ @Test public void testLinewrapMax() throws Exception {
final String model = "test wrapminmax\n\n\n\n\n\n\n\n\n\n\n\n\nfoo bar;";
final String expected = "test wrapminmax\n\n\n\n\nfoo bar;";
assertFormattedPTC(expected, model);
@@ -303,7 +304,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapKeep() throws Exception {
+ @Test public void testLinewrapKeep() throws Exception {
final String model = "test wrapminmax\n\n\n\nfoo bar;";
assertFormattedPTC(model, model);
assertFormattedNM(model, model, 0, model.length());
@@ -311,7 +312,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testLinewrapDefault() throws Exception {
+ @Test public void testLinewrapDefault() throws Exception {
FormattertestlanguageFactory f = FormattertestlanguageFactory.eINSTANCE;
TestLinewrapMinMax m = f.createTestLinewrapMinMax();
Decl d = f.createDecl();
@@ -323,7 +324,7 @@ public class FormatterTest extends AbstractXtextTests {
assertEquals(expected, actual);
}
- public void testSpace() throws Exception {
+ @Test public void testSpace() throws Exception {
final String model = "test linewrap space foo;";
final String expected = "test linewrap\nspace foo;";
assertFormattedPTC(expected, model);
@@ -332,7 +333,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testDatatypeRules() throws Exception {
+ @Test public void testDatatypeRules() throws Exception {
final String model = "test linewrap datatypes abc kw1 bcd def kw3;";
final String expected = "test linewrap\ndatatypes abc\nkw1\nbcd\ndef\nkw3;";
assertFormattedPTC(expected, model);
@@ -341,7 +342,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testWrappingdatatype1() throws Exception {
+ @Test public void testWrappingdatatype1() throws Exception {
final String model = "test wrappingdt foo kw1";
final String expected = "test wrappingdt foo kw1";
assertFormattedPTC(expected, model);
@@ -350,7 +351,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testWrappingdatatype2() throws Exception {
+ @Test public void testWrappingdatatype2() throws Exception {
final String model = "test wrappingdt foo bar kw1";
final String expected = "test wrappingdt foo bar kw1";
assertFormattedPTC(expected, model);
@@ -359,7 +360,7 @@ public class FormatterTest extends AbstractXtextTests {
assertPreserved(model);
}
- public void testWrappingdatatype3() throws Exception {
+ @Test public void testWrappingdatatype3() throws Exception {
final String model = "test wrappingdt f\nb kw1";
final String expected = "test wrappingdt f\nb kw1";
assertFormattedPTC(expected, model);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/XtextFormatterTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/XtextFormatterTest.java
index 5af08419a..ce8875414 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/XtextFormatterTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/formatter/XtextFormatterTest.java
@@ -7,21 +7,22 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.Serializer;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
+import org.junit.Test;
public class XtextFormatterTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
- public void testXtextFormatting() throws IOException {
+ @Test public void testXtextFormatting() throws IOException {
String path = getClass().getPackage().getName().replace('.', '/');
URI u = URI.createURI("classpath:/" + path + "/XtextFormatterMessy.xtext");
XtextResourceSet resourceSet = new XtextResourceSet();
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/Bug305397Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/Bug305397Test.java
index 51d8cb0f6..e93ab9796 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/Bug305397Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/Bug305397Test.java
@@ -7,18 +7,19 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.impl;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.parsetree.impl.bug305397.Element;
import org.eclipse.xtext.parsetree.impl.bug305397.Model;
+import org.junit.Test;
/**
* @author Sven Effting - Initial contribution and API
*/
public class Bug305397Test extends AbstractXtextTests {
- public void testBug() throws Exception {
+ @Test public void testBug() throws Exception {
with(new Bug305397StandaloneSetup());
Model model = (Model) getModel(" a element \n element X end\n element Y end \nend");
Element outer = model.getElements().get(0);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/CommentAssociationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/CommentAssociationTest.java
index ed82a7207..07f39d6be 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/CommentAssociationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/CommentAssociationTest.java
@@ -13,7 +13,7 @@ import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
@@ -24,6 +24,7 @@ import org.eclipse.xtext.parsetree.reconstr.ICommentAssociater;
import org.eclipse.xtext.parsetree.reconstr.Serializer;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.util.ReplaceRegion;
+import org.junit.Test;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
@@ -34,12 +35,12 @@ import com.google.common.collect.Multimap;
public class CommentAssociationTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(CommentAssociationTestLanguageStandaloneSetup.class);
}
- public void testCommentAssociation() throws Exception {
+ @Test public void testCommentAssociation() throws Exception {
String textModel = "element x // comment post x\n"
+ "// comment pre y\n"
+ "element /* comment inside y */ y // comment post y\n"
@@ -57,7 +58,7 @@ public class CommentAssociationTest extends AbstractXtextTests {
checkComments(multimap, z, "// comment pre z\n");
}
- public void testCommentAssociationAtEndOfFile() throws Exception {
+ @Test public void testCommentAssociationAtEndOfFile() throws Exception {
String textModel = "element x // comment post x";
Model model = (Model) getModel(textModel);
Multimap multimap = createModel2CommentMap(model);
@@ -79,7 +80,7 @@ public class CommentAssociationTest extends AbstractXtextTests {
return multimap;
}
- public void testCommentAssociationWithAction() throws Exception {
+ @Test public void testCommentAssociationWithAction() throws Exception {
String textModel = "// comment pre x\n"
+ "element /* comment inside x */ x // comment post x\n"
+ "// comment pre y\n"
@@ -99,7 +100,7 @@ public class CommentAssociationTest extends AbstractXtextTests {
checkComments(multimap, z, "// comment pre z\n");
}
- public void testSerializeReplacement() throws Exception {
+ @Test public void testSerializeReplacement() throws Exception {
String xBlock = "// comment pre x\n"
+ "element /* comment inside x */ x // comment post x\n";
String yBlock = "// comment pre y\n" + "element /* comment inside y */ y // comment post y\n";
@@ -133,7 +134,7 @@ public class CommentAssociationTest extends AbstractXtextTests {
}
}
- public void testCommentsAtEndOfFile() throws Exception {
+ @Test public void testCommentsAtEndOfFile() throws Exception {
// the text-model without a trailing LB does not work
// since the serializer does not know something about the terminal rules
// String textModel = "element x // comment post x";
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/ParsetreeUtilTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/ParsetreeUtilTest.java
index 9c2a2c496..b07595119 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/ParsetreeUtilTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/ParsetreeUtilTest.java
@@ -9,9 +9,10 @@ package org.eclipse.xtext.parsetree.impl;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
@@ -25,7 +26,7 @@ public class ParsetreeUtilTest extends AbstractXtextTests {
private ICompositeNode parentMetamodelNode;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
modelAsString = "\n" +
@@ -45,7 +46,7 @@ public class ParsetreeUtilTest extends AbstractXtextTests {
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
grammar = null;
modelAsString = null;
grammarNode = null;
@@ -54,7 +55,7 @@ public class ParsetreeUtilTest extends AbstractXtextTests {
super.tearDown();
}
- public void testSetup() {
+ @Test public void testSetup() {
assertNotNull(grammar);
assertNotNull(grammarNode);
assertNotNull(metamodelNode);
@@ -63,110 +64,110 @@ public class ParsetreeUtilTest extends AbstractXtextTests {
assertTrue(grammar.eResource().getErrors().isEmpty());
}
- public void testLine_01() {
+ @Test public void testLine_01() {
assertEquals(2, grammarNode.getStartLine());
}
- public void testLine_02() {
+ @Test public void testLine_02() {
assertEquals(4, metamodelNode.getStartLine());
}
- public void testLine_03() {
+ @Test public void testLine_03() {
assertEquals(4, parentMetamodelNode.getStartLine());
}
- public void testTotalLine_01() {
+ @Test public void testTotalLine_01() {
assertEquals(1, grammarNode.getTotalStartLine());
}
- public void testTotalLine_02() {
+ @Test public void testTotalLine_02() {
assertEquals(2, metamodelNode.getTotalStartLine());
}
- public void testTotalLine_03() {
+ @Test public void testTotalLine_03() {
assertEquals(2, parentMetamodelNode.getTotalStartLine());
}
- public void testEndLine_01() {
+ @Test public void testEndLine_01() {
assertEquals(8, grammarNode.getEndLine());
}
- public void testEndLine_02() {
+ @Test public void testEndLine_02() {
assertEquals(4, metamodelNode.getEndLine());
}
- public void testEndLine_03() {
+ @Test public void testEndLine_03() {
assertEquals(4, parentMetamodelNode.getEndLine());
}
- public void testTotalEndLine_01() {
+ @Test public void testTotalEndLine_01() {
assertEquals(11, grammarNode.getTotalEndLine());
}
- public void testTotalEndLine_02() {
+ @Test public void testTotalEndLine_02() {
assertEquals(4, metamodelNode.getEndLine());
}
- public void testTotalEndLine_03() {
+ @Test public void testTotalEndLine_03() {
assertEquals(4, parentMetamodelNode.getEndLine());
}
- public void testOffset_01() {
+ @Test public void testOffset_01() {
assertEquals(modelAsString.indexOf("grammar"), grammarNode.getOffset());
}
- public void testOffset_02() {
+ @Test public void testOffset_02() {
assertEquals(modelAsString.indexOf("generate"), metamodelNode.getOffset());
}
- public void testOffset_03() {
+ @Test public void testOffset_03() {
assertEquals(modelAsString.indexOf("generate"), parentMetamodelNode.getOffset());
}
- public void testOffset_WithActionCreated() throws Exception {
+ @Test public void testOffset_WithActionCreated() throws Exception {
with(new Bug305397StandaloneSetup());
assertEquals(modelAsString.indexOf("generate"), parentMetamodelNode.getOffset());
}
- public void testTotalOffset_01() {
+ @Test public void testTotalOffset_01() {
assertEquals(0, grammarNode.getTotalOffset());
}
- public void testTotalOffset_02() {
+ @Test public void testTotalOffset_02() {
assertEquals(modelAsString.indexOf("\n\ngenerate"), metamodelNode.getTotalOffset());
}
- public void testTotalOffset_03() {
+ @Test public void testTotalOffset_03() {
assertEquals(modelAsString.indexOf("\n\ngenerate"), parentMetamodelNode.getTotalOffset());
}
- public void testLength_01() {
+ @Test public void testLength_01() {
assertEquals(modelAsString.indexOf(';') - modelAsString.indexOf("grammar") + ";".length(), grammarNode.getLength());
}
- public void testLength_02() {
+ @Test public void testLength_02() {
assertEquals(
modelAsString.indexOf("ParsetreeUtilTest\"") - modelAsString.indexOf("generate") + "ParsetreeUtilTest\"".length(),
metamodelNode.getLength());
}
- public void testLength_03() {
+ @Test public void testLength_03() {
assertEquals(
modelAsString.indexOf("ParsetreeUtilTest\"") - modelAsString.indexOf("generate") + "ParsetreeUtilTest\"".length(),
parentMetamodelNode.getLength());
}
- public void testTotalLength_01() {
+ @Test public void testTotalLength_01() {
assertEquals(modelAsString.length(), grammarNode.getTotalLength());
}
- public void testTotalLength_02() {
+ @Test public void testTotalLength_02() {
assertEquals(
modelAsString.indexOf("ParsetreeUtilTest\"") - modelAsString.indexOf("\n\ngenerate") + "ParsetreeUtilTest\"".length(),
metamodelNode.getTotalLength());
}
- public void testTotalLength_03() {
+ @Test public void testTotalLength_03() {
assertEquals(
modelAsString.indexOf("ParsetreeUtilTest\"") - modelAsString.indexOf("\n\ngenerate") + "ParsetreeUtilTest\"".length(),
parentMetamodelNode.getTotalLength());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/TransientContainerReferencesTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/TransientContainerReferencesTest.java
index a26fbbaf1..18e2b7022 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/TransientContainerReferencesTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/impl/TransientContainerReferencesTest.java
@@ -7,8 +7,6 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.impl;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
@@ -16,13 +14,15 @@ import org.eclipse.xtext.parsetree.impl.crossContainment.CrossContainmentFactory
import org.eclipse.xtext.parsetree.impl.crossContainment.CrossContainmentPackage;
import org.eclipse.xtext.parsetree.impl.crossContainment.Element;
import org.eclipse.xtext.parsetree.reconstr.impl.DefaultTransientValueService;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class TransientContainerReferencesTest extends TestCase {
+public class TransientContainerReferencesTest extends Assert {
- public void testCrossResourceContainment() throws Exception {
+ @Test public void testCrossResourceContainment() throws Exception {
Element parent = CrossContainmentFactory.eINSTANCE.createElement();
Element child = CrossContainmentFactory.eINSTANCE.createElement();
parent.getContainment().add(child);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug285381Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug285381Test.java
index 2e3ca46e8..5cc6be1c5 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug285381Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug285381Test.java
@@ -7,11 +7,12 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.reconstr;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguageFactory;
import org.eclipse.xtext.linking.langATestLanguage.Main;
import org.eclipse.xtext.linking.langATestLanguage.Type;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
@@ -19,12 +20,12 @@ import org.eclipse.xtext.linking.langATestLanguage.Type;
public class Bug285381Test extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(LangATestLanguageStandaloneSetup.class);
}
- public void testDummy() {
+ @Test public void testDummy() {
}
public void _testSerializeReference_01() throws Exception {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug299395Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug299395Test.java
index a6d821aeb..45a6814b7 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug299395Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug299395Test.java
@@ -7,10 +7,11 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.reconstr;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.bug299395.Bug299395Factory;
import org.eclipse.xtext.parsetree.reconstr.bug299395.Model;
import org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
@@ -18,25 +19,25 @@ import org.eclipse.xtext.parsetree.reconstr.bug299395.SubModel;
public class Bug299395Test extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(Bug299395TestLanguageStandaloneSetup.class);
}
- public void testSerialization() {
+ @Test public void testSerialization() {
Model model = Bug299395Factory.eINSTANCE.createModel();
String serialized = getSerializer().serialize(model);
assertEquals("", serialized);
}
- public void testSerialization_02() {
+ @Test public void testSerialization_02() {
Model model = Bug299395Factory.eINSTANCE.createModel();
model.getStrings().add("Foo");
String serialized = getSerializer().serialize(model);
assertEquals("{ \"Foo\" }", serialized);
}
- public void testSerialization_03() {
+ @Test public void testSerialization_03() {
Model model = Bug299395Factory.eINSTANCE.createModel();
model.getStrings().add("Foo");
model.getStrings().add("Bar");
@@ -45,7 +46,7 @@ public class Bug299395Test extends AbstractXtextTests {
assertEquals("{ \"Foo\" } { \"Bar\" } { \"Zonk\" }", serialized);
}
- public void testSerialization_04() {
+ @Test public void testSerialization_04() {
Model model = Bug299395Factory.eINSTANCE.createModel();
model.getKeys().add("Key1");
model.getValues().add("Value1");
@@ -55,7 +56,7 @@ public class Bug299395Test extends AbstractXtextTests {
assertEquals("[ \"Key1\" \"Value1\" \"Key2\" \"Value2\" ]", serialized);
}
- public void testSerialization_05() {
+ @Test public void testSerialization_05() {
Model model = Bug299395Factory.eINSTANCE.createModel();
model.getStrings().add("Unused");
model.getKeys().add("Key1");
@@ -66,7 +67,7 @@ public class Bug299395Test extends AbstractXtextTests {
assertEquals("{ \"Unused\" } [ \"Key1\" \"Value1\" \"Key2\" \"Value2\" ]", serialized);
}
- public void testSerialization_06() {
+ @Test public void testSerialization_06() {
Model model = Bug299395Factory.eINSTANCE.createModel();
SubModel subModel = Bug299395Factory.eINSTANCE.createSubModel();
model.setSubModel(subModel);
@@ -74,7 +75,7 @@ public class Bug299395Test extends AbstractXtextTests {
assertEquals("subModel", serialized);
}
- public void testSerialization_07() {
+ @Test public void testSerialization_07() {
Model model = Bug299395Factory.eINSTANCE.createModel();
SubModel subModel = Bug299395Factory.eINSTANCE.createSubModel();
model.setSubModel(subModel);
@@ -83,7 +84,7 @@ public class Bug299395Test extends AbstractXtextTests {
assertEquals("subModel 1 2 \"s1\"", serialized);
}
- public void testSerialization_08() {
+ @Test public void testSerialization_08() {
Model model = Bug299395Factory.eINSTANCE.createModel();
SubModel subModel = Bug299395Factory.eINSTANCE.createSubModel();
model.setSubModel(subModel);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug302128Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug302128Test.java
index 7d032ffc6..a32c9117a 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug302128Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/Bug302128Test.java
@@ -9,10 +9,11 @@ package org.eclipse.xtext.parsetree.reconstr;
import java.io.ByteArrayOutputStream;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.bug302128.Model;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
/**
* @author svenefftinge - Initial contribution and API
@@ -21,7 +22,7 @@ import org.eclipse.xtext.util.StringInputStream;
*/
public class Bug302128Test extends AbstractXtextTests {
- public void testTheBug2() throws Exception {
+ @Test public void testTheBug2() throws Exception {
with(new Bug302128TestLanguageStandaloneSetup());
String text = "VARIABLE += value.val value2.val\n"
+ "VARIABLE2 += value3.val value4.val\n\n"
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
index 959ab98e3..86866e01e 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/ComplexReconstrTest.java
@@ -12,12 +12,13 @@ import org.apache.log4j.Logger;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.ParserRule;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.tests.EmfAssert;
import org.eclipse.xtext.util.EmfFormatter;
+import org.junit.Test;
public class ComplexReconstrTest extends AbstractXtextTests {
@@ -25,7 +26,7 @@ public class ComplexReconstrTest extends AbstractXtextTests {
.getLogger(ComplexReconstrTest.class);
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ComplexReconstrTestLanguageStandaloneSetup.class);
}
@@ -35,7 +36,7 @@ public class ComplexReconstrTest extends AbstractXtextTests {
return false;
}
- public void testPrintGrammar() {
+ @Test public void testPrintGrammar() {
XtextResourceSet rs = get(XtextResourceSet.class);
rs.setClasspathURIContext(getClass());
URI u = URI
@@ -51,12 +52,12 @@ public class ComplexReconstrTest extends AbstractXtextTests {
}
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
String model = "( a + b - c ) !";
assertEquals(model, parseAndSerialize(model));
}
- public void testComplex() throws Exception {
+ @Test public void testComplex() throws Exception {
String model = "( ( a + b ) ! - c + d + e + f - ( ^x + s ) - ( ( a + b ) ! - c ) ! ) !";
assertEquals(model, parseAndSerialize(model));
}
@@ -68,22 +69,22 @@ public class ComplexReconstrTest extends AbstractXtextTests {
return getSerializer().serialize(result, SaveOptions.defaultOptions());
}
- public void testNormalizableCompositeNodesIncluded() throws Exception {
+ @Test public void testNormalizableCompositeNodesIncluded() throws Exception {
reconstructAndCompare("a");
reconstructAndCompare("a + b");
}
- public void testTrickyGSimple() throws Exception {
+ @Test public void testTrickyGSimple() throws Exception {
String model = "TG [[2]]";
assertEquals(model, parseAndSerialize(model));
}
- public void testTrickyGWithNull() throws Exception {
+ @Test public void testTrickyGWithNull() throws Exception {
String model = "TG [0,[2,0],3,4,0]";
assertEquals(model, parseAndSerialize(model));
}
- public void testTrickyGComplex() throws Exception {
+ @Test 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.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenAndTokenNodeIteratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenAndTokenNodeIteratorTest.java
index 801f8d64a..5762d83b8 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenAndTokenNodeIteratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenAndTokenNodeIteratorTest.java
@@ -7,8 +7,6 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.reconstr;
-import junit.framework.TestCase;
-
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
@@ -19,18 +17,20 @@ import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
import org.eclipse.xtext.parsetree.reconstr.impl.DefaultHiddenTokenHelper;
import org.eclipse.xtext.parsetree.reconstr.impl.HiddenAndTokenNodeIterator;
import org.eclipse.xtext.parsetree.reconstr.impl.TokenUtil;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class HiddenAndTokenNodeIteratorTest extends TestCase {
+public class HiddenAndTokenNodeIteratorTest extends Assert {
private static final int NUM_NODES = 10;
private INode[] nodes;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
nodes = new INode[NUM_NODES];
NodeModelBuilder builder = new NodeModelBuilder();
nodes[0] = new CompositeNode();
@@ -79,7 +79,7 @@ public class HiddenAndTokenNodeIteratorTest extends TestCase {
}
- public void testIterator() throws Exception {
+ @Test public void testIterator() throws Exception {
HiddenAndTokenNodeIterator iterator = new HiddenAndTokenNodeIterator(nodes[0], getTokenUtil());
assertTrue(iterator.hasNext());
assertEquals(nodes[2], iterator.next());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenTokensMergerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenTokensMergerTest.java
index 6beef030f..3f50857bb 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenTokensMergerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/HiddenTokensMergerTest.java
@@ -1,7 +1,7 @@
package org.eclipse.xtext.parsetree.reconstr;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.Action1;
import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.AppendToFileEnd;
import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.Commentable;
@@ -10,11 +10,12 @@ import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.Hiddentokenmer
import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.RefList;
import org.eclipse.xtext.parsetree.reconstr.hiddentokenmergertest.ValueList;
import org.eclipse.xtext.resource.SaveOptions;
+import org.junit.Test;
public class HiddenTokensMergerTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(HiddenTokensMergerTestLanguageStandaloneSetup.class);
}
@@ -27,45 +28,45 @@ public class HiddenTokensMergerTest extends AbstractXtextTests {
assertEquals(model, r);
}
- public void testDatatypeBug286557a() throws Exception {
+ @Test public void testDatatypeBug286557a() throws Exception {
assertRoundtrip("#1 a;");
}
- public void testDatatypeBug286557b() throws Exception {
+ @Test public void testDatatypeBug286557b() throws Exception {
assertRoundtrip("#1 a ref a;");
}
- public void testDatatypeBug286557c() throws Exception {
+ @Test public void testDatatypeBug286557c() throws Exception {
assertRoundtrip("#1 a.b.c;");
}
- public void testDatatypeBug286557d() throws Exception {
+ @Test public void testDatatypeBug286557d() throws Exception {
assertRoundtrip("#1 a.b.c ref a.b.c;");
}
- public void testEnumBug() throws Exception {
+ @Test public void testEnumBug() throws Exception {
assertRoundtrip("#2 kw1 array test");
}
- public void testCommentable1() throws Exception {
+ @Test public void testCommentable1() throws Exception {
Commentable model = (Commentable) getModel("#3\n /*a*/ item a\n /*b*/ item b\n /*c*/item c");
model.getItem().move(1, 2);
assertEquals("#3\n /*a*/ item a /*c*/item c /*b*/ item b", serialize(model));
}
- public void testCommentable2() throws Exception {
+ @Test public void testCommentable2() throws Exception {
Commentable model = (Commentable) getModel("#3 /*a*/ item a /*b*/ item b /*c*/item c");
model.getItem().move(1, 2);
assertEquals("#3 /*a*/ item a /*c*/item c /*b*/ item b", serialize(model));
}
- public void testCommentable3() throws Exception {
+ @Test public void testCommentable3() throws Exception {
Commentable model = (Commentable) getModel("#3 item a//a\n item b//b\n item c//c\n");
model.getItem().move(1, 2);
assertEquals("#3 item a//a\n item c//c\n item b//b\n", serialize(model));
}
- public void testCommentable4() throws Exception {
+ @Test public void testCommentable4() throws Exception {
Commentable model = (Commentable) getModel("#3 /*a*/ item a /*b*/ item b /*c*/item c");
model.getItem().remove(1);
CommentableItem i = HiddentokenmergertestFactory.eINSTANCE.createCommentableItem();
@@ -74,32 +75,32 @@ public class HiddenTokensMergerTest extends AbstractXtextTests {
assertEquals("#3 /*a*/ item a /*c*/item c item foo", serialize(model));
}
- public void testValueList1() throws Exception {
+ @Test public void testValueList1() throws Exception {
ValueList model = (ValueList) getModel("#4 a. /* ab */ b c./*cd*/d e. /*ef*/f.g /*hi*/ .i");
model.getIds().move(1, 2);
assertEquals("#4 a. /* ab */ b e. /*ef*/f.g /*hi*/ .i c./*cd*/d", serialize(model));
}
- public void testRefList2() throws Exception {
+ @Test public void testRefList2() throws Exception {
RefList model = (RefList) getModel("#5 a. b c.d e.f.g.i refs a./* ab */ b c./*cd*/ d e. /*ef*/f.g/*hi*/.i");
model.getRefs().move(1, 2);
assertEquals("#5 a. b c.d e.f.g.i refs a./* ab */ b e. /*ef*/f.g/*hi*/.i c./*cd*/ d", serialize(model));
}
- // public void testRefList3() throws Exception {
+ // @Test public void testRefList3() throws Exception {
// RefList model = (RefList) getResourceFromStringAndExpect("#5 a.b refs x.y", 1).getContents().get(0);
// assertEquals("#5 a. b c.d e.f.g.i refs a./* ab */ b e. /*ef*/f.g/*hi*/.i c./*cd*/ d", serialize(model));
// }
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=297938
- public void testAppendToEnd() throws Exception {
+ @Test public void testAppendToEnd() throws Exception {
AppendToFileEnd model = (AppendToFileEnd) getModel("#7 class foo endclass");
model.getItems().add(HiddentokenmergertestFactory.eINSTANCE.createAppendToFileEndItem());
model.getItems().get(1).setName("bar");
assertEquals("#7 class foo endclass class bar endclass", serialize(model));
}
- public void testAction1() throws Exception {
+ @Test public void testAction1() throws Exception {
Action1 model = (Action1) getModel("#8 foo sub1 sub2");
assertEquals("#8 foo sub1 sub2", serialize(model));
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/NodeIteratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/NodeIteratorTest.java
index 0b813cac5..48c727136 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/NodeIteratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/NodeIteratorTest.java
@@ -7,8 +7,6 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.reconstr;
-import junit.framework.TestCase;
-
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.impl.AbstractNode;
@@ -16,18 +14,20 @@ import org.eclipse.xtext.nodemodel.impl.CompositeNode;
import org.eclipse.xtext.nodemodel.impl.LeafNode;
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder;
import org.eclipse.xtext.parsetree.reconstr.impl.NodeIterator;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class NodeIteratorTest extends TestCase {
+public class NodeIteratorTest extends Assert {
private static final int NUM_NODES = 11;
private INode[] nodes;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
NodeModelBuilder builder = new NodeModelBuilder();
nodes = new INode[NUM_NODES];
nodes[0] = new CompositeNode();
@@ -54,19 +54,19 @@ public class NodeIteratorTest extends TestCase {
builder.addChild((ICompositeNode)nodes[0], (AbstractNode)nodes[10]);
}
- public void testForward() throws Exception {
+ @Test public void testForward() throws Exception {
for (int i = 0; i < NUM_NODES; ++i) {
checkAscending(i);
}
}
- public void testBackward() throws Exception {
+ @Test public void testBackward() throws Exception {
for (int i = 0; i < NUM_NODES; ++i) {
checkDescending(i);
}
}
- public void testPruneComposite() throws Exception {
+ @Test public void testPruneComposite() throws Exception {
NodeIterator nodeIterator = new NodeIterator(nodes[3]);
nodeIterator.prune();
assertEquals(nodes[6], nodeIterator.next());
@@ -75,7 +75,7 @@ public class NodeIteratorTest extends TestCase {
assertEquals(nodes[2], nodeIterator.previous());
}
- public void testPruneLeaf() throws Exception {
+ @Test public void testPruneLeaf() throws Exception {
// pruning a leaf should not have any effect
NodeIterator nodeIterator = new NodeIterator(nodes[8]);
nodeIterator.prune();
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/PartialSerializationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/PartialSerializationTest.java
index 17590c6d8..6f2a44987 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/PartialSerializationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/PartialSerializationTest.java
@@ -8,9 +8,10 @@
package org.eclipse.xtext.parsetree.reconstr;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.partialserializationtest.NodeRoot;
import org.eclipse.xtext.resource.SaveOptions;
+import org.junit.Test;
/**
* @author Moritz Eysholdt
@@ -19,7 +20,7 @@ import org.eclipse.xtext.resource.SaveOptions;
public class PartialSerializationTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(PartialSerializationTestLanguageStandaloneSetup.class);
}
@@ -28,25 +29,25 @@ public class PartialSerializationTest extends AbstractXtextTests {
return getSerializer().serialize(obj, SaveOptions.defaultOptions());
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
String model = " #1 node test ( node subnode )";
NodeRoot root = (NodeRoot) getModel(model);
assertEquals("node test ( node subnode )", doSerialize(root.getNode()));
}
- public void testSimpleSurroundComments1() throws Exception {
+ @Test public void testSimpleSurroundComments1() throws Exception {
String model = "/* x1 */ #1 /* x2 */ node /* x3 */ test ( node subnode /* x4 */ ) /* x5 */";
NodeRoot root = (NodeRoot) getModel(model);
assertEquals(model, doSerialize(root));
}
- public void testSimpleSurroundComments2() throws Exception {
+ @Test public void testSimpleSurroundComments2() throws Exception {
String model = "/* x1 */ #1 /* x2 */ node /* x3 */ test ( node subnode /* x4 */ ) /* x5 */";
NodeRoot root = (NodeRoot) getModel(model);
assertEquals("/* x2 */ node /* x3 */ test ( node subnode /* x4 */ ) /* x5 */", doSerialize(root.getNode()));
}
- public void testSimpleSurroundComments3() throws Exception {
+ @Test public void testSimpleSurroundComments3() throws Exception {
String model = "/* x1 */ #1 /* x2 */ node /* x3 */ test /* x4 */ ( /* x5 */ node /* x6 */ subnode /* x7 */ ) /* x8 */";
NodeRoot root = (NodeRoot) getModel(model);
String ser = doSerialize(root.getNode().getChildren().get(0));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationBug269362Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationBug269362Test.java
index 61dafd081..374d737f3 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationBug269362Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationBug269362Test.java
@@ -7,11 +7,12 @@
*******************************************************************************/
package org.eclipse.xtext.parsetree.reconstr;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.serializationBug269362TestLanguage.Model;
import org.eclipse.xtext.parsetree.reconstr.serializationBug269362TestLanguage.SerializationBug269362TestLanguageFactory;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
@@ -23,7 +24,7 @@ public class SerializationBug269362Test extends AbstractXtextTests {
private Model model;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SerializationBug269362TestLanguageStandaloneSetup.class);
resourceSet = get(XtextResourceSet.class);
@@ -34,7 +35,7 @@ public class SerializationBug269362Test extends AbstractXtextTests {
resource.getContents().add(model);
}
- public void testSerialize_01() throws Exception {
+ @Test public void testSerialize_01() throws Exception {
model.setBar("bar");
model.setFoo("foo");
String result = serialize(model);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationErrorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationErrorTest.java
index 190fc1db5..bbd9975d2 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationErrorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SerializationErrorTest.java
@@ -11,7 +11,7 @@ package org.eclipse.xtext.parsetree.reconstr;
import java.io.IOException;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.IParseTreeConstructor.TreeConstructionReport;
import org.eclipse.xtext.parsetree.reconstr.impl.TokenStringBuffer;
import org.eclipse.xtext.parsetree.reconstr.serializationerror.Indent;
@@ -20,6 +20,7 @@ import org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoOptions;
import org.eclipse.xtext.parsetree.reconstr.serializationerror.TwoRequired;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.resource.XtextResource;
+import org.junit.Test;
public class SerializationErrorTest extends AbstractXtextTests {
@@ -30,7 +31,7 @@ public class SerializationErrorTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SerializationErrorTestLanguageStandaloneSetup.class);
}
@@ -51,7 +52,7 @@ public class SerializationErrorTest extends AbstractXtextTests {
return r;
}
- public void testMissingElement() throws Exception {
+ @Test public void testMissingElement() throws Exception {
Model m = (Model) getModel("tworequired a b");
// System.out.println(EmfFormatter.objToStr(m));
((TwoRequired) m.getTest()).setOne(null);
@@ -63,7 +64,7 @@ public class SerializationErrorTest extends AbstractXtextTests {
assertTrue(r.toString(), r.toString().contains("TwoRequired.one is not set"));
}
- public void testValueConverterError() throws Exception {
+ @Test public void testValueConverterError() throws Exception {
Model m = (Model) getModel("tworequired a b");
((TwoRequired) m.getTest()).setOne("|nv4l|d");
TreeConstructionReport r = ser(m);
@@ -71,7 +72,7 @@ public class SerializationErrorTest extends AbstractXtextTests {
assertTrue(r.toString(), r.toString().contains("invalid characters"));
}
- public void testElementTooMuch() throws Exception {
+ @Test public void testElementTooMuch() throws Exception {
Model m = (Model) getModel("twooptions one a");
// System.out.println(EmfFormatter.objToStr(m));
((TwoOptions) m.getTest()).setTwo("b");
@@ -90,7 +91,7 @@ public class SerializationErrorTest extends AbstractXtextTests {
}
- public void testDeep() throws Exception {
+ @Test public void testDeep() throws Exception {
Model m = (Model) getModel("{ twooptions one a { twooptions one a { twooptions one a }}}");
// System.out.println(EmfFormatter.objToStr(m));
Indent i = ((Indent) m.getTest()).getIndent().get(0).getIndent().get(0);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
index 004c9631c..dc69aba6d 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/SimpleReconstrTest.java
@@ -9,11 +9,12 @@
package org.eclipse.xtext.parsetree.reconstr;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.simplerewritetest.EmptyObjectBug284850;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.testlanguages.SimpleExpressionsTestLanguageStandaloneSetup;
+import org.junit.Test;
public class SimpleReconstrTest extends AbstractXtextTests {
@@ -23,27 +24,27 @@ public class SimpleReconstrTest extends AbstractXtextTests {
return false;
}
- public void testSimple1() throws Exception {
+ @Test public void testSimple1() throws Exception {
String model = "a b";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimple2() throws Exception {
+ @Test public void testSimple2() throws Exception {
String model = "( a b ) !";
assertEquals(model, parseAndSerialize(model));
}
- public void testFollowingHiddenTokens() throws Exception {
+ @Test public void testFollowingHiddenTokens() throws Exception {
String model = "a ";
assertEquals(model, parseAndSerialize(model));
}
- public void testComplex() throws Exception {
+ @Test public void testComplex() throws Exception {
String model = "( ( a b ) ! c d e f ( x s ) ( \t ( a \n\rb/*ffo \n bar */ ) ! c ) ! ) //holla\n!";
assertEquals(model, parseAndSerialize(model));
}
- public void testComplex1() throws Exception {
+ @Test public void testComplex1() throws Exception {
String model = "(a b) //holla\n!";
assertEquals(model, parseAndSerialize(model));
}
@@ -58,60 +59,60 @@ public class SimpleReconstrTest extends AbstractXtextTests {
return getSerializer().serialize(result, SaveOptions.defaultOptions());
}
- public void testSimpleExpressions5() throws Exception {
+ @Test public void testSimpleExpressions5() throws Exception {
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
String model = "a + b - c * d / e";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleExpressions1() throws Exception {
+ @Test public void testSimpleExpressions1() throws Exception {
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
String model = "a + b - c";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleExpressions3() throws Exception {
+ @Test public void testSimpleExpressions3() throws Exception {
with(SimpleExpressionsTestLanguageStandaloneSetup.class);
String model = "a + (b - c)";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTwoNumbers() throws Exception {
+ @Test public void testSimpleTwoNumbers() throws Exception {
String model = "2 45";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTwoNumbersWithDefault() throws Exception {
+ @Test public void testSimpleTwoNumbersWithDefault() throws Exception {
String model = "0 45";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTwoNumbersWithDefault2() throws Exception {
+ @Test public void testSimpleTwoNumbersWithDefault2() throws Exception {
String model = "0 45 # 0 # 1 # 2";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleManyStrings1() throws Exception {
+ @Test public void testSimpleManyStrings1() throws Exception {
String model = "= \"xxx\" \"yyy\"";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleManyStrings2() throws Exception {
+ @Test public void testSimpleManyStrings2() throws Exception {
String model = "= \"xxx\" \"yyy\" \"zzzz\"";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleAlternativeAssignment1() throws Exception {
+ @Test public void testSimpleAlternativeAssignment1() throws Exception {
String model = "#2 mykeyword1";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleAlternativeBoolTrue() throws Exception {
+ @Test public void testSimpleAlternativeBoolTrue() throws Exception {
String model = "#4 myoption kw blupp";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleAlternativeBoolFalse() throws Exception {
+ @Test public void testSimpleAlternativeBoolFalse() throws Exception {
String model = "#4 kw blupp";
assertEquals(model, parseAndSerialize(model));
}
@@ -137,119 +138,119 @@ public class SimpleReconstrTest extends AbstractXtextTests {
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient104() throws Exception {
+ @Test public void testSimpleTransient104() throws Exception {
String model = "#5 *, 0";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient105() throws Exception {
+ @Test public void testSimpleTransient105() throws Exception {
String model = "#5 *, 1";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient106() throws Exception {
+ @Test public void testSimpleTransient106() throws Exception {
String model = "#5 *, *";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient107() throws Exception {
+ @Test public void testSimpleTransient107() throws Exception {
String model = "#5 0, 0";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient108() throws Exception {
+ @Test public void testSimpleTransient108() throws Exception {
String model = "#5 0, 1";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient109() throws Exception {
+ @Test public void testSimpleTransient109() throws Exception {
String model = "#5 0, *";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient110() throws Exception {
+ @Test public void testSimpleTransient110() throws Exception {
String model = "#5 1, 0";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient111() throws Exception {
+ @Test public void testSimpleTransient111() throws Exception {
String model = "#5 1, 1";
assertEquals(model, parseAndSerialize(model));
}
- public void testSimpleTransient112() throws Exception {
+ @Test public void testSimpleTransient112() throws Exception {
String model = "#5 1, *";
assertEquals(model, parseAndSerialize(model));
}
// FIXME: this depends on
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=250313
- public void testSimpleAlternativeAssignment2() throws Exception {
+ @Test public void testSimpleAlternativeAssignment2() throws Exception {
String model = "#2 \"str\"";
assertEquals(model, parseAndSerialize(model));
}
- public void testCrossRef() throws Exception {
+ @Test public void testCrossRef() throws Exception {
String model = "type A extends B type B extends A";
assertEquals(model, parseAndSerialize(model));
}
- public void testSpare() throws Exception {
+ @Test public void testSpare() throws Exception {
String model = "#3 foo1";
assertEquals(model, parseAndSerialize(model));
}
- public void testConsume11() throws Exception {
+ @Test public void testConsume11() throws Exception {
String model = "#6 v1 1 2 a";
assertEquals(model, parseAndSerialize(model));
}
- public void testConsume12() throws Exception {
+ @Test public void testConsume12() throws Exception {
String model = "#6 v2 a b 2";
assertEquals(model, parseAndSerialize(model));
}
- public void testConsume21() throws Exception {
+ @Test public void testConsume21() throws Exception {
String model = "#7 #6 v1 1 2 a";
assertEquals(model, parseAndSerialize(model));
}
- public void testConsume22() throws Exception {
+ @Test public void testConsume22() throws Exception {
String model = "#7 #6 v2 a b 2";
assertEquals(model, parseAndSerialize(model));
}
- public void testLoop1() throws Exception {
+ @Test public void testLoop1() throws Exception {
String model = "kw0 #8 abc kw1 ab kw30";
assertEquals("#8 abc ab kw30", parseAndSerialize(model));
}
- public void testLoop2() throws Exception {
+ @Test public void testLoop2() throws Exception {
String model = "#9 abc adad kw2 kw3 kw6";
assertEquals("#9 abc kw1 adad kw4 kw5", parseAndSerialize(model));
}
- public void testLoop3() throws Exception {
+ @Test public void testLoop3() throws Exception {
String model = "kw3 #10 adad kw4 abcde kw5 kw4 abc kw5";
assertEquals("kw1 #10 adad kw4 abcde kw5 kw4 abc kw5", parseAndSerialize(model));
}
- public void testLoop4() throws Exception {
+ @Test public void testLoop4() throws Exception {
String model = "#11 kw2 asd kw5 kw6";
assertEquals("#11 kw1 asd kw5", parseAndSerialize(model));
}
- public void testLoopBug285452a() throws Exception {
+ @Test public void testLoopBug285452a() throws Exception {
String model = "#12 interface test";
assertEquals(model, parseAndSerialize(model));
}
- public void testLoopBug285452b() throws Exception {
+ @Test public void testLoopBug285452b() throws Exception {
String model = "#12 class test";
assertEquals(model, parseAndSerialize(model));
}
- public void testDuplicateBug284491() throws Exception {
+ @Test public void testDuplicateBug284491() throws Exception {
String model = "#13 final static";
assertEquals(model, parseAndSerialize(model));
}
@@ -263,39 +264,39 @@ public class SimpleReconstrTest extends AbstractXtextTests {
assertEquals(model, actual);
}
- public void testMultiInheritanceBug280439() throws Exception {
+ @Test public void testMultiInheritanceBug280439() throws Exception {
String model = "#15 a b";
EObject result = getModel(model);
assertEquals(model, getSerializer().serialize(result, SaveOptions.defaultOptions()));
}
- public void testEObjectRef() throws Exception {
+ @Test public void testEObjectRef() throws Exception {
String model = "#16 obj refs obj";
EObject result = getModel(model);
assertEquals(model, getSerializer().serialize(result, SaveOptions.defaultOptions()));
}
- public void testTypeBug305577a() throws Exception {
+ @Test public void testTypeBug305577a() throws Exception {
String model = "#17 ka foo";
assertEquals(model, parseAndSerialize(model));
}
- public void testTypeBug305577b() throws Exception {
+ @Test public void testTypeBug305577b() throws Exception {
String model = "#17 kb foo";
assertEquals(model, parseAndSerialize(model));
}
- public void testTypeBug305577c() throws Exception {
+ @Test public void testTypeBug305577c() throws Exception {
String model = "#18 ka foo";
assertEquals(model, parseAndSerialize(model));
}
- public void testTypeBug305577d() throws Exception {
+ @Test public void testTypeBug305577d() throws Exception {
String model = "#17 kb foo";
assertEquals(model, parseAndSerialize(model));
}
- public void testBug305171() throws Exception {
+ @Test public void testBug305171() throws Exception {
String model = "#19 kx a,b ky c,d foo";
assertEquals(model, parseAndSerialize(model));
@@ -318,24 +319,24 @@ public class SimpleReconstrTest extends AbstractXtextTests {
assertEquals(model, parseAndSerialize(model));
}
- public void testEnumBug310435Enum() throws Exception {
+ @Test public void testEnumBug310435Enum() throws Exception {
String model = "#20 kw1 lit1 kw2 lit2 kw1 lit1 kw2 lit2 kw1 lit1 kw2 lit2";
assertEquals(model, parseAndSerialize(model));
}
- public void testEnumBug310435Val() throws Exception {
+ @Test public void testEnumBug310435Val() throws Exception {
String model = "#21 kw2 '234' kw1 foo kw2 '[]' kw1 bar";
assertEquals(model, parseAndSerialize(model));
}
- public void testRefnameTest() throws Exception {
+ @Test public void testRefnameTest() throws Exception {
String model = "#22 id1 id2 ID3 ID4 kw1 kw2 id1 kw3 ID3 kw2 id2 kw3 ID4";
assertEquals(model, parseAndSerialize(model));
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SimpleReconstrTestLanguageStandaloneSetup.class);
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/TreeConstTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/TreeConstTest.java
index d56124200..0faa128eb 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/TreeConstTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/TreeConstTest.java
@@ -17,8 +17,9 @@ import org.eclipse.xtext.Group;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.TypeRef;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parsetree.reconstr.impl.TreeConstructionNFAProvider;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Sets;
@@ -31,7 +32,7 @@ public class TreeConstTest extends AbstractXtextTests {
private TreeConstructionNFAProvider nfa = new TreeConstructionNFAProvider();
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -67,44 +68,44 @@ public class TreeConstTest extends AbstractXtextTests {
fail("Types '" + refs + "' are not expected. Actual:" + actual2 + " Expected: " + Joiner.on(", ").join(expected));
}
- public void testSingleAssignment() throws Exception {
+ @Test public void testSingleAssignment() throws Exception {
AbstractRule rule = parseRule("Model: name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Model");
}
- public void testSingleAssignmentOrNull() throws Exception {
+ @Test public void testSingleAssignmentOrNull() throws Exception {
AbstractRule rule = parseRule("Model: 'foo' name=ID?;");
Group group = (Group) rule.getAlternatives();
assertTypes(nfa.getNFA(group).getTypes(), "Model", "null");
assertTypes(nfa.getNFA(group.getElements().get(0)).getTypesToCheck());
}
- public void testSingleAction1() throws Exception {
+ @Test public void testSingleAction1() throws Exception {
AbstractRule rule = parseRule("Model: 'someKeyword' {Model};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Model");
}
- public void testSingleAction2() throws Exception {
+ @Test public void testSingleAction2() throws Exception {
AbstractRule rule = parseRule("Model: 'someKeyword' {TypeRestriction};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "TypeRestriction");
}
- public void testMultiAction1() throws Exception {
+ @Test public void testMultiAction1() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2");
}
- public void testMultiAction2() throws Exception {
+ @Test public void testMultiAction2() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2} | 'c';");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2", "null");
}
- public void testMultiAction3() throws Exception {
+ @Test public void testMultiAction3() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2} | 'c' name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2", "Model");
}
- public void testMultiAction4() throws Exception {
+ @Test public void testMultiAction4() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1} | 'b' {Type2} | 'c' | name=ID;");
Alternatives alt = (Alternatives) rule.getAlternatives();
assertTypes(nfa.getNFA(alt).getTypes(), "Type1", "Type2", "Model", "null");
@@ -114,52 +115,52 @@ public class TreeConstTest extends AbstractXtextTests {
assertTypes(nfa.getNFA(alt.getElements().get(3)).getTypesToCheck(), "Model");
}
- public void testAssignedAction1() throws Exception {
+ @Test public void testAssignedAction1() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1.sub=current};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1");
}
- public void testAssignedAction2() throws Exception {
+ @Test public void testAssignedAction2() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1.sub=current} 'b' {Type2.sub=current};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type2");
}
- public void testAssignedAction3() throws Exception {
+ @Test public void testAssignedAction3() throws Exception {
AbstractRule rule = parseRule("Model: 'a' {Type1.sub=current} | 'b' {Type2.sub=current};");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Type1", "Type2");
}
- public void testAssignedRuleCall() throws Exception {
+ @Test public void testAssignedRuleCall() throws Exception {
AbstractRule rule = parseRule("Model: 'something' foo=Bar; Bar: name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Model");
}
- public void testRuleCall1() throws Exception {
+ @Test public void testRuleCall1() throws Exception {
AbstractRule rule = parseRule("Model: Foo; Foo: name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo");
}
- public void testRuleCall2() throws Exception {
+ @Test public void testRuleCall2() throws Exception {
AbstractRule rule = parseRule("Model: Foo | 'bar'; Foo: name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "null");
}
- public void testRuleCall3() throws Exception {
+ @Test public void testRuleCall3() throws Exception {
AbstractRule rule = parseRule("Model: Foo | 'bar' name=ID | 'null'; Foo: name=ID;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Model", "null");
}
- public void testRuleCall4() throws Exception {
+ @Test public void testRuleCall4() throws Exception {
AbstractRule rule = parseRule("Model: Foo | Bar; Foo: name=ID; Bar: val=INT;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Bar");
}
- public void testRuleCall5() throws Exception {
+ @Test public void testRuleCall5() throws Exception {
AbstractRule rule = parseRule("Model: (Foo | Bar) v2=ID v1=ID; Foo: name=ID; Bar: val=INT;");
assertTypes(nfa.getNFA(rule.getAlternatives()).getTypes(), "Foo", "Bar");
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
StringBuilder s = new StringBuilder();
s.append("Expression: Add; ");
s.append("Add returns Expression: Mult ({Add.left=current} '+' right=Mult)?; ");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
index 45bcf0c32..ff5351ce5 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/WhitespacePreservingCallbackTest.java
@@ -1,35 +1,36 @@
package org.eclipse.xtext.parsetree.reconstr;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.SaveOptions;
+import org.junit.Test;
public class WhitespacePreservingCallbackTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ComplexReconstrTestLanguageStandaloneSetup.class);
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
check("a");
}
- public void testHiddenInBetween() throws Exception {
+ @Test public void testHiddenInBetween() throws Exception {
check("a \t /* foo bar */ + b");
}
// FIXME: Make this test work again
-// public void testFail1() throws Exception {
+// @Test 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 {
+// @Test public void testFail2() throws Exception {
// IAstFactory f = getASTFactory();
// EObject add = f.create("Add");
//
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java
index 173256acc..d1e59b0f5 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/reconstr/XtextGrammarReconcilationTest.java
@@ -8,20 +8,21 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.SaveOptions;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
public class XtextGrammarReconcilationTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
XtextStandaloneSetup.doSetup();
with(XtextStandaloneSetup.class);
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
// this fails see bug #252181
String model = "grammar foo with org.eclipse.xtext.common.Terminals Honolulu : name=ID;";
@@ -45,7 +46,7 @@ public class XtextGrammarReconcilationTest extends AbstractXtextTests {
assertEquals(expectedModel, result);
}
- public void testSelf() {
+ @Test public void testSelf() {
Grammar g = getGrammarAccess().getGrammar();
for (AbstractRule r : g.getRules()) {
// AbstractRule r = GrammarUtil.findRuleForName(g, "GrammarID");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
index 25b58d4db..bc34c25a7 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/transientvalues/TransientValuesTest.java
@@ -1,8 +1,9 @@
package org.eclipse.xtext.parsetree.transientvalues;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.XtextResource;
+import org.junit.Test;
/**
* @author Moritz Eysholdt - Initial contribution and API
@@ -10,7 +11,7 @@ import org.eclipse.xtext.resource.XtextResource;
public class TransientValuesTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(TransientValuesTestStandaloneSetup.class);
}
@@ -20,7 +21,7 @@ public class TransientValuesTest extends AbstractXtextTests {
return false;
}
- public void testRequired1() throws Exception {
+ @Test public void testRequired1() throws Exception {
final String model = "test required 1 1";
EObject m = getModel(model);
// System.out.println(EmfFormater.objToStr(m, ""));
@@ -28,21 +29,21 @@ public class TransientValuesTest extends AbstractXtextTests {
assertEquals(model, s);
}
- public void testOptional1() throws Exception {
+ @Test public void testOptional1() throws Exception {
final String in = "test optional 12";
final String out = "test optional";
String s = serialize(getModel(in));
assertEquals(out, s);
}
- public void testOptional2() throws Exception {
+ @Test public void testOptional2() throws Exception {
final String in = "test optional 12:13";
final String out = "test optional";
String s = serialize(getModel(in));
assertEquals(out, s);
}
- public void testList() throws Exception {
+ @Test public void testList() throws Exception {
final String in = "test list 1 2 3 4 5 6";
final String out = "test list 1 3 5";
String s = serialize(getModel(in)).trim();
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/unassignedtext/UnassignedTextTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/unassignedtext/UnassignedTextTest.java
index 704bc94cd..74818617b 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/unassignedtext/UnassignedTextTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/parsetree/unassignedtext/UnassignedTextTest.java
@@ -1,7 +1,8 @@
package org.eclipse.xtext.parsetree.unassignedtext;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.XtextResource;
+import org.junit.Test;
/**
* @author Moritz Eysholdt - Initial contribution and API
@@ -9,7 +10,7 @@ import org.eclipse.xtext.resource.XtextResource;
public class UnassignedTextTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(UnassignedTextTestLanguageStandaloneSetup.class);
}
@@ -19,56 +20,56 @@ public class UnassignedTextTest extends AbstractXtextTests {
return false;
}
- public void testCaseInsensitiveKeyword() throws Exception {
+ @Test public void testCaseInsensitiveKeyword() throws Exception {
final String in = "kEyWoRd 7";
final String out = "KeyWord 7";
String s = serialize(getModel(in));
assertEquals(out, s);
}
- public void testPlural1() throws Exception {
+ @Test public void testPlural1() throws Exception {
final String in = "contents: 0 items";
final String out = "contents: 0 items";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testPlural2() throws Exception {
+ @Test public void testPlural2() throws Exception {
final String in = "contents: 0 item";
final String out = "contents: 0 items";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testPlural3() throws Exception {
+ @Test public void testPlural3() throws Exception {
final String in = "contents: 1 items";
final String out = "contents: 1 item";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testPlural4() throws Exception {
+ @Test public void testPlural4() throws Exception {
final String in = "contents: 1 item";
final String out = "contents: 1 item";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testMulti() throws Exception {
+ @Test public void testMulti() throws Exception {
final String in = "multi 1 accegj01 acddegj01 accehj11";
final String out = "multi 1 accegj01 accegj02 accegj03";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testDataType() throws Exception {
+ @Test public void testDataType() throws Exception {
final String in = "datatype 3 'mystr'";
final String out = "datatype 3 str";
String s = serialize(getModel(in)).trim();
assertEquals(out, s);
}
- public void testCommonTerminals() throws Exception {
+ @Test public void testCommonTerminals() throws Exception {
final String in = "terminals xyz 789 'yo' X";
final String out = "terminals abc 123 'abc' X";
String s = serialize(getModel(in)).trim();
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/CommentOnEofBug_234135_Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/CommentOnEofBug_234135_Test.java
index 61c26c45e..314dc5405 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/CommentOnEofBug_234135_Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/CommentOnEofBug_234135_Test.java
@@ -12,9 +12,10 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.TerminalRule;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
+import org.junit.Test;
import com.google.common.collect.Lists;
@@ -24,7 +25,7 @@ import com.google.common.collect.Lists;
*/
public class CommentOnEofBug_234135_Test extends AbstractXtextTests {
- public void testCommentOnEof() throws Exception {
+ @Test public void testCommentOnEof() throws Exception {
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
String model = "//comment";
List leafNodes = Lists.newArrayList(getRootNode(model).getLeafNodes());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/LeafNodeBug_234132_Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/LeafNodeBug_234132_Test.java
index 22197c748..41b15f939 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/LeafNodeBug_234132_Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/reference/LeafNodeBug_234132_Test.java
@@ -8,17 +8,18 @@
*******************************************************************************/
package org.eclipse.xtext.reference;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
+import org.junit.Test;
/**
* @author Jan Köhnlein - Initial contribution and API
*/
public class LeafNodeBug_234132_Test extends AbstractXtextTests {
- public void testLeafNodeBug() throws Exception {
+ @Test public void testLeafNodeBug() throws Exception {
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
String model = readFileIntoString("org/eclipse/xtext/reference/leafNodeBug_234132.tst");
ICompositeNode rootNode = getRootNodeAndExpect(model, 1);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/Bug306325Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/Bug306325Test.java
index dbfd7af3a..5d34ad7e2 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/Bug306325Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/Bug306325Test.java
@@ -16,11 +16,12 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.Factory;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.parser.encoding.EncodingTestLanguageStandaloneSetup;
import org.eclipse.xtext.parser.encoding.encodingTest.Model;
import org.eclipse.xtext.parser.encoding.encodingTest.Word;
import org.eclipse.xtext.util.ITextRegion;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
@@ -28,12 +29,12 @@ import org.eclipse.xtext.util.ITextRegion;
public class Bug306325Test extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(EncodingTestLanguageStandaloneSetup.class);
}
- public void testLocationInUtf8EncodedFile() throws Exception {
+ @Test public void testLocationInUtf8EncodedFile() throws Exception {
performTestWithEncoding("UTF-8");
performTestWithEncoding("UTF-16");
performTestWithEncoding("ISO-8859-1");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ClassloaderClasspathUriResolverTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ClassloaderClasspathUriResolverTest.java
index 4bc76ec13..8a1c51a9e 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ClassloaderClasspathUriResolverTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ClassloaderClasspathUriResolverTest.java
@@ -12,27 +12,29 @@ package org.eclipse.xtext.resource;
import java.net.URL;
import java.net.URLClassLoader;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.junit.Before;
+import org.junit.Test;
-public class ClassloaderClasspathUriResolverTest extends TestCase {
+public class ClassloaderClasspathUriResolverTest extends AbstractXtextTests {
private ClassloaderClasspathUriResolver _resolver;
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
_resolver = new ClassloaderClasspathUriResolver();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
"ecore", new XMIResourceFactoryImpl());
}
- public void testClasspathUriForFile() {
+ @Test public void testClasspathUriForFile() {
URI classpathUri = URI
.createURI("classpath:/org/eclipse/xtext/resource/mydsl.ecore");
URL rootURL = getClass().getClassLoader().getResource(
@@ -41,7 +43,7 @@ public class ClassloaderClasspathUriResolverTest extends TestCase {
normalizeUriAndLoadResource(classpathUri, expectedUri);
}
- public void testClasspathUriForFileWithFragment() {
+ @Test public void testClasspathUriForFileWithFragment() {
URI classpathUri = URI
.createURI("classpath:/org/eclipse/xtext/resource/mydsl.ecore#/");
URL rootURL = getClass().getClassLoader().getResource(
@@ -50,7 +52,7 @@ public class ClassloaderClasspathUriResolverTest extends TestCase {
normalizeUriAndLoadResource(classpathUri, expectedUri);
}
- public void testClasspathUriForFileInJar() {
+ @Test public void testClasspathUriForFileInJar() {
URI classpathUri = URI.createURI("classpath:/model/simple.ecore");
URL rootURL = getClass().getClassLoader().getResource(
"model/simple.ecore");
@@ -58,7 +60,7 @@ public class ClassloaderClasspathUriResolverTest extends TestCase {
normalizeUriAndLoadResource(classpathUri, expectedUri);
}
- public void testClasspathUriForFileInJarWithFragment() {
+ @Test public void testClasspathUriForFileInJarWithFragment() {
URI classpathUri = URI.createURI("classpath:/model/simple.ecore#/");
URL rootURL = getClass().getClassLoader().getResource(
"model/simple.ecore");
@@ -76,7 +78,7 @@ public class ClassloaderClasspathUriResolverTest extends TestCase {
assertTrue("Resource not loaded", resource.isLoaded());
}
- public void testBug293760() throws Exception {
+ @Test public void testBug293760() throws Exception {
ClassloaderClasspathUriResolver resolver = new ClassloaderClasspathUriResolver();
URL resource = getClass().getResource("mydsl.ecore");
URL url = new URL(resource.toString().replace("mydsl.ecore", "some folder/"));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ConcurrentAccessTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ConcurrentAccessTest.java
index 2a63625a0..615b92016 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ConcurrentAccessTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ConcurrentAccessTest.java
@@ -11,8 +11,6 @@ import java.io.File;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
@@ -27,13 +25,17 @@ import org.eclipse.emf.mwe.utils.StandaloneSetup;
import org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces;
import org.eclipse.xtext.util.concurrent.IReadAccess;
import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.Lists;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class ConcurrentAccessTest extends TestCase {
+public class ConcurrentAccessTest extends Assert {
private Resource resource;
@@ -41,9 +43,8 @@ public class ConcurrentAccessTest extends TestCase {
new StandaloneSetup();
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
ResourceSet resourceSet = new ResourceSetImpl();
resource = new XtextResource(URI.createFileURI("something.ecore"));
resourceSet.getResources().add(resource);
@@ -75,19 +76,18 @@ public class ConcurrentAccessTest extends TestCase {
}
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
resource = null;
- super.tearDown();
}
- public void testDummy() {
+ @Test public void testDummy() {
assertEquals(1, resource.getResourceSet().getResources().size());
EcoreUtil.resolveAll(resource);
assertEquals(101, resource.getResourceSet().getResources().size());
}
- public void testResolveSingleThreaded() {
+ @Test public void testResolveSingleThreaded() {
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResources().add(resource);
assertEquals(1, resourceSet.getResources().size());
@@ -105,7 +105,7 @@ public class ConcurrentAccessTest extends TestCase {
assertEquals(101, resourceSet.getResources().size());
}
- public void testMultiThreaded() throws InterruptedException {
+ @Test public void testMultiThreaded() throws InterruptedException {
ResourceSet resourceSet = new XtextResourceSet();
resourceSet.getResources().add(resource);
boolean wasOk = resolveAllSupertypesMultithreaded((EPackage) resource.getContents().get(0));
@@ -114,7 +114,7 @@ public class ConcurrentAccessTest extends TestCase {
assertFalse("unresolvedProxy", wasOk);
}
- public void testMultiThreadedSynchronized() throws InterruptedException {
+ @Test public void testMultiThreadedSynchronized() throws InterruptedException {
ResourceSet resourceSet = new SynchronizedXtextResourceSet();
resourceSet.getResources().add(resource);
boolean wasOk = resolveAllSupertypesMultithreaded((EPackage) resource.getContents().get(0));
@@ -122,7 +122,7 @@ public class ConcurrentAccessTest extends TestCase {
assertTrue("unresolvedProxy", wasOk);
}
- public void testMultiThreadedUnitOfWork() throws InterruptedException {
+ @Test public void testMultiThreadedUnitOfWork() throws InterruptedException {
ResourceSet resourceSet = new XtextResourceSet();
resourceSet.getResources().add(resource);
boolean wasOk = resolveAllSupertypesStateAccess((EPackage) resource.getContents().get(0));
@@ -131,7 +131,7 @@ public class ConcurrentAccessTest extends TestCase {
assertFalse("unresolvedProxy", wasOk);
}
- public void testMultiThreadedSynchronizedUnitOfWork() throws InterruptedException {
+ @Test public void testMultiThreadedSynchronizedUnitOfWork() throws InterruptedException {
ResourceSet resourceSet = new SynchronizedXtextResourceSet();
resourceSet.getResources().add(resource);
boolean wasOk = resolveAllSupertypesStateAccess((EPackage) resource.getContents().get(0));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/DerivedStateAwareResourceTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/DerivedStateAwareResourceTest.java
index 873d76abc..7a9306e2b 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/DerivedStateAwareResourceTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/DerivedStateAwareResourceTest.java
@@ -10,7 +10,8 @@ package org.eclipse.xtext.resource;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
@@ -26,7 +27,7 @@ public class DerivedStateAwareResourceTest extends AbstractXtextTests {
}
}
- public void testInitialization() throws Exception {
+ @Test public void testInitialization() throws Exception {
TestedResource resource = new TestedResource();
assertTrue(resource.getContents().isEmpty());
resource.setDerivedStateComputer(new IDerivedStateComputer() {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/EObjectAtOffsetTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/EObjectAtOffsetTest.java
index 4a7349ff4..c64e4b44d 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/EObjectAtOffsetTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/EObjectAtOffsetTest.java
@@ -8,12 +8,13 @@
package org.eclipse.xtext.resource;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.resource.eObjectAtOffsetTestLanguage.Foo;
import org.eclipse.xtext.resource.eObjectAtOffsetTestLanguage.FooBar;
import org.eclipse.xtext.resource.eObjectAtOffsetTestLanguage.Model;
import org.eclipse.xtext.util.TextRegion;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
@@ -29,19 +30,19 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
private EObjectAtOffsetHelper eObjectAtOffsetHelper;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(EObjectAtOffsetTestLanguageStandaloneSetup.class);
eObjectAtOffsetHelper = new EObjectAtOffsetHelper();
}
- public void testBug349626() throws Exception {
+ @Test public void testBug349626() throws Exception {
String modelAsString = "foo foo0";
XtextResource resource = getResourceFromString(modelAsString);
assertNull(eObjectAtOffsetHelper.resolveCrossReferencedElementAt(resource, modelAsString.length()));
}
- public void testElements() throws Exception {
+ @Test public void testElements() throws Exception {
String modelAsString = "foo foo0 bar bar0 foo0 bar bar1 foo0";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -50,7 +51,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkContainedElementAt(resource, modelAsString, "bar bar1 ", model.getBars().get(1));
}
- public void testCrossRefs_01() throws Exception {
+ @Test public void testCrossRefs_01() throws Exception {
String modelAsString = "bar bar0 foo0 bar bar1 foo1,foo2 foo foo0 foo foo1 foo foo2";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -59,7 +60,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo2 ", model.getFoos().get(2));
}
- public void testCrossRefs_02() throws Exception {
+ @Test public void testCrossRefs_02() throws Exception {
String modelAsString = "zonk bar bar0 foo0 bar bar1 foo1,foo2 foo foo0 foo foo1 foo foo2";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -68,7 +69,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo2 ", model.getFoos().get(2));
}
- public void testCrossRefsAfterUnassignedRuleCall_01() throws Exception {
+ @Test public void testCrossRefsAfterUnassignedRuleCall_01() throws Exception {
String modelAsString = "bar bar0 foo0 foo1 foo foo0 foo foo1";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -76,7 +77,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo1", model.getFoos().get(1));
}
- public void testCrossRefsAfterUnassignedRuleCall_02() throws Exception {
+ @Test public void testCrossRefsAfterUnassignedRuleCall_02() throws Exception {
String modelAsString = "zonk 1 bar bar0 foo0 foo1 foo foo0 foo foo1";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -84,7 +85,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo1", model.getFoos().get(1));
}
- public void testCrossRefsAfterAction_01() throws Exception {
+ @Test public void testCrossRefsAfterAction_01() throws Exception {
String modelAsString = "bar bar0 foo0 foobar foo1 foo2 foo foo0 foo foo1 foo foo2";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -93,7 +94,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo2", model.getFoos().get(2));
}
- public void testCrossRefsAfterAction_02() throws Exception {
+ @Test public void testCrossRefsAfterAction_02() throws Exception {
String modelAsString = "zonk 1 bar bar0 foo0 foobar foo1 foo2 foo foo0 foo foo1 foo foo2";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -102,7 +103,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkCrossReferencedElementAt(resource, modelAsString, "foo2", model.getFoos().get(2));
}
- public void testAction() throws Exception {
+ @Test public void testAction() throws Exception {
String modelAsString = "bar bar0 foo0 foobar foo1 foo foo0 foo foo1";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -112,7 +113,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkContainedElementAt(resource, modelAsString, "bar bar0 ", ((FooBar) model.getBars().get(0)).getBar());
}
- public void testAction_02() throws Exception {
+ @Test public void testAction_02() throws Exception {
String modelAsString = "zonk 1 bar bar0 foo0 foobar foo1 foo foo0 foo foo1";
XtextResource resource = getResourceFromString(modelAsString);
Model model = (Model) resource.getContents().get(0);
@@ -122,7 +123,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
checkContainedElementAt(resource, modelAsString, "bar bar0 ", ((FooBar) model.getBars().get(0)).getBar());
}
- public void testFindCrossReferencedElementAt() throws Exception {
+ @Test public void testFindCrossReferencedElementAt() throws Exception {
String firstPart = "foo Foo1 foo Foo2 zonk bar Bar1 Foo1";
String modelAsString = firstPart+",Foo2";
XtextResource resource = getResourceFromString(modelAsString);
@@ -132,7 +133,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
assertEquals("Foo1", foo1.getName());
}
- public void testFindCrossReferencedElementAt_1() throws Exception {
+ @Test public void testFindCrossReferencedElementAt_1() throws Exception {
String firstPart = "foo Foo1=X.Y foo Foo2=X.Y zonk bar Bar1 Foo1=X.Y";
String modelAsString = firstPart+",Foo2=X.Y";
XtextResource resource = getResourceFromString(modelAsString);
@@ -142,7 +143,7 @@ public class EObjectAtOffsetTest extends AbstractXtextTests {
assertEquals("Foo1=X.Y", foo1.getName());
}
- public void testGetCrossReferenceNode() throws Exception {
+ @Test public void testGetCrossReferenceNode() throws Exception {
String firstPart = "foo Foo1=X.Y foo Foo2=X.Y zonk bar Bar1 Foo1=X.Y";
String modelAsString = firstPart+",Foo2=X.Y";
XtextResource resource = getResourceFromString(modelAsString);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ExternalContentSupportTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ExternalContentSupportTest.java
index da68bf4d7..ae1067e86 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ExternalContentSupportTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ExternalContentSupportTest.java
@@ -18,8 +18,9 @@ import org.eclipse.emf.ecore.resource.URIHandler;
import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.IExternalContentSupport.IExternalContentProvider;
+import org.junit.Test;
import com.google.common.collect.Maps;
@@ -32,7 +33,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
private ExternalContentSupport support;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
uriToContent = Maps.newHashMap();
@@ -40,7 +41,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
uriToContent = null;
support = null;
super.tearDown();
@@ -58,13 +59,13 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
return this;
}
- public void testConfigureConverter() {
+ @Test public void testConfigureConverter() {
URIConverter converter = new ExtensibleURIConverterImpl();
support.configureConverter(converter, this);
checkConverter(converter);
}
- public void testConfigureResourceSet() {
+ @Test public void testConfigureResourceSet() {
XtextResourceSet resourceSet = get(XtextResourceSet.class);
support.configureResourceSet(resourceSet, this);
checkConverter(resourceSet.getURIConverter());
@@ -77,7 +78,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
}
}
- public void testGetResource_01() {
+ @Test public void testGetResource_01() {
XtextResourceSet resourceSet = get(XtextResourceSet.class);
resourceSet.setClasspathURIContext(getClass());
support.configureResourceSet(resourceSet, this);
@@ -87,7 +88,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
assertEquals("org.eclipse.xtext.Xtext", ((Grammar) resource.getContents().get(0)).getName());
}
- public void testGetResource_02() {
+ @Test public void testGetResource_02() {
String grammarInstead = "grammar org.foo.bar with org.eclipse.xtext.common.Terminals\n" +
"generate something 'http://something'\n" +
"Model: name=ID;";
@@ -102,7 +103,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
assertEquals("org.foo.bar", ((Grammar) resource.getContents().get(0)).getName());
}
- public void testGetResource_03() {
+ @Test public void testGetResource_03() {
String grammarInstead = "grammar org.foo.bar with org.eclipse.xtext.common.Terminals\n" +
"generate something 'http://something'\n" +
"Model: name=ID;";
@@ -118,7 +119,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
assertEquals("org.foo.bar", ((Grammar) resource.getContents().get(0)).getName());
}
- public void testCreateResource_01() throws IOException {
+ @Test public void testCreateResource_01() throws IOException {
XtextResourceSet resourceSet = get(XtextResourceSet.class);
resourceSet.setClasspathURIContext(getClass());
support.configureResourceSet(resourceSet, this);
@@ -130,7 +131,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
assertEquals("org.eclipse.xtext.Xtext", ((Grammar) resource.getContents().get(0)).getName());
}
- public void testCreateResource_02() throws IOException {
+ @Test public void testCreateResource_02() throws IOException {
String grammarInstead = "grammar org.foo.bar with org.eclipse.xtext.common.Terminals\n" +
"generate something 'http://something'\n" +
"Model: name=ID;";
@@ -147,7 +148,7 @@ public class ExternalContentSupportTest extends AbstractXtextTests implements IE
assertEquals("org.foo.bar", ((Grammar) resource.getContents().get(0)).getName());
}
- public void testCreateResource_03() throws IOException {
+ @Test public void testCreateResource_03() throws IOException {
String grammarInstead = "grammar org.foo.bar with org.eclipse.xtext.common.Terminals\n" +
"generate something 'http://something'\n" +
"Model: name=ID;";
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/LocationInFileProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/LocationInFileProviderTest.java
index 8e08414bd..80ff656dd 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/LocationInFileProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/LocationInFileProviderTest.java
@@ -10,7 +10,7 @@ package org.eclipse.xtext.resource;
import java.util.List;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.locationprovidertest.Bus;
import org.eclipse.xtext.resource.locationprovidertest.Component;
import org.eclipse.xtext.resource.locationprovidertest.Element;
@@ -19,6 +19,7 @@ import org.eclipse.xtext.resource.locationprovidertest.Mode;
import org.eclipse.xtext.resource.locationprovidertest.Model;
import org.eclipse.xtext.resource.locationprovidertest.Processor;
import org.eclipse.xtext.util.ITextRegion;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
@@ -31,7 +32,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
private ILocationInFileProvider locationInFileProvider;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(LocationProviderTestLanguageStandaloneSetup.class);
modelAsString =
@@ -52,7 +53,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
elements = null;
modelAsString = null;
model = null;
@@ -60,7 +61,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
super.tearDown();
}
- public void testContainmentRefSignificantLocation() throws Exception {
+ @Test public void testContainmentRefSignificantLocation() throws Exception {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getSignificantTextRegion(model, LocationprovidertestPackage.Literals.MODEL__ELEMENTS, 0);
assertEquals(modelAsString.indexOf("x"), location.getOffset());
@@ -74,7 +75,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(modelAsString.length(), location.getLength());
}
- public void testCrossRefSignificantLocation() throws Exception {
+ @Test public void testCrossRefSignificantLocation() throws Exception {
assertEquals(2, elements.size());
int indexOfFirstY = modelAsString.indexOf("y");
int indexOfSecondY = modelAsString.indexOf("y", indexOfFirstY + 1);
@@ -98,7 +99,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(1, location.getLength());
}
- public void testEObjectSignificantLocation() throws Exception {
+ @Test public void testEObjectSignificantLocation() throws Exception {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getSignificantTextRegion(elements.get(0));
assertEquals(modelAsString.indexOf("x"), location.getOffset());
@@ -108,7 +109,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(1, location.getLength());
}
- public void testAttributeSignificantLocation() {
+ @Test public void testAttributeSignificantLocation() {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getSignificantTextRegion(elements.get(0), LocationprovidertestPackage.Literals.ELEMENT__NAME, 0);
assertEquals(modelAsString.indexOf("x"), location.getOffset());
@@ -119,7 +120,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(1, location.getLength());
}
- public void testContainmentRefFullLocation() throws Exception {
+ @Test public void testContainmentRefFullLocation() throws Exception {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getFullTextRegion(model, LocationprovidertestPackage.Literals.MODEL__ELEMENTS, 0);
assertEquals(0, location.getOffset());
@@ -133,7 +134,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(modelAsString.length(), location.getLength());
}
- public void testCrossRefFullLocation() throws Exception {
+ @Test public void testCrossRefFullLocation() throws Exception {
assertEquals(2, elements.size());
int indexOfFirstY = modelAsString.indexOf("y");
int indexOfSecondY = modelAsString.indexOf("y", indexOfFirstY + 1);
@@ -157,7 +158,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals(modelAsString.indexOf(" element y"), location.getLength());
}
- public void testEObjectFullLocation() throws Exception {
+ @Test public void testEObjectFullLocation() throws Exception {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getFullTextRegion(elements.get(0));
assertEquals(modelAsString.indexOf("element x"), location.getOffset());
@@ -167,7 +168,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals("element y".length(), location.getLength());
}
- public void testAttributeFullLocation() {
+ @Test public void testAttributeFullLocation() {
assertEquals(2, elements.size());
ITextRegion location = locationInFileProvider.getFullTextRegion(elements.get(0), LocationprovidertestPackage.Literals.ELEMENT__NAME, 0);
assertEquals(modelAsString.indexOf("x"), location.getOffset());
@@ -178,14 +179,14 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals("y".length(), location.getLength());
}
- public void testBug353969_Setup() throws Exception {
+ @Test public void testBug353969_Setup() throws Exception {
EList components = model.getComponents();
assertEquals(2, components.size());
assertTrue(components.get(0) instanceof Processor);
assertTrue(components.get(1) instanceof Bus);
}
- public void testBug353969_01() throws Exception {
+ @Test public void testBug353969_01() throws Exception {
Processor p = (Processor) model.getComponents().get(0);
EList modes = p.getMode();
assertEquals(2, modes.size());
@@ -198,7 +199,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals("m1".length(), m1SignificantRegion.getLength());
}
- public void testBug353969_02() throws Exception {
+ @Test public void testBug353969_02() throws Exception {
Processor p = (Processor) model.getComponents().get(0);
EList modes = p.getMode();
assertEquals(2, modes.size());
@@ -211,7 +212,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals("m2".length(), m2SignificantRegion.getLength());
}
- public void testBug353969_03() throws Exception {
+ @Test public void testBug353969_03() throws Exception {
Bus b = (Bus) model.getComponents().get(1);
EList modes = b.getMode();
assertEquals(2, modes.size());
@@ -224,7 +225,7 @@ public class LocationInFileProviderTest extends AbstractXtextTests {
assertEquals("mb1".length(), mb1SignificantRegion.getLength());
}
- public void testBug353969_04() throws Exception {
+ @Test public void testBug353969_04() throws Exception {
Bus b = (Bus) model.getComponents().get(1);
EList modes = b.getMode();
assertEquals(2, modes.size());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ResourceSetReferencingResourceSetTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ResourceSetReferencingResourceSetTest.java
index 60e5ec5ce..83f26d5ff 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ResourceSetReferencingResourceSetTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ResourceSetReferencingResourceSetTest.java
@@ -7,21 +7,21 @@
*******************************************************************************/
package org.eclipse.xtext.resource;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
*/
-public class ResourceSetReferencingResourceSetTest extends TestCase {
+public class ResourceSetReferencingResourceSetTest extends Assert {
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
ResourceSetReferencingResourceSetImpl set1 = new ResourceSetReferencingResourceSetImpl();
Resource resource = getResource("foo1","foo2");
set1.getResources().add(resource);
@@ -40,7 +40,7 @@ public class ResourceSetReferencingResourceSetTest extends TestCase {
}
- public void testNotTranitive() throws Exception {
+ @Test public void testNotTranitive() throws Exception {
ResourceSetReferencingResourceSetImpl set1 = new ResourceSetReferencingResourceSetImpl();
Resource resource = getResource("foo1","foo3");
set1.getResources().add(resource);
@@ -58,7 +58,7 @@ public class ResourceSetReferencingResourceSetTest extends TestCase {
assertTrue(((InternalEObject)eClass).eIsProxy());
}
- public void testShadowing() throws Exception {
+ @Test public void testShadowing() throws Exception {
ResourceSetReferencingResourceSetImpl set1 = new ResourceSetReferencingResourceSetImpl();
Resource resource = getResource("foo1","foo2");
set1.getResources().add(resource);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
index 4c5ba65ea..0a0ddae97 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourcePerformanceTest.java
@@ -7,8 +7,9 @@
*******************************************************************************/
package org.eclipse.xtext.resource;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
+import org.junit.Test;
import com.google.common.collect.Iterables;
@@ -21,7 +22,7 @@ public class XtextResourcePerformanceTest extends AbstractXtextTests {
private String model;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
StringBuilder modelBuilder = new StringBuilder(NUM_ELEMENTS * 64);
@@ -38,7 +39,7 @@ public class XtextResourcePerformanceTest extends AbstractXtextTests {
model = modelBuilder.toString();
}
- public void testLoad() throws Exception {
+ @Test public void testLoad() throws Exception {
XtextResource resource = getResourceFromString(model);
assertNotNull(resource);
assertFalse(resource.getParseResult().hasSyntaxErrors());
@@ -46,7 +47,7 @@ public class XtextResourcePerformanceTest extends AbstractXtextTests {
assertTrue(resource.getErrors().isEmpty());
}
- public void testLoadModelWithLinkingErrors() throws Exception {
+ @Test public void testLoadModelWithLinkingErrors() throws Exception {
StringBuilder modelBuilder = new StringBuilder(NUM_ELEMENTS * 64);
modelBuilder.append("spielplatz " + NUM_ELEMENTS + " {\n");
for (int i = 1; i <= NUM_ELEMENTS; i++) {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
index a30357581..22f62f72e 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/XtextResourceTest.java
@@ -10,12 +10,13 @@ package org.eclipse.xtext.resource;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.impl.XtextLinkingDiagnostic;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
import org.eclipse.xtext.testlanguages.ReferenceGrammarTestLanguageStandaloneSetup;
import org.eclipse.xtext.util.Wrapper;
+import org.junit.Test;
import com.google.common.collect.Iterables;
@@ -28,13 +29,13 @@ public class XtextResourceTest extends AbstractXtextTests {
private final String simpleModel = "spielplatz 1 { kind ( Bob 0 ) }";
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
resource = getResourceFromString("");
}
- public void testInitialState() throws Exception {
+ @Test public void testInitialState() throws Exception {
assertNotNull(resource);
assertTrue(resource.isLoaded());
assertFalse("resource.isTrackingModification()", resource.isTrackingModification());
@@ -50,36 +51,36 @@ public class XtextResourceTest extends AbstractXtextTests {
assertNull(parseResult.getRootASTElement());
}
- public void testModify_01() throws Exception {
+ @Test public void testModify_01() throws Exception {
resource.update(0, 0, simpleModel);
assertFalse(resource.isModified());
}
- public void testModify_02() throws Exception {
+ @Test public void testModify_02() throws Exception {
resource.reparse(simpleModel);
assertFalse(resource.isModified());
}
- public void testModify_03() throws Exception {
+ @Test public void testModify_03() throws Exception {
resource.reparse(simpleModel);
assertFalse(resource.isModified());
modifySpielplatz();
assertFalse(resource.isModified());
}
- public void testModify_04() throws Exception {
+ @Test public void testModify_04() throws Exception {
resource.setTrackingModification(true);
resource.update(0, 0, simpleModel);
assertTrue(resource.isModified());
}
- public void testModify_05() throws Exception {
+ @Test public void testModify_05() throws Exception {
resource.setTrackingModification(true);
resource.reparse(simpleModel);
assertFalse(resource.isModified());
}
- public void testModify_06() throws Exception {
+ @Test public void testModify_06() throws Exception {
resource.setTrackingModification(true);
resource.reparse(simpleModel);
assertFalse(resource.isModified());
@@ -97,7 +98,7 @@ public class XtextResourceTest extends AbstractXtextTests {
obj.eSet(feature, 3);
}
- public void testUnload() throws Exception {
+ @Test public void testUnload() throws Exception {
resource.reparse(simpleModel);
IParseResult parseResult = resource.getParseResult();
resource.unload();
@@ -105,7 +106,7 @@ public class XtextResourceTest extends AbstractXtextTests {
assertTrue(parseResult.getRootASTElement().eIsProxy());
}
- public void testUnloadReferables() throws Exception {
+ @Test public void testUnloadReferables() throws Exception {
resource.reparse(simpleModel);
final Wrapper unloaded = Wrapper.wrap(Boolean.FALSE);
resource.setUnloader(new IReferableElementsUnloader() {
@@ -117,7 +118,7 @@ public class XtextResourceTest extends AbstractXtextTests {
assertTrue("unloaded", unloaded.get());
}
- public void testUpdate() throws Exception {
+ @Test public void testUpdate() throws Exception {
resource.update(0, 0, simpleModel);
IParseResult parseResult = resource.getParseResult();
@@ -128,7 +129,7 @@ public class XtextResourceTest extends AbstractXtextTests {
assertNotNull(parseResult.getRootASTElement());
}
- public void testErrorMarkers() throws Exception {
+ @Test 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);
EcoreUtil.resolveAll(resource);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/containers/StateBasedContainerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/containers/StateBasedContainerTest.java
index 762509896..945e7b88f 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/containers/StateBasedContainerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/containers/StateBasedContainerTest.java
@@ -16,6 +16,8 @@ import org.eclipse.xtext.resource.impl.ChangedResourceDescriptionDelta;
import org.eclipse.xtext.resource.impl.ResourceDescriptionChangeEvent;
import org.eclipse.xtext.resource.impl.ResourceDescriptionsBasedContainer;
import org.eclipse.xtext.resource.impl.ResourceDescriptionsBasedContainerTest;
+import org.junit.After;
+import org.junit.Test;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
@@ -28,15 +30,14 @@ public class StateBasedContainerTest extends ResourceDescriptionsBasedContainerT
private boolean simulateEmpty;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
simulateEmpty = false;
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
simulateEmpty = false;
- super.tearDown();
}
@Override
@@ -57,7 +58,7 @@ public class StateBasedContainerTest extends ResourceDescriptionsBasedContainerT
}
@Override
- public void testBug352214() {
+ @Test public void testBug352214() {
container.getResourceDescriptions(); // initialize uri map
ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(Collections.singletonList(
new ChangedResourceDescriptionDelta(resourceDescription, null)), null);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/EcoreResourceDescriptionManagerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/EcoreResourceDescriptionManagerTest.java
index 6e4c6dbf1..615aefcee 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/EcoreResourceDescriptionManagerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/EcoreResourceDescriptionManagerTest.java
@@ -13,8 +13,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.ENamedElement;
@@ -32,6 +30,8 @@ import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.generic.GenericResourceDescriptionManager;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
@@ -43,20 +43,20 @@ import com.google.inject.Injector;
* @author Sven Efftinge - Initial contribution and API
* @author Jan Koehnlein
*/
-public class EcoreResourceDescriptionManagerTest extends TestCase {
+public class EcoreResourceDescriptionManagerTest extends Assert {
private GenericResourceDescriptionManager getEmfResourceDescriptionsManager() {
Injector injector = Guice.createInjector(new EcoreRuntimeModule());
return injector.getInstance(GenericResourceDescriptionManager.class);
}
- public void testEcore() throws Exception {
+ @Test public void testEcore() throws Exception {
Map index = createIndex(EcorePackage.eINSTANCE.eResource());
checkEcore(index, "ecore", false);
checkEcore(index, EcorePackage.eNS_URI, true);
}
- public void testNestedPackage() throws Exception {
+ @Test public void testNestedPackage() throws Exception {
Resource resource = new XMIResourceImpl();
EPackage parent = EcoreFactory.eINSTANCE.createEPackage();
parent.setName("parent");
@@ -79,7 +79,7 @@ public class EcoreResourceDescriptionManagerTest extends TestCase {
assertEquals(6,index.size());
}
- public void testMissingNsURI() {
+ @Test public void testMissingNsURI() {
Resource resource = new XMIResourceImpl();
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setName("test");
@@ -93,7 +93,7 @@ public class EcoreResourceDescriptionManagerTest extends TestCase {
assertEquals(2,index.size());
}
- public void testMissingName() {
+ @Test public void testMissingName() {
Resource resource = new XMIResourceImpl();
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setNsURI("http://test");
@@ -107,7 +107,7 @@ public class EcoreResourceDescriptionManagerTest extends TestCase {
assertEquals(2,index.size());
}
- public void testMissingMiddleName() {
+ @Test public void testMissingMiddleName() {
Resource resource = new XMIResourceImpl();
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setName("test");
@@ -165,7 +165,7 @@ public class EcoreResourceDescriptionManagerTest extends TestCase {
return index;
}
- public void testPerformance() throws Exception {
+ @Test public void testPerformance() throws Exception {
GenericResourceDescriptionManager manager = getEmfResourceDescriptionsManager();
Collection uris = ImmutableList.copyOf(EPackage.Registry.INSTANCE.keySet());
for(String uri: uris) {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/XMLEncodingProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/XMLEncodingProviderTest.java
index 0f7db9ed6..29bd07572 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/XMLEncodingProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ecore/XMLEncodingProviderTest.java
@@ -7,29 +7,29 @@
*******************************************************************************/
package org.eclipse.xtext.resource.ecore;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.xtext.resource.ClassloaderClasspathUriResolver;
import org.eclipse.xtext.resource.IClasspathUriResolver;
import org.eclipse.xtext.resource.generic.XMLEncodingProvider;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class XMLEncodingProviderTest extends TestCase {
+public class XMLEncodingProviderTest extends Assert {
private String packagePath;
private IClasspathUriResolver resolver;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
packagePath = getClass().getPackage().getName().replaceAll("\\.", "/");
resolver = new ClassloaderClasspathUriResolver();
}
- public void testName() throws Exception {
+ @Test public void testName() throws Exception {
XMLEncodingProvider xmlEncodingProvider = new XMLEncodingProvider();
assertEquals("UTF-8", xmlEncodingProvider.getEncoding(getURI("utf8.ecore")));
assertEquals("ISO-8859-1", xmlEncodingProvider.getEncoding(getURI("iso-8859-1.ecore")));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ignorecase/DefaultResourceDescriptionManagerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ignorecase/DefaultResourceDescriptionManagerTest.java
index 448ab6efa..5766a5941 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ignorecase/DefaultResourceDescriptionManagerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/ignorecase/DefaultResourceDescriptionManagerTest.java
@@ -10,8 +10,6 @@ package org.eclipse.xtext.resource.ignorecase;
import java.util.Collection;
import java.util.Collections;
-import junit.framework.TestCase;
-
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
@@ -24,20 +22,22 @@ import org.eclipse.xtext.resource.impl.DefaultResourceDescription;
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionDelta;
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager;
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class DefaultResourceDescriptionManagerTest extends TestCase {
+public class DefaultResourceDescriptionManagerTest extends Assert {
private Resource resource;
private DefaultResourceDescription resourceDescription;
private DefaultResourceDescriptionManager manager;
private Collection importedNames;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
EObject copy = EcoreUtil.copy(EcorePackage.eINSTANCE);
resource = new ResourceImpl();
resource.getContents().add(copy);
@@ -60,7 +60,7 @@ public class DefaultResourceDescriptionManagerTest extends TestCase {
importedNames = Collections.emptySet();
}
- public void testIsAffected() {
+ @Test public void testIsAffected() {
DefaultResourceDescriptionDelta delta = new DefaultResourceDescriptionDelta(null, resourceDescription);
assertFalse(manager.isAffected(delta, resourceDescription));
importedNames = Collections.singleton(QualifiedName.create("eclass"));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultReferenceDescriptionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultReferenceDescriptionTest.java
index e85e513d4..4e5f05bea 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultReferenceDescriptionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultReferenceDescriptionTest.java
@@ -28,7 +28,7 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
import org.eclipse.xtext.EcoreUtil2;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguagePackage;
import org.eclipse.xtext.linking.langATestLanguage.Main;
@@ -41,6 +41,7 @@ import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.util.SimpleAttributeResolver;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -50,7 +51,7 @@ import com.google.common.collect.Lists;
*/
public class DefaultReferenceDescriptionTest extends AbstractXtextTests {
- public void testgetReferenceDescriptions() throws Exception {
+ @Test public void testgetReferenceDescriptions() throws Exception {
with(new LangATestLanguageStandaloneSetup());
XtextResource targetResource = getResource("type C", "bar.langatestlanguage");
EObject typeC = targetResource.getContents().get(0).eContents().get(0);
@@ -69,7 +70,7 @@ public class DefaultReferenceDescriptionTest extends AbstractXtextTests {
assertEquals(LangATestLanguagePackage.Literals.TYPE__EXTENDS,refDesc.getEReference());
}
- public void testgetReferenceDescriptionForMultiValue() throws Exception {
+ @Test public void testgetReferenceDescriptionForMultiValue() throws Exception {
with(new LangATestLanguageStandaloneSetup());
XtextResource targetResource = getResource("type C type D", "bar.langatestlanguage");
EObject typeC = targetResource.getContents().get(0).eContents().get(0);
@@ -95,7 +96,7 @@ public class DefaultReferenceDescriptionTest extends AbstractXtextTests {
assertEquals(LangATestLanguagePackage.Literals.TYPE__IMPLEMENTS,refDesc2.getEReference());
}
- public void testSpecialReferences() {
+ @Test public void testSpecialReferences() {
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setName("test");
ePackage.setNsPrefix("test");
@@ -164,7 +165,7 @@ public class DefaultReferenceDescriptionTest extends AbstractXtextTests {
assertEquals(EcoreUtil.getURI(object), referenceDescription.getContainerEObjectURI());
}
- public void testCrossResourceContainment() {
+ @Test public void testCrossResourceContainment() {
EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setName("test");
ePackage.setNsPrefix("test");
@@ -229,7 +230,7 @@ public class DefaultReferenceDescriptionTest extends AbstractXtextTests {
}
/** @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=330812 */
- public void testLazyLinkingProxyReferences() {
+ @Test public void testLazyLinkingProxyReferences() {
URI resourceUri = URI.createPlatformResourceURI("test.ecore", true);
LazyURIEncoder lazyURIEncoder = new LazyURIEncoder();
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescription2Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescription2Test.java
index e29f35203..c388e62e2 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescription2Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescription2Test.java
@@ -4,7 +4,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
@@ -13,16 +13,17 @@ import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.util.SimpleAttributeResolver;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
public class DefaultResourceDescription2Test extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(new LangATestLanguageStandaloneSetup());
}
- public void testNotYetLinked() throws Exception {
+ @Test public void testNotYetLinked() throws Exception {
XtextResourceSet rs = get(XtextResourceSet.class);
Resource res1 = rs.createResource(URI.createURI("foo.langatestlanguage"));
res1.load(new StringInputStream("type Foo"), null);
@@ -36,7 +37,7 @@ public class DefaultResourceDescription2Test extends AbstractXtextTests {
}
- public void testValidExternalLink() throws Exception {
+ @Test public void testValidExternalLink() throws Exception {
XtextResourceSet rs = get(XtextResourceSet.class);
Resource res1 = rs.createResource(URI.createURI("foo.langatestlanguage"));
res1.load(new StringInputStream("type Foo"), null);
@@ -50,7 +51,7 @@ public class DefaultResourceDescription2Test extends AbstractXtextTests {
assertEquals(QualifiedName.create("foo"),names.iterator().next());
}
- public void testValidLocalLink() throws Exception {
+ @Test public void testValidLocalLink() throws Exception {
XtextResourceSet rs = get(XtextResourceSet.class);
Resource res1 = rs.createResource(URI.createURI("foo.langatestlanguage"));
res1.load(new StringInputStream("type Foo"), null);
@@ -64,7 +65,7 @@ public class DefaultResourceDescription2Test extends AbstractXtextTests {
assertFalse(names.iterator().hasNext());
}
- public void testBrokenLink() throws Exception {
+ @Test public void testBrokenLink() throws Exception {
XtextResourceSet rs = get(XtextResourceSet.class);
Resource res1 = rs.createResource(URI.createURI("foo.langatestlanguage"));
res1.load(new StringInputStream("type Foo"), null);
@@ -78,7 +79,7 @@ public class DefaultResourceDescription2Test extends AbstractXtextTests {
assertEquals(QualifiedName.create("baz"),names.iterator().next());
}
- public void testClasspathURIIsNormalized() {
+ @Test public void testClasspathURIIsNormalized() {
XtextResourceSet xtextResourceSet = new XtextResourceSet();
xtextResourceSet.setClasspathURIContext(this);
URI classpathURI = URI.createURI("classpath:/org/eclipse/xtext/XtextGrammarTestLanguage.ecore");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionDeltaTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionDeltaTest.java
index 8a5cb3460..0ae599c8e 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionDeltaTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionDeltaTest.java
@@ -13,8 +13,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -22,6 +20,8 @@ import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.IReferenceDescription;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@@ -30,7 +30,7 @@ import com.google.common.collect.Sets;
/**
* @author Sven Efftinge - Initial contribution and API
*/
-public class DefaultResourceDescriptionDeltaTest extends TestCase {
+public class DefaultResourceDescriptionDeltaTest extends Assert {
public static QualifiedName FOO = QualifiedName.create("foo");
public static QualifiedName FOP = QualifiedName.create("fop");
public static QualifiedName BAR = QualifiedName.create("bar");
@@ -69,13 +69,13 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
}
- public void testHasChanges_1() throws Exception {
+ @Test public void testHasChanges_1() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
TestResDesc resourceDesc2 = new TestResDesc();
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_2() throws Exception {
+ @Test public void testHasChanges_2() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
@@ -85,7 +85,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_3() throws Exception {
+ @Test public void testHasChanges_3() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, null));
@@ -97,7 +97,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_4() throws Exception {
+ @Test public void testHasChanges_4() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.imported.add(BAR);
@@ -111,7 +111,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_5() throws Exception {
+ @Test public void testHasChanges_5() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, null));
@@ -123,7 +123,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_6() throws Exception {
+ @Test public void testHasChanges_6() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, null));
@@ -134,7 +134,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_7() throws Exception {
+ @Test public void testHasChanges_7() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
@@ -146,7 +146,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_8() throws Exception {
+ @Test public void testHasChanges_8() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(
@@ -161,7 +161,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
}
/** see https://bugs.eclipse.org/bugs/show_bug.cgi?id=356063 */
- public void testHasChanges_9() throws Exception {
+ @Test public void testHasChanges_9() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.exported.add(
EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, ImmutableMap.of("foo", "bar", "qux", "quux")));
@@ -209,7 +209,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_DifferentTypes() throws Exception {
+ @Test public void testHasChanges_DifferentTypes() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
@@ -227,7 +227,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_DifferentURIs() throws Exception {
+ @Test public void testHasChanges_DifferentURIs() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
@@ -245,7 +245,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanges_MultipleEObjects() throws Exception {
+ @Test public void testHasChanges_MultipleEObjects() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
@@ -259,7 +259,7 @@ public class DefaultResourceDescriptionDeltaTest extends TestCase {
assertFalse(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged());
}
- public void testHasChanged_differentOrder() throws Exception {
+ @Test public void testHasChanged_differentOrder() throws Exception {
TestResDesc resourceDesc = new TestResDesc();
resourceDesc.imported.add(FOO);
resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar")));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionTest.java
index 46cb14176..d0a762aaf 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/DefaultResourceDescriptionTest.java
@@ -10,8 +10,6 @@ package org.eclipse.xtext.resource.impl;
import java.util.ArrayList;
import java.util.Collection;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
@@ -26,6 +24,9 @@ import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.Lists;
@@ -33,7 +34,7 @@ import com.google.common.collect.Lists;
* @author Sven Efftinge - Initial contribution and API
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class DefaultResourceDescriptionTest extends TestCase {
+public class DefaultResourceDescriptionTest extends Assert {
private DefaultResourceDescription description;
private EPackage pack;
@@ -43,8 +44,8 @@ public class DefaultResourceDescriptionTest extends TestCase {
private IQualifiedNameProvider nameProvider;
private DefaultResourceDescriptionStrategy strategy;
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
resource = new XMLResourceImpl();
resource.setURI(URI.createURI("foo:/test"));
nameProvider = new IQualifiedNameProvider.AbstractImpl() {
@@ -70,7 +71,7 @@ public class DefaultResourceDescriptionTest extends TestCase {
}
- public void testGetExportedObject_1() throws Exception {
+ @Test public void testGetExportedObject_1() throws Exception {
strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() {
public QualifiedName getFullyQualifiedName(EObject obj) {
if (obj instanceof EPackage)
@@ -86,7 +87,7 @@ public class DefaultResourceDescriptionTest extends TestCase {
assertEquals(pack, list.get(0).getEObjectOrProxy());
}
- public void testGetExportedObject_2() throws Exception {
+ @Test public void testGetExportedObject_2() throws Exception {
strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() {
public QualifiedName getFullyQualifiedName(EObject obj) {
if (obj instanceof EClassifier)
@@ -104,7 +105,7 @@ public class DefaultResourceDescriptionTest extends TestCase {
assertEquals(dtype, list.get(1).getEObjectOrProxy());
}
- public void testGetExportedObject_3() throws Exception {
+ @Test public void testGetExportedObject_3() throws Exception {
Iterable iterable = description.getExportedObjects();
ArrayList list = Lists.newArrayList(iterable);
assertEquals(3, list.size());
@@ -116,19 +117,19 @@ public class DefaultResourceDescriptionTest extends TestCase {
assertEquals(dtype, list.get(2).getEObjectOrProxy());
}
- public void testGetExportedEObjects_EClass_String() throws Exception {
+ @Test public void testGetExportedEObjects_EClass_String() throws Exception {
assertContains(description.getExportedObjects(pack.eClass(), QualifiedName.create(pack.getName()), false), pack);
assertContains(description.getExportedObjects(pack.eClass(), QualifiedName.create("foo"), false));
assertContains(description.getExportedObjects(eClass.eClass(), QualifiedName.create("foo"), false));
}
- public void testGetExportedEObjectsIgnoreCase() throws Exception {
+ @Test public void testGetExportedEObjectsIgnoreCase() throws Exception {
assertContains(description.getExportedObjects(pack.eClass(), QualifiedName.create(pack.getName().toUpperCase()), true), pack);
assertContains(description.getExportedObjects(pack.eClass(), QualifiedName.create("foo").toUpperCase(),true));
assertContains(description.getExportedObjects(eClass.eClass(), QualifiedName.create("foo").toUpperCase(),true));
}
- public void testGetExportedEObjects_EClass() throws Exception {
+ @Test public void testGetExportedEObjects_EClass() throws Exception {
assertContains(description.getExportedObjectsByType(EcorePackage.Literals.EPACKAGE),pack);
assertContains(description.getExportedObjectsByType(EcorePackage.Literals.ECLASSIFIER),eClass,dtype);
assertContains(description.getExportedObjectsByType(EcorePackage.Literals.ECLASS),eClass);
@@ -136,7 +137,7 @@ public class DefaultResourceDescriptionTest extends TestCase {
assertContains(description.getExportedObjectsByType(EcorePackage.Literals.EATTRIBUTE));
}
- public void testGetExportedEObjectsForEObject() throws Exception {
+ @Test public void testGetExportedEObjectsForEObject() throws Exception {
assertContains(description.getExportedObjectsByObject(pack), pack);
assertContains(description.getExportedObjectsByObject(eClass),eClass);
assertContains(description.getExportedObjectsByObject(dtype),dtype);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsBasedContainerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsBasedContainerTest.java
index 54f3211e2..1584f668b 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsBasedContainerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceDescriptionsBasedContainerTest.java
@@ -10,8 +10,6 @@ package org.eclipse.xtext.resource.impl;
import java.util.Collections;
import java.util.List;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -25,6 +23,9 @@ import org.eclipse.xtext.resource.IReferenceDescription;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.resource.ISelectable;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
@@ -32,7 +33,7 @@ import com.google.common.collect.Iterables;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class ResourceDescriptionsBasedContainerTest extends TestCase implements IResourceDescriptions {
+public class ResourceDescriptionsBasedContainerTest extends Assert implements IResourceDescriptions {
private static final QualifiedName SOME_NAME = QualifiedName.create("SomeName");
protected ResourceDescriptionsBasedContainer container;
@@ -71,9 +72,8 @@ public class ResourceDescriptionsBasedContainerTest extends TestCase implements
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
eClass = EcoreFactory.eINSTANCE.createEClass();
eClass.setName("SomeName");
uri = URI.createURI("myURI");
@@ -92,50 +92,50 @@ public class ResourceDescriptionsBasedContainerTest extends TestCase implements
return new ResourceDescriptionsBasedContainer(this);
}
- public void testGetExportedObjectsByType_01() {
+ @Test public void testGetExportedObjectsByType_01() {
EClass classifier = EcorePackage.Literals.ECLASSIFIER;
Iterable iterable = container.getExportedObjectsByType(classifier);
EObject eObject = Iterables.getOnlyElement(iterable).getEObjectOrProxy();
assertSame(eClass, eObject);
}
- public void testGetExportedObjectsByType_02() {
+ @Test public void testGetExportedObjectsByType_02() {
eClass = null;
Iterable iterable = container.getExportedObjectsByType(EcorePackage.Literals.ECLASSIFIER);
assertTrue(Iterables.isEmpty(iterable));
}
- public void testGetExportedObjects_01() {
+ @Test public void testGetExportedObjects_01() {
Iterable iterable = container.getExportedObjects(EcorePackage.Literals.ECLASSIFIER, SOME_NAME, false);
EObject eObject = Iterables.getOnlyElement(iterable).getEObjectOrProxy();
assertSame(eClass, eObject);
}
- public void testGetExportedObjects_02() {
+ @Test public void testGetExportedObjects_02() {
eClass = null;
Iterable iterable = container.getExportedObjects(EcorePackage.Literals.ECLASSIFIER, SOME_NAME, false);
assertTrue(Iterables.isEmpty(iterable));
}
- public void testGetExportedObjects_03() {
+ @Test public void testGetExportedObjects_03() {
Iterable iterable = container.getExportedObjects(EcorePackage.Literals.ECLASSIFIER, SOME_NAME.toUpperCase(), true);
EObject eObject = Iterables.getOnlyElement(iterable).getEObjectOrProxy();
assertSame(eClass, eObject);
}
- public void testGetExportedObjects_04() {
+ @Test public void testGetExportedObjects_04() {
Iterable iterable = container.getExportedObjects(EcorePackage.Literals.ECLASSIFIER, SOME_NAME.toLowerCase(), true);
EObject eObject = Iterables.getOnlyElement(iterable).getEObjectOrProxy();
assertSame(eClass, eObject);
}
- public void testGetExportedObjects_05() {
+ @Test public void testGetExportedObjects_05() {
eClass = null;
Iterable iterable = container.getExportedObjects(EcorePackage.Literals.ECLASSIFIER, SOME_NAME, true);
assertTrue(Iterables.isEmpty(iterable));
}
- public void testBug352214() {
+ @Test public void testBug352214() {
container.getResourceDescriptions(); // initialize uri map
ResourceDescriptionChangeEvent event = new ResourceDescriptionChangeEvent(Collections.singletonList(
new ChangedResourceDescriptionDelta(resourceDescription, null)), null);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceSetBasedResourceDescriptionsTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceSetBasedResourceDescriptionsTest.java
index b989d0f7a..4e03f6b96 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceSetBasedResourceDescriptionsTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/resource/impl/ResourceSetBasedResourceDescriptionsTest.java
@@ -12,8 +12,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.ENamedElement;
@@ -33,6 +31,9 @@ import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.IResourceDescription.Manager;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.util.IResourceScopeCache;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
@@ -43,7 +44,7 @@ import com.google.common.collect.Sets;
* @author Sebastian Zarnekow - Initial contribution and API
* @author Holger Schill
*/
-public class ResourceSetBasedResourceDescriptionsTest extends TestCase implements IResourceServiceProvider.Registry, Function {
+public class ResourceSetBasedResourceDescriptionsTest extends Assert implements IResourceServiceProvider.Registry, Function {
private ResourceSet resourceSet;
private DefaultResourceDescriptionManager resourceDescriptionManager;
@@ -51,9 +52,8 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
private int nameCount;
private ResourceSetBasedResourceDescriptions resDescs;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
resourceSet = new ResourceSetImpl();
IQualifiedNameProvider qualifiedNameProvider = new IQualifiedNameProvider.AbstractImpl() {
@@ -87,14 +87,14 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
};
}
- public void testEmptyResourceSet() {
+ @Test public void testEmptyResourceSet() {
Iterable iterable = container.getExportedObjectsByType(EcorePackage.Literals.EOBJECT);
assertTrue(Iterables.isEmpty(iterable));
iterable = container.getExportedObjects(EcorePackage.Literals.EOBJECT, QualifiedName.create("Zonk"), false);
assertTrue(Iterables.isEmpty(iterable));
}
- public void testOneElement_Mismatch() {
+ @Test public void testOneElement_Mismatch() {
QualifiedName qualifiedName = QualifiedName.create("SomeName");
EClass type = EcorePackage.Literals.EPACKAGE;
Resource resource = createResource();
@@ -107,7 +107,7 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
assertTrue(Iterables.isEmpty(iterable));
}
- public void testOneElement_Match() {
+ @Test public void testOneElement_Match() {
QualifiedName qualifiedName = QualifiedName.create("SomeName");
EClass type = EcorePackage.Literals.EPACKAGE;
Resource resource = createResource();
@@ -124,7 +124,7 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
}
- public void testTwoElements_OneMatch() {
+ @Test public void testTwoElements_OneMatch() {
QualifiedName qualifiedName = QualifiedName.create("SomeName");
EClass type = EcorePackage.Literals.EPACKAGE;
Resource resource = createResource();
@@ -142,7 +142,7 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
assertSame(element, Iterables.getOnlyElement(iterable).getEObjectOrProxy());
}
- public void testTwoResources_TwoMatches() {
+ @Test public void testTwoResources_TwoMatches() {
QualifiedName qualifiedName = QualifiedName.create("SomeName");
EClass type = EcorePackage.Literals.EPACKAGE;
Resource resource = createResource();
@@ -168,7 +168,7 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
assertEquals(expectedSet, transformedSet);
}
- public void testPerformance10Resources100EClassesEach() {
+ @Test public void testPerformance10Resources100EClassesEach() {
int resourceCount = 10;
int eClassCount = 100;
for(int i = 0; i < resourceCount; i++) {
@@ -220,7 +220,7 @@ public class ResourceSetBasedResourceDescriptionsTest extends TestCase implement
return getResourceServiceProvider(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE);
}
- public void testBug_352450 () throws Exception {
+ @Test public void testBug_352450 () throws Exception {
int resourceCount = 3;
int eClassCount = 1;
for(int i = 0; i < resourceCount; i++) {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopeTest.java
index 2cfeef7d7..6a18eb137 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopeTest.java
@@ -7,8 +7,6 @@
*******************************************************************************/
package org.eclipse.xtext.scoping;
-import junit.framework.TestCase;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EcoreFactory;
@@ -18,6 +16,9 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.scoping.impl.AbstractScope;
import org.eclipse.xtext.scoping.impl.SimpleScope;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.Iterables;
@@ -25,36 +26,35 @@ import com.google.common.collect.Iterables;
* @author Sven Efftinge - Initial contribution and API
* @author Holger Schill - Contribution to Bug 309764
*/
-public class ScopeTest extends TestCase {
+public class ScopeTest extends Assert {
private AbstractScope scope;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
scope = getEcoreClassifiersScope();
}
- public void testContentByEObject_existent() throws Exception {
+ @Test public void testContentByEObject_existent() throws Exception {
assertNotNull(scope.getSingleElement(EcorePackage.eINSTANCE.getEAnnotation()));
}
- public void testContentByEObject_nonExistent() throws Exception {
+ @Test public void testContentByEObject_nonExistent() throws Exception {
assertNull(scope.getSingleElement(EcorePackage.eINSTANCE.getEAnnotation_Contents()));
}
- public void testContentByEObject_withProxy() throws Exception {
+ @Test public void testContentByEObject_withProxy() throws Exception {
EClass eClass = EcoreFactory.eINSTANCE.createEClass();
((InternalEObject) eClass).eSetProxyURI(EcoreUtil.getURI(EcorePackage.eINSTANCE.getEAnnotation()));
assertNotNull(scope.getSingleElement(eClass));
}
- public void testContentByName_existent() throws Exception {
+ @Test public void testContentByName_existent() throws Exception {
QualifiedName qualifiedName = QualifiedName.create(EcorePackage.eINSTANCE.getEAnnotation().getName());
assertEquals(qualifiedName, scope.getSingleElement(qualifiedName).getName());
}
- public void testContentByName_nonExistent() throws Exception {
+ @Test public void testContentByName_nonExistent() throws Exception {
assertNull(scope.getSingleElement(QualifiedName.create("unknown_name")));
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopesTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopesTest.java
index fd3431b20..a14986c4f 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopesTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/ScopesTest.java
@@ -11,25 +11,25 @@ package org.eclipse.xtext.scoping;
import java.util.ArrayList;
import java.util.Iterator;
-import junit.framework.TestCase;
-
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
*
*/
-public class ScopesTest extends TestCase {
+public class ScopesTest extends Assert {
private QualifiedName FOO = QualifiedName.create("Foo");
private QualifiedName BAR = QualifiedName.create("Bar");
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
EAttribute attr = EcoreFactory.eINSTANCE.createEAttribute();
attr.setName("Foo");
EAttribute attr2 = EcoreFactory.eINSTANCE.createEAttribute();
@@ -45,7 +45,7 @@ public class ScopesTest extends TestCase {
assertEquals(BAR, iterator.next().getName());
}
- public void testWithNull() throws Exception {
+ @Test public void testWithNull() throws Exception {
EAttribute attr = EcoreFactory.eINSTANCE.createEAttribute();
attr.setName("Foo");
EAttribute attr2 = EcoreFactory.eINSTANCE.createEAttribute();
@@ -63,7 +63,7 @@ public class ScopesTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testWithDifferentElements() throws Exception {
+ @Test public void testWithDifferentElements() throws Exception {
EAttribute attr = EcoreFactory.eINSTANCE.createEAttribute();
attr.setName("Foo");
EDataType datatype = EcoreFactory.eINSTANCE.createEDataType();
@@ -85,7 +85,7 @@ public class ScopesTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testEmptyIterable() throws Exception {
+ @Test public void testEmptyIterable() throws Exception {
ArrayList list = new ArrayList();
Iterable iterable = Scopes.scopedElementsFor(list);
assertFalse(iterable.iterator().hasNext());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/AbstractScopeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/AbstractScopeTest.java
index 00c5de57d..118f92456 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/AbstractScopeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/AbstractScopeTest.java
@@ -17,16 +17,18 @@ import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
-import junit.framework.TestCase;
-
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public abstract class AbstractScopeTest extends TestCase {
+public abstract class AbstractScopeTest extends Assert {
protected IEObjectDescription descriptionA;
protected IEObjectDescription descriptionA_aliased;
@@ -36,9 +38,8 @@ public abstract class AbstractScopeTest extends TestCase {
protected EAnnotation annotationB;
private Resource resource;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
resource = new ResourceImpl(URI.createURI("uri"));
annotationA = EcoreFactory.eINSTANCE.createEAnnotation();
annotationB = EcoreFactory.eINSTANCE.createEAnnotation();
@@ -50,8 +51,8 @@ public abstract class AbstractScopeTest extends TestCase {
descriptionB_as_A = EObjectDescription.create("a", annotationB);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
annotationA = null;
annotationB = null;
descriptionA = null;
@@ -59,96 +60,95 @@ public abstract class AbstractScopeTest extends TestCase {
descriptionB = null;
descriptionB_as_A = null;
resource = null;
- super.tearDown();
}
protected abstract IScope createScope(IScope parent, Iterable content);
- public void testSingleByName() {
+ @Test public void testSingleByName() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB));
assertSame(descriptionA, scope.getSingleElement(descriptionA.getName()));
assertSame(descriptionB, scope.getSingleElement(descriptionB.getName()));
}
- public void testSingleByNameWithDuplicate() {
+ @Test public void testSingleByNameWithDuplicate() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB_as_A, descriptionB));
assertSame(descriptionA, scope.getSingleElement(descriptionA.getName()));
assertSame(descriptionB, scope.getSingleElement(descriptionB.getName()));
}
- public void testSingleByObject() {
+ @Test public void testSingleByObject() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB));
assertSame(descriptionA, scope.getSingleElement(annotationA));
assertSame(descriptionB, scope.getSingleElement(annotationB));
}
- public void testSingleByObjectWithDuplicate_01() {
+ @Test public void testSingleByObjectWithDuplicate_01() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB_as_A, descriptionB));
assertSame(descriptionA, scope.getSingleElement(annotationA));
assertSame(descriptionB, scope.getSingleElement(annotationB));
}
- public void testSingleByObjectWithDuplicate_02() {
+ @Test public void testSingleByObjectWithDuplicate_02() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionB));
assertNull(scope.getSingleElement(annotationA));
assertSame(descriptionB_as_A, scope.getSingleElement(annotationB));
}
- public void testSingleByObjectWithDuplicate_03() {
+ @Test public void testSingleByObjectWithDuplicate_03() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionA_aliased));
assertSame(descriptionA_aliased, scope.getSingleElement(annotationA));
assertSame(descriptionB_as_A, scope.getSingleElement(annotationB));
}
- public void testByName() {
+ @Test public void testByName() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB));
assertEqualElements(Collections.singleton(descriptionA), scope.getElements(descriptionA.getName()));
assertEqualElements(Collections.singleton(descriptionB), scope.getElements(descriptionB.getName()));
}
- public void testByNameWithDuplicate_01() {
+ @Test public void testByNameWithDuplicate_01() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB_as_A, descriptionB));
assertEqualElements(ImmutableList.of(descriptionA, descriptionB_as_A), scope.getElements(descriptionA.getName()));
assertEqualElements(Collections.singleton(descriptionB), scope.getElements(descriptionB.getName()));
}
- public void testByNameWithDuplicate_02() {
+ @Test public void testByNameWithDuplicate_02() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionB));
assertEqualElements(ImmutableList.of(descriptionB_as_A, descriptionA), scope.getElements(descriptionA.getName()));
assertEqualElements(Collections.singleton(descriptionB), scope.getElements(descriptionB.getName()));
}
- public void testByObject() {
+ @Test public void testByObject() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB));
assertEqualElements(ImmutableList.of(descriptionA), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(descriptionB), scope.getElements(annotationB));
}
- public void testByObjectWithDuplicate_01() {
+ @Test public void testByObjectWithDuplicate_01() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB_as_A, descriptionB));
assertEqualElements(ImmutableList.of(descriptionA), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(descriptionB), scope.getElements(annotationB));
}
- public void testByObjectWithDuplicate_02() {
+ @Test public void testByObjectWithDuplicate_02() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionB));
assertEqualElements(ImmutableList.of(), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(descriptionB_as_A, descriptionB), scope.getElements(annotationB));
}
- public void testByObjectWithDuplicate_03() {
+ @Test public void testByObjectWithDuplicate_03() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionA_aliased));
assertEqualElements(ImmutableList.of(descriptionA_aliased), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(descriptionB_as_A), scope.getElements(annotationB));
}
- public void testByObjectWithDuplicate_04() {
+ @Test public void testByObjectWithDuplicate_04() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA_aliased, descriptionB_as_A, descriptionA));
assertEqualElements(ImmutableList.of(descriptionA_aliased), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(descriptionB_as_A), scope.getElements(annotationB));
}
- public void testByObjectWithDuplicate_05() {
+ @Test public void testByObjectWithDuplicate_05() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA_aliased, descriptionA, descriptionB_as_A));
assertEqualElements(ImmutableList.of(descriptionA_aliased, descriptionA), scope.getElements(annotationA));
assertEqualElements(ImmutableList.of(), scope.getElements(annotationB));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/Bug318343Test.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/Bug318343Test.java
index 3f0c13071..b7bebfd9b 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/Bug318343Test.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/Bug318343Test.java
@@ -9,13 +9,14 @@ package org.eclipse.xtext.scoping.impl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguagePackage;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
/**
* @author Holger Schill - Initial contribution and API
@@ -27,7 +28,7 @@ public class Bug318343Test extends AbstractXtextTests {
private Resource resource2;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(LangATestLanguageStandaloneSetup.class);
globalScopeProvider = get(DefaultGlobalScopeProvider.class);
@@ -38,17 +39,17 @@ public class Bug318343Test extends AbstractXtextTests {
resource2.load(new StringInputStream("type t2"),null);
}
- public void testScopeContainsT1() throws Exception {
+ @Test public void testScopeContainsT1() throws Exception {
IScope scope = globalScopeProvider.getScope(resource2, LangATestLanguagePackage.Literals.TYPE__EXTENDS);
assertNotNull(scope.getSingleElement(QualifiedName.create("t1")));
}
- public void testScopeContainsNotT2() throws Exception {
+ @Test public void testScopeContainsNotT2() throws Exception {
IScope scope = globalScopeProvider.getScope(resource2, LangATestLanguagePackage.Literals.TYPE__EXTENDS);
assertNull(scope.getSingleElement(QualifiedName.create("t2")));
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
resource1 = null;
resource2 = null;
globalScopeProvider = null;
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/DeclarativeScopeProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/DeclarativeScopeProviderTest.java
index d7bbb9cde..fb485a8dd 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/DeclarativeScopeProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/DeclarativeScopeProviderTest.java
@@ -14,9 +14,10 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
@@ -24,7 +25,7 @@ import org.eclipse.xtext.scoping.IScope;
*/
public class DeclarativeScopeProviderTest extends AbstractXtextTests {
@SuppressWarnings("unused")
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
AbstractDeclarativeScopeProvider provider = new AbstractDeclarativeScopeProvider() {
private IScope scope_EClass(EClass clazz, EReference ref) {
@@ -37,7 +38,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testNested() throws Exception {
+ @Test public void testNested() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
@@ -57,7 +58,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testPolymorphic() throws Exception {
+ @Test public void testPolymorphic() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope c = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
@@ -82,7 +83,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testScopeByType() throws Exception {
+ @Test public void testScopeByType() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope c = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
@@ -107,7 +108,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testScopeByReference() throws Exception {
+ @Test public void testScopeByReference() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope c = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
@@ -131,7 +132,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testScopeByType2() throws Exception {
+ @Test public void testScopeByType2() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope c = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
@@ -155,7 +156,7 @@ public class DeclarativeScopeProviderTest extends AbstractXtextTests {
}
@SuppressWarnings("unused")
- public void testScopeByReference2() throws Exception {
+ @Test public void testScopeByReference2() throws Exception {
final IScope a = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope b = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
final IScope c = new SimpleScope(IScope.NULLSCOPE, Collections. emptySet());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportNormalizerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportNormalizerTest.java
index 38d294a76..0277bf760 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportNormalizerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportNormalizerTest.java
@@ -7,16 +7,16 @@
*******************************************************************************/
package org.eclipse.xtext.scoping.impl;
-import junit.framework.TestCase;
-
import org.eclipse.xtext.naming.QualifiedName;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class ImportNormalizerTest extends TestCase {
+public class ImportNormalizerTest extends Assert {
- public void testNull() throws Exception {
+ @Test public void testNull() throws Exception {
try {
new ImportNormalizer(null, true, false);
fail("Expected exception");
@@ -25,7 +25,7 @@ public class ImportNormalizerTest extends TestCase {
}
}
- public void testResolve() throws Exception {
+ @Test public void testResolve() throws Exception {
QualifiedName xtextRelativeName = QualifiedName.create("xtext");
QualifiedName ytextRelativeName = QualifiedName.create("ytext");
QualifiedName xytextRelativeName = QualifiedName.create("xtext","ytext");
@@ -45,7 +45,7 @@ public class ImportNormalizerTest extends TestCase {
assertEquals(xtextRelativeName, xtextImportNormalizer.resolve(xtextRelativeName));
}
- public void testResolveIgnoreCase() throws Exception {
+ @Test public void testResolveIgnoreCase() throws Exception {
QualifiedName xtextRelativeName = QualifiedName.create("xtext");
QualifiedName ytextRelativeName = QualifiedName.create("ytext");
QualifiedName xytextRelativeName = QualifiedName.create("xtext","ytext");
@@ -65,7 +65,7 @@ public class ImportNormalizerTest extends TestCase {
assertEquals(xtextRelativeName, xtextImportNormalizer.resolve(xtextRelativeName));
}
- public void testDeresolve() throws Exception {
+ @Test public void testDeresolve() throws Exception {
QualifiedName namespace = QualifiedName.create("org", "eclipse", "xtext");
QualifiedName xtextFQN = namespace.append("Xtext");
QualifiedName ytextFQN = namespace.skipLast(1).append("ytext");
@@ -87,7 +87,7 @@ public class ImportNormalizerTest extends TestCase {
assertEquals(QualifiedName.create("ytext"), wildCardImportNormalizer.deresolve(xytextFQN));
}
- public void testDeresolveIgnoreCase() throws Exception {
+ @Test public void testDeresolveIgnoreCase() throws Exception {
QualifiedName namespace = QualifiedName.create("org", "eclipse", "xtext");
QualifiedName xtextFQN = namespace.append("Xtext");
QualifiedName ytextFQN = namespace.skipLast(1).append("ytext");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportScopeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportScopeTest.java
index e28e3bf4e..73db09f53 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportScopeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportScopeTest.java
@@ -27,13 +27,13 @@ import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.ISelectable;
import org.eclipse.xtext.resource.impl.AliasedEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
-
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
*/
-public class ImportScopeTest extends TestCase {
+public class ImportScopeTest extends Assert {
/**
* subclassed just to make protected members accessible from within this OSGi bundle
@@ -61,7 +61,7 @@ public class ImportScopeTest extends TestCase {
}
- public void testGetAllWithDuplicates() throws Exception {
+ @Test public void testGetAllWithDuplicates() throws Exception {
final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EANNOTATION);
final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EATTRIBUTE);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -70,7 +70,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(4,size(scope.getAllElements()));
}
- public void testImports_01() throws Exception {
+ @Test public void testImports_01() throws Exception {
final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EANNOTATION);
final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -87,7 +87,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testRelativeImports_01() throws Exception {
+ @Test public void testRelativeImports_01() throws Exception {
final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo","bar"), EcorePackage.Literals.EANNOTATION);
final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE);
IScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -109,7 +109,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testDuplicatesNotVisible_01() throws Exception {
+ @Test public void testDuplicatesNotVisible_01() throws Exception {
final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION);
final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -123,7 +123,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testDuplicatesNotVisible_01_IgnoreCase() throws Exception {
+ @Test public void testDuplicatesNotVisible_01_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","Foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -137,7 +137,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testDuplicatesNotVisible_02_IgnoreCase() throws Exception {
+ @Test public void testDuplicatesNotVisible_02_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","Foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -151,7 +151,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testDuplicatesNotVisible_02() throws Exception {
+ @Test public void testDuplicatesNotVisible_02() throws Exception {
final IEObjectDescription desc1 = EObjectDescription.create(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION);
final IEObjectDescription desc2 = EObjectDescription.create(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -164,7 +164,7 @@ public class ImportScopeTest extends TestCase {
assertNotNull(scope.getSingleElement(QualifiedName.create("de","foo")));
}
- public void testDuplicatesNotVisible_03_IgnoreCase() throws Exception {
+ @Test public void testDuplicatesNotVisible_03_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -177,7 +177,7 @@ public class ImportScopeTest extends TestCase {
assertNotNull(scope.getSingleElement(QualifiedName.create("de","Foo")));
}
- public void testDuplicatesNotVisible_04_IgnoreCase() throws Exception {
+ @Test public void testDuplicatesNotVisible_04_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -190,7 +190,7 @@ public class ImportScopeTest extends TestCase {
assertNotNull(scope.getSingleElement(QualifiedName.create("de","Foo")));
}
- public void testDuplicatesNotVisible_05() throws Exception {
+ @Test public void testDuplicatesNotVisible_05() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com", "Foo"), EcorePackage.Literals.EANNOTATION, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1), false);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("com"), true, false);
@@ -203,7 +203,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testDuplicatesNotVisible_05_IgnoreCase() throws Exception {
+ @Test public void testDuplicatesNotVisible_05_IgnoreCase() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","Foo"), EcorePackage.Literals.EANNOTATION, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1), true);
ImportNormalizer n1 = new ImportNormalizer(QualifiedName.create("COM"), true, true);
@@ -216,7 +216,7 @@ public class ImportScopeTest extends TestCase {
assertFalse(iterator.hasNext());
}
- public void testMultipleElementsByName_00() throws Exception {
+ @Test public void testMultipleElementsByName_00() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -229,7 +229,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(2,size(elements));
}
- public void testMultipleElementsByName_01() throws Exception {
+ @Test public void testMultipleElementsByName_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -242,7 +242,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(2,size(elements));
}
- public void testGetAllLocalElements_00() throws Exception {
+ @Test public void testGetAllLocalElements_00() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -254,7 +254,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(2,size(elements));
}
- public void testGetAllLocalElements_01() throws Exception {
+ @Test public void testGetAllLocalElements_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -266,7 +266,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(2,size(elements));
}
- public void testAllAliasedElements_00() throws Exception {
+ @Test public void testAllAliasedElements_00() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList newArrayList = newArrayList(desc1,desc2);
@@ -280,7 +280,7 @@ public class ImportScopeTest extends TestCase {
assertSame(desc2,((AliasedEObjectDescription)iterator.next()).getAliasedEObjectDescription());
}
- public void testAllAliasedElements_01() throws Exception {
+ @Test public void testAllAliasedElements_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList newArrayList = newArrayList(desc1,desc2);
@@ -294,7 +294,7 @@ public class ImportScopeTest extends TestCase {
assertSame(desc2,((AliasedEObjectDescription)iterator.next()).getAliasedEObjectDescription());
}
- public void testAllAliasedElements_02() throws Exception {
+ @Test public void testAllAliasedElements_02() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList newArrayList = newArrayList(desc1,desc2);
@@ -305,7 +305,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(0,size(elements));
}
- public void testAllAliasedElements_03() throws Exception {
+ @Test public void testAllAliasedElements_03() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
final ArrayList newArrayList = newArrayList(desc1,desc2);
@@ -316,7 +316,7 @@ public class ImportScopeTest extends TestCase {
assertEquals(0,size(elements));
}
- public void testAllAliasedElements_04() throws Exception {
+ @Test public void testAllAliasedElements_04() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","bar"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc3 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
@@ -329,7 +329,7 @@ public class ImportScopeTest extends TestCase {
assertSame(desc2,((AliasedEObjectDescription)elements.iterator().next()).getAliasedEObjectDescription());
}
- public void testAllAliasedElements_05() throws Exception {
+ @Test public void testAllAliasedElements_05() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("com","bar"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc3 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
@@ -342,7 +342,7 @@ public class ImportScopeTest extends TestCase {
assertSame(desc2,((AliasedEObjectDescription)elements.iterator().next()).getAliasedEObjectDescription());
}
- public void testGetByEObject_00() throws Exception {
+ @Test public void testGetByEObject_00() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -354,7 +354,7 @@ public class ImportScopeTest extends TestCase {
assertEquals("com.foo",iterable.iterator().next().getName().toString());
}
- public void testGetByEObject_01() throws Exception {
+ @Test public void testGetByEObject_01() throws Exception {
final IEObjectDescription desc1 = new EObjectDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new EObjectDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
@@ -384,7 +384,7 @@ public class ImportScopeTest extends TestCase {
}
}
- public void testGetByEObject_02() throws Exception {
+ @Test public void testGetByEObject_02() throws Exception {
final IEObjectDescription desc1 = new ProxyReturningDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new ProxyReturningDescription(QualifiedName.create("de","foo"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), false);
@@ -394,7 +394,7 @@ public class ImportScopeTest extends TestCase {
assertEquals("foo", description.getName().toString());
}
- public void testGetByEObject_03() throws Exception {
+ @Test public void testGetByEObject_03() throws Exception {
final IEObjectDescription desc1 = new ProxyReturningDescription(QualifiedName.create("com","foo"), EcorePackage.Literals.EANNOTATION, null);
final IEObjectDescription desc2 = new ProxyReturningDescription(QualifiedName.create("de","bar"), EcorePackage.Literals.EATTRIBUTE, null);
SimpleScope outer = new SimpleScope(newArrayList(desc1,desc2), true);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProviderTest.java
index 2b25c6a9b..a41a2fc88 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ImportedNamespaceAwareLocalScopeProviderTest.java
@@ -24,17 +24,17 @@ import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
import org.eclipse.xtext.index.indexTestLanguage.Datatype;
import org.eclipse.xtext.index.indexTestLanguage.Entity;
import org.eclipse.xtext.index.indexTestLanguage.IndexTestLanguagePackage;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
import org.eclipse.xtext.naming.IQualifiedNameConverter;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.IResourceDescription;
+import org.eclipse.xtext.resource.IResourceDescription.Manager;
import org.eclipse.xtext.resource.IResourceServiceProvider;
import org.eclipse.xtext.resource.ResourceSetReferencingResourceSetImpl;
import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.resource.IResourceDescription.Manager;
import org.eclipse.xtext.resource.impl.DefaultResourceDescription;
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager;
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy;
@@ -42,6 +42,7 @@ import org.eclipse.xtext.resource.impl.DefaultResourceServiceProvider;
import org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@@ -94,7 +95,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
scopeProvider = new ImportedNamespaceAwareLocalScopeProvider(globalScopeProvider, nameProvider, nameConverter, caseInsensitivityHelper);
}
- public void testImports() throws Exception {
+ @Test public void testImports() throws Exception {
XtextResource resource = getResource(new StringInputStream("import foo.bar.* "), URI
.createURI("import.indextestlanguage"));
resource.getResourceSet().createResource(URI.createURI("foo.indextestlanguage")).load(
@@ -117,7 +118,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertTrue(names.contains(nameConverter.toQualifiedName("foo.bar.String")));
}
- public void testRelativeContext() throws Exception {
+ @Test public void testRelativeContext() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"stuff { "
+ " baz { "
@@ -138,7 +139,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("stuff.baz.String")));
}
- public void testRelativePath() throws Exception {
+ @Test public void testRelativePath() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"stuff { "
+ " import baz.*"
@@ -162,7 +163,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("stuff.baz.String")));
}
- public void testReexports2() throws Exception {
+ @Test public void testReexports2() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"A { "
+ " B { "
@@ -187,7 +188,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("A.B.D")));
}
- public void testLocalElementsNotFromIndex() throws Exception {
+ @Test public void testLocalElementsNotFromIndex() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"A { "
+ " B { "
@@ -207,7 +208,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("A.B.D")));
}
- public void testImportsWithoutWildcard() throws Exception {
+ @Test public void testImportsWithoutWildcard() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"foo { "
+ " import bar.Bar"
@@ -231,7 +232,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("Bar")));
}
- public void testDuplicateImportsAreIgnored() throws Exception {
+ @Test public void testDuplicateImportsAreIgnored() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"foo { "
+ " entity Foo {}"
@@ -268,7 +269,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
}));
}
- public void testUnambiguousImportAreShadowed_00() throws Exception {
+ @Test public void testUnambiguousImportAreShadowed_00() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"foo { "
+ " entity Foo {}"
@@ -304,7 +305,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
}
}));
}
- public void testUnambiguousImportAreShadowed_01() throws Exception {
+ @Test public void testUnambiguousImportAreShadowed_01() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"foo { "
+ " entity Foo {}"
@@ -340,7 +341,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
}
}));
}
- public void testUnambiguousImportAreShadowed_02() throws Exception {
+ @Test public void testUnambiguousImportAreShadowed_02() throws Exception {
final XtextResource resource = getResource(new StringInputStream(
"foo { "
+ " entity Foo {}"
@@ -377,7 +378,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
}));
}
- public void testMultipleFiles() throws Exception {
+ @Test public void testMultipleFiles() throws Exception {
ResourceSetImpl rs = new ResourceSetImpl();
final Resource res1 = rs.createResource(URI.createURI("file1.indextestlanguage"));
Resource res2 = rs.createResource(URI.createURI("file2.indextestlanguage"));
@@ -397,7 +398,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("Bar")));
}
- public void testResourceSetReferencingResourceSet() throws Exception {
+ @Test public void testResourceSetReferencingResourceSet() throws Exception {
ResourceSetReferencingResourceSetImpl rs = new ResourceSetReferencingResourceSetImpl();
Resource res = rs.createResource(URI.createURI("file2.indextestlanguage"));
res.load(new StringInputStream(
@@ -428,7 +429,7 @@ public class ImportedNamespaceAwareLocalScopeProviderTest extends AbstractXtextT
assertNotNull(scope.getSingleElement(nameConverter.toQualifiedName("bar.Bar")));
}
- public void testResourceSetReferencingResourceSet2() throws Exception {
+ @Test public void testResourceSetReferencingResourceSet2() throws Exception {
ResourceSetReferencingResourceSetImpl rs = new ResourceSetReferencingResourceSetImpl();
Resource res = rs.createResource(URI.createURI("file2.indextestlanguage"));
res.load(new StringInputStream("bar {" + " entity Bar{}" + "}"), null);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/MapBasedScopeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/MapBasedScopeTest.java
index d93627317..db4ac5840 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/MapBasedScopeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/MapBasedScopeTest.java
@@ -11,6 +11,7 @@ import java.util.Collections;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
+import org.junit.Test;
import com.google.common.collect.ImmutableList;
@@ -25,14 +26,14 @@ public class MapBasedScopeTest extends AbstractScopeTest {
}
@Override
- public void testByNameWithDuplicate_01() {
+ @Test public void testByNameWithDuplicate_01() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionA, descriptionB_as_A, descriptionB));
assertEqualElements(ImmutableList.of(descriptionA), scope.getElements(descriptionA.getName()));
assertEqualElements(Collections.singleton(descriptionB), scope.getElements(descriptionB.getName()));
}
@Override
- public void testByNameWithDuplicate_02() {
+ @Test public void testByNameWithDuplicate_02() {
IScope scope = createScope(IScope.NULLSCOPE, ImmutableList.of(descriptionB_as_A, descriptionA, descriptionB));
assertEqualElements(ImmutableList.of(descriptionB_as_A), scope.getElements(descriptionA.getName()));
assertEqualElements(Collections.singleton(descriptionB), scope.getElements(descriptionB.getName()));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ProfilingTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ProfilingTest.java
index b5539e695..f8e282e14 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ProfilingTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ProfilingTest.java
@@ -13,13 +13,14 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.xtext.index.IndexTestLanguageStandaloneSetup;
import org.eclipse.xtext.index.indexTestLanguage.Namespace;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.IResourceDescription.Manager;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.util.StopWatch;
import org.eclipse.xtext.util.StringInputStream;
+import org.junit.Test;
import com.google.common.collect.Sets;
import com.google.inject.Guice;
@@ -44,7 +45,7 @@ public class ProfilingTest extends AbstractXtextTests {
}
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
with(new IndexTestLanguageStandaloneSetup(){
@Override
public Injector createInjector() {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ScopeTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ScopeTest.java
index 8c270ebf9..829b028d0 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ScopeTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/ScopeTest.java
@@ -16,17 +16,17 @@ import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.collect.Iterables;
-import junit.framework.TestCase;
-
/**
* @author Sven Efftinge - Initial contribution and API
*/
-public class ScopeTest extends TestCase {
+public class ScopeTest extends Assert {
- public void testShadowing() throws Exception {
+ @Test public void testShadowing() throws Exception {
IEObjectDescription a = EObjectDescription.create(QualifiedName.create("foo"),
EcorePackage.Literals.EANNOTATION);
IEObjectDescription b = EObjectDescription
@@ -38,7 +38,7 @@ public class ScopeTest extends TestCase {
assertNull(inner.getSingleElement(EcorePackage.Literals.EANNOTATION));
}
- public void testLaziness() throws Exception {
+ @Test public void testLaziness() throws Exception {
LazinessTestScope c = new LazinessTestScope("c");
LazinessTestScope b = new LazinessTestScope("b", c);
LazinessTestScope a = new LazinessTestScope("a", b);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/SimpleNameScopeProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/SimpleNameScopeProviderTest.java
index cfeb843e8..943e7bc1d 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/SimpleNameScopeProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/scoping/impl/SimpleNameScopeProviderTest.java
@@ -12,12 +12,13 @@ import java.util.HashSet;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.ImportUriTestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.importedURI.ImportedURIPackage;
import org.eclipse.xtext.linking.importedURI.Main;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
+import org.junit.Test;
import com.google.common.collect.Sets;
@@ -27,12 +28,12 @@ import com.google.common.collect.Sets;
*/
public class SimpleNameScopeProviderTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ImportUriTestLanguageStandaloneSetup.class);
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -41,12 +42,12 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("bar.importuritestlanguage", "type bar");
Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=266879
- public void testRelativeScope() throws Exception {
+ @Test public void testRelativeScope() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -55,15 +56,15 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("testfile://my/folder/bar.importuritestlanguage", "type bar type bar2 extends bar");
Resource resource = rs.getResource(URI.createURI("testfile://my/folder/foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
- assertWithXtend("'bar2'", "types.first().extends.extends.name", resource.getContents().get(0));
- assertWithXtend("'bar'", "types.first().extends.extends.extends.name", resource.getContents().get(0));
- assertWithXtend("null", "types.first().extends.extends.extends.extends", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
+ assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
+ assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
+ assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=266879
- public void testRelativeScopeWithPath() throws Exception {
+ @Test public void testRelativeScopeWithPath() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -72,14 +73,14 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("testfile://my/folder/bar.importuritestlanguage", "type bar type bar2 extends bar");
Resource resource = rs.getResource(URI.createURI("testfile://my/folder/foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
- assertWithXtend("'bar2'", "types.first().extends.extends.name", resource.getContents().get(0));
- assertWithXtend("'bar'", "types.first().extends.extends.extends.name", resource.getContents().get(0));
- assertWithXtend("null", "types.first().extends.extends.extends.extends", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
+ assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
+ assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
+ assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
- public void testScopeFileName() throws Exception {
+ @Test public void testScopeFileName() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -88,14 +89,14 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("bar.importuritestlanguage", "type bar type bar2 extends bar");
Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
- assertWithXtend("'bar2'", "types.first().extends.extends.name", resource.getContents().get(0));
- assertWithXtend("'bar'", "types.first().extends.extends.extends.name", resource.getContents().get(0));
- assertWithXtend("null", "types.first().extends.extends.extends.extends", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
+ assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
+ assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
+ assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
- public void testUnresolvableImport() throws Exception {
+ @Test public void testUnresolvableImport() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -107,7 +108,7 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
assertNotNull(resource);
}
- public void testCircularImport() throws Exception {
+ @Test public void testCircularImport() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -116,16 +117,16 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("bar.importuritestlanguage", "import 'foo.importuritestlanguage' type bar extends foo");
Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
- assertWithXtend("'foo'", "types.first().extends.extends.name", resource.getContents().get(0));
- assertWithXtend("true", "types.first().extends.extends == types.first()", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
+ assertEquals("foo", main.getTypes().get(0).getExtends().getExtends().getName());
+ assertSame(main.getTypes().get(0).getExtends().getExtends(), main.getTypes().get(0));
}
/**
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=261630
*/
- public void testBug261630_duplicateImports() throws Exception {
+ @Test public void testBug261630_duplicateImports() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
@@ -134,14 +135,14 @@ public class SimpleNameScopeProviderTest extends AbstractXtextTests {
models.addModel("bar.importuritestlanguage", "type bar type bar2 extends bar");
Resource resource = rs.getResource(URI.createURI("foo.importuritestlanguage"), true);
-
- assertWithXtend("'bar'", "types.first().extends.name", resource.getContents().get(0));
- assertWithXtend("'bar2'", "types.first().extends.extends.name", resource.getContents().get(0));
- assertWithXtend("'bar'", "types.first().extends.extends.extends.name", resource.getContents().get(0));
- assertWithXtend("null", "types.first().extends.extends.extends.extends", resource.getContents().get(0));
+ Main main = (Main) resource.getContents().get(0);
+ assertEquals("bar", main.getTypes().get(0).getExtends().getName());
+ assertEquals("bar2", main.getTypes().get(0).getExtends().getExtends().getName());
+ assertEquals("bar", main.getTypes().get(0).getExtends().getExtends().getExtends().getName());
+ assertNull(main.getTypes().get(0).getExtends().getExtends().getExtends().getExtends());
}
- public void testGetAllContents() throws Exception {
+ @Test public void testGetAllContents() throws Exception {
SyntheticModelAwareURIConverter models = new SyntheticModelAwareURIConverter();
ResourceSetImpl rs = new ResourceSetImpl();
rs.setURIConverter(models);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AbstractSemanticSequencerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AbstractSemanticSequencerTest.java
index 153c6803a..f07381dff 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AbstractSemanticSequencerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AbstractSemanticSequencerTest.java
@@ -8,12 +8,13 @@
package org.eclipse.xtext.serializer;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.serializer.DebugSequenceAcceptor;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.serializer.DebugSequenceAcceptor;
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.NodeModelSemanticSequencer;
import org.eclipse.xtext.serializer.serializer.AbstractSequencerTestLanguageSemanticSequencer;
+import org.junit.Test;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -24,7 +25,7 @@ import com.google.inject.Provider;
public abstract class AbstractSemanticSequencerTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SequencerTestLanguageStandaloneSetup.class);
getInjector().injectMembers(this);
@@ -78,7 +79,7 @@ public abstract class AbstractSemanticSequencerTest extends AbstractXtextTests {
assertEquals(expected.toString(), generatedActual.toString());
}
- // public void testXtext() throws Exception {
+ // @Test public void testXtext() throws Exception {
// with(XtextStandaloneSetup.class);
// EObject model = getGrammarAccess().getGrammar();
// // System.out.println(EmfFormatter.objToStr(model));
@@ -97,333 +98,333 @@ public abstract class AbstractSemanticSequencerTest extends AbstractXtextTests {
// assertNotNull(actual);
// }
- public void testSimpleGroup() throws Exception {
+ @Test public void testSimpleGroup() throws Exception {
testSequence("#1 a b");
}
- public void testSimpleAlternative1() throws Exception {
+ @Test public void testSimpleAlternative1() throws Exception {
testSequence("#2 kw2 a");
}
- public void testSimpleAlternative2() throws Exception {
+ @Test public void testSimpleAlternative2() throws Exception {
testSequence("#2 kw2 a");
}
- public void testSimpleMultiplicities1() throws Exception {
+ @Test public void testSimpleMultiplicities1() throws Exception {
testSequence("#3 a kw1 b kw2 c d kw3 e f");
}
- public void testSimpleMultiplicities2() throws Exception {
+ @Test public void testSimpleMultiplicities2() throws Exception {
testSequence("#3 a kw1 kw2 c kw3 e");
}
- public void testSimpleMultiplicities3() throws Exception {
+ @Test public void testSimpleMultiplicities3() throws Exception {
testSequence("#3 a kw1 kw2 c kw3");
}
- public void testGroupMultiplicities1() throws Exception {
+ @Test public void testGroupMultiplicities1() throws Exception {
testSequence("#4 a kw1 b c kw2 d e f g kw3 h i j k");
}
- public void testGroupMultiplicities2() throws Exception {
+ @Test public void testGroupMultiplicities2() throws Exception {
testSequence("#4 a kw1 b c kw2 d e kw3 h i");
}
- public void testGroupMultiplicities3() throws Exception {
+ @Test public void testGroupMultiplicities3() throws Exception {
testSequence("#4 a kw1 b c kw2 d e kw3");
}
- public void testAlternativeMultiplicities1() throws Exception {
+ @Test public void testAlternativeMultiplicities1() throws Exception {
testSequence("#5 a kw2 b c kw3 d kw3 e kw4 g h kw5 i kw5 j");
}
- public void testAlternativeMultiplicities2() throws Exception {
+ @Test public void testAlternativeMultiplicities2() throws Exception {
testSequence("#5 kw1 a kw2 b kw4 g");
}
- public void testAlternativeMultiplicities3() throws Exception {
+ @Test public void testAlternativeMultiplicities3() throws Exception {
testSequence("#5 kw1 a kw2 kw3 b kw4 kw5 g");
}
- public void testAlternativeMultiplicities4() throws Exception {
+ @Test public void testAlternativeMultiplicities4() throws Exception {
testSequence("#5 kw1 a kw2 kw3 b kw4");
}
- public void testList1a() throws Exception {
+ @Test public void testList1a() throws Exception {
testSequence("#6 a, b, c, d, e");
}
- public void testList1b() throws Exception {
+ @Test public void testList1b() throws Exception {
testSequence("#6 a, b");
}
- public void testList1c() throws Exception {
+ @Test public void testList1c() throws Exception {
testSequence("#6 a");
}
- public void testList2a() throws Exception {
+ @Test public void testList2a() throws Exception {
testSequence("#7 a, b, c");
}
- public void testList2b() throws Exception {
+ @Test public void testList2b() throws Exception {
testSequence("#7 a, b");
}
- public void testList2c() throws Exception {
+ @Test public void testList2c() throws Exception {
testSequence("#7 a");
}
- public void testList2d() throws Exception {
+ @Test public void testList2d() throws Exception {
testSequence("#7");
}
- public void testSingleKeyword1() throws Exception {
+ @Test public void testSingleKeyword1() throws Exception {
testSequence("#10 kw1");
}
- public void testSingleKeyword2() throws Exception {
+ @Test public void testSingleKeyword2() throws Exception {
testSequence("#10 kw2");
}
- public void testSingleKeyword3() throws Exception {
+ @Test public void testSingleKeyword3() throws Exception {
testSequence("#10 kw3");
}
- public void testSingleKeyword1OrID() throws Exception {
+ @Test public void testSingleKeyword1OrID() throws Exception {
testSequence("#11 kw1");
}
- public void testSingleKeywordOrID2() throws Exception {
+ @Test public void testSingleKeywordOrID2() throws Exception {
testSequence("#11 kw2");
}
- public void testSingleKeywordOrID3() throws Exception {
+ @Test public void testSingleKeywordOrID3() throws Exception {
testSequence("#11 kw3");
}
- public void testSingleKeywordOrID4() throws Exception {
+ @Test public void testSingleKeywordOrID4() throws Exception {
testSequence("#11 foo");
}
- public void testSingleTerminals1() throws Exception {
+ @Test public void testSingleTerminals1() throws Exception {
testSequence("#12 $1foo");
}
- public void testSingleTerminals2() throws Exception {
+ @Test public void testSingleTerminals2() throws Exception {
testSequence("#12 $2foo");
}
- public void testSingleEnum1() throws Exception {
+ @Test public void testSingleEnum1() throws Exception {
testSequence("#13 kw1");
}
- public void testSingleEnum2() throws Exception {
+ @Test public void testSingleEnum2() throws Exception {
testSequence("#13 kw1");
}
- public void testSingleEnum3() throws Exception {
+ @Test public void testSingleEnum3() throws Exception {
testSequence("#13 kw1");
}
- public void testSingleCrossReference1() throws Exception {
+ @Test public void testSingleCrossReference1() throws Exception {
testSequence("#14 $1foo $1foo");
}
- public void testSingleCrossReference2() throws Exception {
+ @Test public void testSingleCrossReference2() throws Exception {
testSequence("#14 $2foo $2foo");
}
- public void testSingleCrossReference3() throws Exception {
+ @Test public void testSingleCrossReference3() throws Exception {
testSequence("#14 $3foo $3foo");
}
- public void testSingleContainmentReference1() throws Exception {
+ @Test public void testSingleContainmentReference1() throws Exception {
testSequence("#15 kw1");
}
- public void testSingleContainmentReference2() throws Exception {
+ @Test public void testSingleContainmentReference2() throws Exception {
testSequence("#15 kw2");
}
- public void testSingleContainmentReference3() throws Exception {
+ @Test public void testSingleContainmentReference3() throws Exception {
testSequence("#15 kw3");
}
// TODO: test multiple keywords
- // public void testList3a() throws Exception {
+ // @Test public void testList3a() throws Exception {
// testSequence("#8 a, b, c");
// }
//
- // public void testList3b() throws Exception {
+ // @Test public void testList3b() throws Exception {
// testSequence("#8 a");
// }
//
- // public void testList3c() throws Exception {
+ // @Test public void testList3c() throws Exception {
// testSequence("#8 kw3 a");
// }
- public void testDependentAlternative1_a() throws Exception {
+ @Test public void testDependentAlternative1_a() throws Exception {
testSequence("#19 foo1");
}
- public void testDependentAlternative1_b() throws Exception {
+ @Test public void testDependentAlternative1_b() throws Exception {
testSequence("#19 foo kw1");
}
- public void testDependentAlternative2_a() throws Exception {
+ @Test public void testDependentAlternative2_a() throws Exception {
testSequence("#20 foo bar");
}
- public void testDependentAlternative2_b() throws Exception {
+ @Test public void testDependentAlternative2_b() throws Exception {
testSequence("#20 foo bar baz");
}
- public void testDependentAlternative2_c() throws Exception {
+ @Test public void testDependentAlternative2_c() throws Exception {
testSequence("#20 foo bar kw1");
}
- public void testDependentAlternative2_d() throws Exception {
+ @Test public void testDependentAlternative2_d() throws Exception {
testSequence("#20 foo kw1");
}
- public void testOptional1_a() throws Exception {
+ @Test public void testOptional1_a() throws Exception {
testSequence("#21 1 2 3");
}
- public void testOptional1_b() throws Exception {
+ @Test public void testOptional1_b() throws Exception {
testSequence("#21 0 0 1");
}
- public void testOptional1_c() throws Exception {
+ @Test public void testOptional1_c() throws Exception {
testSequence("#21 0 0 0");
}
- public void testOptional1_d() throws Exception {
+ @Test public void testOptional1_d() throws Exception {
testSequence("#21 0");
}
- public void testOptional1_e() throws Exception {
+ @Test public void testOptional1_e() throws Exception {
testSequence("#21 1");
}
- public void testUnorderedAlternative1() throws Exception {
+ @Test public void testUnorderedAlternative1() throws Exception {
testSequence("#23 1 a");
}
- public void testUnorderedAlternative2() throws Exception {
+ @Test public void testUnorderedAlternative2() throws Exception {
testSequence("#23 a 1");
}
- public void testUnorderedAlternative3() throws Exception {
+ @Test public void testUnorderedAlternative3() throws Exception {
testSequence("#23 kw1 a kw2 b");
}
- public void testUnorderedAlternative4() throws Exception {
+ @Test public void testUnorderedAlternative4() throws Exception {
testSequence("#23 kw2 b kw1 a");
}
- public void testUnorderedAlternative5() throws Exception {
+ @Test public void testUnorderedAlternative5() throws Exception {
testSequence("#23 1 a kw1 a kw2 b");
}
- public void testUnorderedAlternative6() throws Exception {
+ @Test public void testUnorderedAlternative6() throws Exception {
testSequence("#23 kw2 b kw1 a a 1");
}
- public void testUnorderedAlternative7() throws Exception {
+ @Test public void testUnorderedAlternative7() throws Exception {
testSequence("#23 kw2 b kw1 a a 1 c d 2 i 7 kw2 x kw1 x 8 g");
}
- public void testUnorderedGroup1() throws Exception {
+ @Test public void testUnorderedGroup1() throws Exception {
testSequence("#24 1 a kw1 a kw2 b");
}
- public void testUnorderedGroup2() throws Exception {
+ @Test public void testUnorderedGroup2() throws Exception {
testSequence("#24 1 a kw2 b kw1 a");
}
- public void testUnorderedGroup3() throws Exception {
+ @Test public void testUnorderedGroup3() throws Exception {
testSequence("#24 a 1 kw1 a kw2 b");
}
- public void testUnorderedGroup4() throws Exception {
+ @Test public void testUnorderedGroup4() throws Exception {
testSequence("#24 a 1 kw2 b kw1 a");
}
- public void testUnorderedGroup5() throws Exception {
+ @Test public void testUnorderedGroup5() throws Exception {
testSequence("#24 kw1 a kw2 b 1 a ");
}
- public void testUnorderedGroup6() throws Exception {
+ @Test public void testUnorderedGroup6() throws Exception {
testSequence("#24 kw2 b kw1 a 1 a");
}
- public void testUnorderedGroup7() throws Exception {
+ @Test public void testUnorderedGroup7() throws Exception {
testSequence("#24 kw1 a kw2 b a 1");
}
- public void testUnorderedGroup8() throws Exception {
+ @Test public void testUnorderedGroup8() throws Exception {
testSequence("#24 kw2 b kw1 a a 1");
}
- public void testUnorderedGroupOptional1() throws Exception {
+ @Test public void testUnorderedGroupOptional1() throws Exception {
testSequence("#25 kw1 a kw2 b kw3 c");
}
- public void testUnorderedGroupOptional2() throws Exception {
+ @Test public void testUnorderedGroupOptional2() throws Exception {
testSequence("#25 kw1 a kw2 b");
}
- public void testUnorderedGroupOptional3() throws Exception {
+ @Test public void testUnorderedGroupOptional3() throws Exception {
testSequence("#25 kw1 a kw3 c");
}
- public void testUnorderedGroupOptional4() throws Exception {
+ @Test public void testUnorderedGroupOptional4() throws Exception {
testSequence("#25 kw2 b kw3 c");
}
- public void testUnorderedGroupOptional5() throws Exception {
+ @Test public void testUnorderedGroupOptional5() throws Exception {
testSequence("#25 kw2 b kw1 a");
}
- public void testUnorderedGroupOptional6() throws Exception {
+ @Test public void testUnorderedGroupOptional6() throws Exception {
testSequence("#25 kw3 c kw1 a");
}
- public void testUnorderedGroupOptional7() throws Exception {
+ @Test public void testUnorderedGroupOptional7() throws Exception {
testSequence("#25 kw3 c kw2 b");
}
- public void testUnorderedGroupBoolean1() throws Exception {
+ @Test public void testUnorderedGroupBoolean1() throws Exception {
testSequence("#26 kw1 kw2");
}
- public void testUnorderedGroupBoolean2() throws Exception {
+ @Test public void testUnorderedGroupBoolean2() throws Exception {
testSequence("#26 kw2 kw1");
}
- public void testUnorderedGroupBoolean3() throws Exception {
+ @Test public void testUnorderedGroupBoolean3() throws Exception {
testSequence("#26 kw2 kw3");
}
- public void testUnorderedGroupBoolean4() throws Exception {
+ @Test public void testUnorderedGroupBoolean4() throws Exception {
testSequence("#26 kw3 kw2");
}
- public void testUnorderedGroupBoolean5() throws Exception {
+ @Test public void testUnorderedGroupBoolean5() throws Exception {
testSequence("#26 kw1 kw3");
}
- public void testUnorderedGroupBoolean6() throws Exception {
+ @Test public void testUnorderedGroupBoolean6() throws Exception {
testSequence("#26 kw3 kw1");
}
- public void testUnorderedGroupBoolean7() throws Exception {
+ @Test public void testUnorderedGroupBoolean7() throws Exception {
testSequence("#26 kw1 kw2 kw3");
}
- public void testUnorderedGroupBoolean8() throws Exception {
+ @Test public void testUnorderedGroupBoolean8() throws Exception {
testSequence("#26 kw3 kw2 kw1");
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AssignmentFinderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AssignmentFinderTest.java
index e667ede9f..63c1f8d73 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AssignmentFinderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/AssignmentFinderTest.java
@@ -12,8 +12,8 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.util.ParseHelper;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.util.ParseHelper;
import org.eclipse.xtext.serializer.assignmentFinderTest.ContainmentRef;
import org.eclipse.xtext.serializer.assignmentFinderTest.CrossRef;
import org.eclipse.xtext.serializer.assignmentFinderTest.EnumBool;
@@ -37,6 +37,7 @@ import org.eclipse.xtext.serializer.services.AssignmentFinderTestLanguageGrammar
import org.eclipse.xtext.serializer.services.AssignmentFinderTestLanguageGrammarAccess.MixedValueElements;
import org.eclipse.xtext.serializer.services.AssignmentFinderTestLanguageGrammarAccess.TerminalBoolElements;
import org.eclipse.xtext.serializer.services.AssignmentFinderTestLanguageGrammarAccess.TerminalValElements;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
@@ -48,7 +49,7 @@ import com.google.inject.Inject;
*/
public class AssignmentFinderTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(AssignmentFinderTestLanguageStandaloneSetup.class);
getInjector().injectMembers(this);
@@ -69,21 +70,21 @@ public class AssignmentFinderTest extends AbstractXtextTests {
return Joiner.on(", ").join(Iterables.transform(found, new GrammarElementTitleSwitch().showAssignments()));
}
- public void testKeywordVal1() throws Exception {
+ @Test public void testKeywordVal1() throws Exception {
KeywordValElements g = grammar.getKeywordValAccess();
KeywordVal model = parser.parse("#00 kw1").getKeywordVal();
String ass = findAssignments(model, model.getKw(), g.getKwKw1Keyword_0_0(), g.getKwKw2Keyword_1_0());
assertEquals("kw='kw1'", ass);
}
- public void testKeywordVal2() throws Exception {
+ @Test public void testKeywordVal2() throws Exception {
KeywordValElements g = grammar.getKeywordValAccess();
KeywordVal model = parser.parse("#00 kw2").getKeywordVal();
String ass = findAssignments(model, model.getKw(), g.getKwKw1Keyword_0_0(), g.getKwKw2Keyword_1_0());
assertEquals("kw='kw2'", ass);
}
- public void testTerminalVal1() throws Exception {
+ @Test public void testTerminalVal1() throws Exception {
TerminalValElements g = grammar.getTerminalValAccess();
TerminalVal model = parser.parse("#01 %BAR").getTerminalVal();
String ass = findAssignments(model, model.getTerm(), g.getTermTerminal1TerminalRuleCall_0_0(),
@@ -91,7 +92,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("term=Terminal1", ass);
}
- public void testTerminalVal2() throws Exception {
+ @Test public void testTerminalVal2() throws Exception {
TerminalValElements g = grammar.getTerminalValAccess();
TerminalVal model = parser.parse("#01 %bar").getTerminalVal();
String ass = findAssignments(model, model.getTerm(), g.getTermTerminal1TerminalRuleCall_0_0(),
@@ -99,7 +100,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("term=Terminal2", ass);
}
- public void testTerminalVal3() throws Exception {
+ @Test public void testTerminalVal3() throws Exception {
TerminalValElements g = grammar.getTerminalValAccess();
TerminalVal model = parser.parse("#01 %foo").getTerminalVal();
String ass = findAssignments(model, model.getTerm(), g.getTermTerminal1TerminalRuleCall_0_0(),
@@ -107,7 +108,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("term='%foo'", ass);
}
- public void testEnumVal1() throws Exception {
+ @Test public void testEnumVal1() throws Exception {
EnumValElements g = grammar.getEnumValAccess();
EnumVal model = parser.parse("#02 lit1").getEnumVal();
String ass = findAssignments(model, model.getEn(), g.getEnEnum1EnumRuleCall_0_0(),
@@ -115,7 +116,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("en=Enum1", ass);
}
- public void testEnumVal2() throws Exception {
+ @Test public void testEnumVal2() throws Exception {
EnumValElements g = grammar.getEnumValAccess();
EnumVal model = parser.parse("#02 lit2").getEnumVal();
String ass = findAssignments(model, model.getEn(), g.getEnEnum1EnumRuleCall_0_0(),
@@ -123,14 +124,14 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("en=Enum2", ass);
}
- public void testKeywordBool() throws Exception {
+ @Test public void testKeywordBool() throws Exception {
KeywordBoolElements g = grammar.getKeywordBoolAccess();
KeywordBool model = parser.parse("#03 kw1").getKeywordBool();
String ass = findAssignments(model, model.isKw(), g.getKwKw1Keyword_0_0(), g.getKwKw2Keyword_1_0());
assertEquals("kw?='kw1', kw?='kw2'", ass);
}
- public void testTerminalBool() throws Exception {
+ @Test public void testTerminalBool() throws Exception {
TerminalBoolElements g = grammar.getTerminalBoolAccess();
TerminalBool model = parser.parse("#04 %BAR").getTerminalBool();
String ass = findAssignments(model, model.isTerm(), g.getTermTerminal1TerminalRuleCall_0_0(),
@@ -138,7 +139,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("term?=Terminal1, term?=Terminal2, term?='%foo'", ass);
}
- public void testEnumBool() throws Exception {
+ @Test public void testEnumBool() throws Exception {
EnumBoolElements g = grammar.getEnumBoolAccess();
EnumBool model = parser.parse("#05 lit1").getEnumBool();
String ass = findAssignments(model, model.isEn(), g.getEnEnum1EnumRuleCall_0_0(),
@@ -146,7 +147,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("en?=Enum1, en?=Enum2", ass);
}
- public void testMixedBool1() throws Exception {
+ @Test public void testMixedBool1() throws Exception {
MixedBoolElements g = grammar.getMixedBoolAccess();
MixedBool model = parser.parse("#06 true").getMixedBool();
String ass = findAssignments(model, model.isVal(), g.getValKw1Keyword_0_0(),
@@ -154,7 +155,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("val?='kw1', val=Boolean", ass);
}
- public void testMixedBool2() throws Exception {
+ @Test public void testMixedBool2() throws Exception {
MixedBoolElements g = grammar.getMixedBoolAccess();
MixedBool model = parser.parse("#06 false").getMixedBool();
String ass = findAssignments(model, model.isVal(), g.getValKw1Keyword_0_0(),
@@ -162,7 +163,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("val=Boolean", ass);
}
- public void testMixedValue1() throws Exception {
+ @Test public void testMixedValue1() throws Exception {
MixedValueElements g = grammar.getMixedValueAccess();
MixedValue model = parser.parse("#07 lit1").getMixedValue();
String ass = findAssignments(model, model.getVal(), g.getValDatEnumParserRuleCall_1_0(),
@@ -170,7 +171,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("val=Enum1", ass);
}
- public void testMixedValue2() throws Exception {
+ @Test public void testMixedValue2() throws Exception {
MixedValueElements g = grammar.getMixedValueAccess();
MixedValue model = parser.parse("#07 lit3").getMixedValue();
String ass = findAssignments(model, model.getVal(), g.getValDatEnumParserRuleCall_1_0(),
@@ -178,7 +179,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("val=DatEnum", ass);
}
- public void testContainmentRef1() throws Exception {
+ @Test public void testContainmentRef1() throws Exception {
ContainmentRefElements g = grammar.getContainmentRefAccess();
ContainmentRef model = parser.parse("#08 kw1 foo").getContainmentRef();
String ass = findAssignments(model, model.getCtx(), g.getCtxContainmentRef1ParserRuleCall_0_0(),
@@ -186,7 +187,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("ctx=ContainmentRef1", ass);
}
- public void testContainmentRef2() throws Exception {
+ @Test public void testContainmentRef2() throws Exception {
ContainmentRefElements g = grammar.getContainmentRefAccess();
ContainmentRef model = parser.parse("#08 kw2 foo").getContainmentRef();
String ass = findAssignments(model, model.getCtx(), g.getCtxContainmentRef1ParserRuleCall_0_0(),
@@ -194,7 +195,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("ctx=ContainmentRef2", ass);
}
- public void testCrossRef1() throws Exception {
+ @Test public void testCrossRef1() throws Exception {
CrossRefElements g = grammar.getCrossRefAccess();
CrossRef model = parser.parse("#09 %BAR %BAR").getCrossRef();
String ass = findAssignments(model, model.getCrossRef(),
@@ -203,7 +204,7 @@ public class AssignmentFinderTest extends AbstractXtextTests {
assertEquals("crossRef=[CrossRef|Terminal1]", ass);
}
- public void testCrossRef2() throws Exception {
+ @Test public void testCrossRef2() throws Exception {
CrossRefElements g = grammar.getCrossRefAccess();
CrossRef model = parser.parse("#09 %bar %bar").getCrossRef();
String ass = findAssignments(model, model.getCrossRef(),
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextFinderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextFinderTest.java
index 3655a2c15..aa60560f0 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextFinderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextFinderTest.java
@@ -11,14 +11,15 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.util.ParseHelper;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.util.ParseHelper;
import org.eclipse.xtext.serializer.analysis.Context2NameFunction;
import org.eclipse.xtext.serializer.contextFinderTest.Model;
import org.eclipse.xtext.serializer.contextFinderTest.ParentRefTest1;
import org.eclipse.xtext.serializer.contextFinderTest.ParentRefTest2;
import org.eclipse.xtext.serializer.contextFinderTest.ParentRefTestChild;
import org.eclipse.xtext.serializer.sequencer.IContextFinder;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -29,7 +30,7 @@ import com.google.inject.Inject;
*/
public class ContextFinderTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ContextFinderTestLanguageStandaloneSetup.class);
getInjector().injectMembers(this);
@@ -60,90 +61,90 @@ public class ContextFinderTest extends AbstractXtextTests {
return Joiner.on(", ").join(result);
}
- public void testAttributeExclusionTest1() throws Exception {
+ @Test public void testAttributeExclusionTest1() throws Exception {
Model model = parseHelper.parse("#1 kw1 bar");
assertEquals("AttributeExclusionTest1", findContextsByContents(model.getAttributeExclusion()));
}
- public void testAttributeExclusionTest2() throws Exception {
+ @Test public void testAttributeExclusionTest2() throws Exception {
Model model = parseHelper.parse("#1 kw2 bar");
assertEquals("AttributeExclusionTest2", findContextsByContents(model.getAttributeExclusion()));
}
- public void testNestedTypeTest1() throws Exception {
+ @Test public void testNestedTypeTest1() throws Exception {
Model model = parseHelper.parse("#2 kw1 bar");
assertEquals("NestedTypeTest1", findContextsByContents(model.getNestedType()));
}
- public void testNestedTypeTest2() throws Exception {
+ @Test public void testNestedTypeTest2() throws Exception {
Model model = parseHelper.parse("#2 kw2 bar");
assertEquals("NestedTypeTest2", findContextsByContents(model.getNestedType()));
}
- public void testNestedTypeRecursiveTest1() throws Exception {
+ @Test public void testNestedTypeRecursiveTest1() throws Exception {
Model model = parseHelper.parse("#3 kw1 . .");
assertEquals("NestedTypeRecursiveTest1, NestedTypeRecursiveTest1_NestedTypeRecursiveTest_2_0",
findContextsByContents(model.getNestedTypeRecursiveTest2()));
}
- public void testNestedTypeRecursiveTest2() throws Exception {
+ @Test public void testNestedTypeRecursiveTest2() throws Exception {
Model model = parseHelper.parse("#3 kw2 . .");
assertEquals("NestedTypeRecursiveTest2, NestedTypeRecursiveTest2_NestedTypeRecursiveTest_2_0",
findContextsByContents(model.getNestedTypeRecursiveTest2()));
}
- public void testParentRefTest1() throws Exception {
+ @Test public void testParentRefTest1() throws Exception {
Model model = parseHelper.parse("#4 kw1 foo");
ParentRefTestChild child1 = ((ParentRefTest1) model.getParentRef()).getChild1();
assertEquals("ParentRefTestChild1", findContextsByContentsAndContainer(child1));
}
- public void testParentRefTest2() throws Exception {
+ @Test public void testParentRefTest2() throws Exception {
Model model = parseHelper.parse("#4 kw2 foo");
ParentRefTestChild child2 = ((ParentRefTest2) model.getParentRef()).getChild2();
assertEquals("ParentRefTestChild2", findContextsByContentsAndContainer(child2));
}
- public void testParentRefTest3() throws Exception {
+ @Test public void testParentRefTest3() throws Exception {
Model model = parseHelper.parse("#4 kw1 foo foo foo");
ParentRefTestChild child1 = ((ParentRefTest1) model.getParentRef()).getChild1().getChild().getChild();
assertEquals("ParentRefTestChild1", findContextsByContentsAndContainer(child1));
}
- public void testParentRefTest4() throws Exception {
+ @Test public void testParentRefTest4() throws Exception {
Model model = parseHelper.parse("#4 kw2 foo foo foo");
ParentRefTestChild child2 = ((ParentRefTest2) model.getParentRef()).getChild2().getChild().getChild();
assertEquals("ParentRefTestChild2", findContextsByContentsAndContainer(child2));
}
- public void testRootContainer() throws Exception {
+ @Test public void testRootContainer() throws Exception {
Model model = parseHelper.parse("#0 model #1 kw1 bar");
assertEquals("Model", findContextsByContentsAndContainer(model));
assertEquals("Model2", findContextsByContentsAndContainer(model.getModel()));
}
- public void testQuantityExclusionTest1() throws Exception {
+ @Test public void testQuantityExclusionTest1() throws Exception {
Model model = parseHelper.parse("#5 kw1 bar");
assertEquals("QuantityExclusionTest1", findContextsByContents(model.getQuantityExclusion()));
}
- public void testQuantityExclusionTest2() throws Exception {
+ @Test public void testQuantityExclusionTest2() throws Exception {
Model model = parseHelper.parse("#5 kw2 bar");
assertEquals("QuantityExclusionTest2", findContextsByContents(model.getQuantityExclusion()));
}
- public void testQuantityExclusionTest3() throws Exception {
+ @Test public void testQuantityExclusionTest3() throws Exception {
Model model = parseHelper.parse("#5 kw2 bar baz");
assertEquals("QuantityExclusionTest1, QuantityExclusionTest2",
findContextsByContents(model.getQuantityExclusion()));
}
- public void testValueExclusionTest1() throws Exception {
+ @Test public void testValueExclusionTest1() throws Exception {
Model model = parseHelper.parse("#6 lit1");
assertEquals("ValueExclusionTest1", findContextsByContents(model.getValueExclusion()));
}
- public void testValueExclusionTest2() throws Exception {
+ @Test public void testValueExclusionTest2() throws Exception {
Model model = parseHelper.parse("#6 lit2");
assertEquals("ValueExclusionTest2", findContextsByContents(model.getValueExclusion()));
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextPDAProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextPDAProviderTest.java
index 24877dd3e..be194b327 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextPDAProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextPDAProviderTest.java
@@ -17,7 +17,7 @@ import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.XtextStandaloneSetup;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.Context2NameFunction;
import org.eclipse.xtext.serializer.analysis.IContextPDAProvider;
import org.eclipse.xtext.serializer.analysis.IContextProvider;
@@ -26,6 +26,7 @@ import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.Tuples;
import org.eclipse.xtext.util.formallang.Pda;
import org.eclipse.xtext.util.formallang.PdaListFormatter;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -84,12 +85,12 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
- public void testKeywordAlternative() throws Exception {
+ @Test public void testKeywordAlternative() throws Exception {
String actual = getParserRule("Rule: a1=ID ('kw1' | 'kw2') a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -101,7 +102,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testDelegation1() throws Exception {
+ @Test public void testDelegation1() throws Exception {
String actual = getParserRule("Rule: Delegate; Delegate: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Delegate:\n");
@@ -115,7 +116,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testDelegation2() throws Exception {
+ @Test public void testDelegation2() throws Exception {
String actual = getParserRule("Rule: Foo | Delegate1; Delegate1: 'del' Delegate2 bar=ID; Delegate2: val=ID; Foo: val2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Delegate1:\n");
@@ -146,7 +147,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActionMandatory() throws Exception {
+ @Test public void testActionMandatory() throws Exception {
String actual = getParserRule("Rule: val1=ID {Act.val2=current} val3=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -159,7 +160,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActionOptional() throws Exception {
+ @Test public void testActionOptional() throws Exception {
String actual = getParserRule("Rule: val1=ID ({Act.val2=current} val3=ID)?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -173,7 +174,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActionManyMandatory() throws Exception {
+ @Test public void testActionManyMandatory() throws Exception {
String actual = getParserRule("Rule: val1=ID ({Act.val2=current} val3=ID)+;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -188,7 +189,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActionManyOptional() throws Exception {
+ @Test public void testActionManyOptional() throws Exception {
String actual = getParserRule("Rule: val1=ID ({Act.val2=current} val3=ID)*;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -204,7 +205,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActionTwoMandatory() throws Exception {
+ @Test public void testActionTwoMandatory() throws Exception {
String actual = getParserRule("Rule: val1=ID {Act1.val2=current} val3=ID {Act2.val2=current} val4=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule:\n");
@@ -221,7 +222,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
String actual = getParserRule("Exp: 'kw' Addit; Addit returns Exp: Prim ({Add.left=current} '+' right=Prim)*; Prim returns Exp: {Val} val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Addit:\n");
@@ -261,7 +262,7 @@ public class ContextPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testOptionalDelegate() throws Exception {
+ @Test public void testOptionalDelegate() throws Exception {
String actual = getParserRule("Rule: Mand | Opt; Mand: 'm' mand=ID; Opt: 'o' opt=ID?;");
StringBuilder expected = new StringBuilder();
expected.append("Mand:\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextProviderTest.java
index 9ee3abf11..d9a94cda6 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextProviderTest.java
@@ -15,11 +15,12 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.Context2NameFunction;
import org.eclipse.xtext.serializer.analysis.IContextProvider;
import org.eclipse.xtext.util.Pair;
import org.eclipse.xtext.util.Tuples;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -31,7 +32,7 @@ import com.google.common.collect.Lists;
*/
public class ContextProviderTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -64,49 +65,49 @@ public class ContextProviderTest extends AbstractXtextTests {
}));
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
String actual = getContexts("Rule: foo=ID;");
String expected = "Rule returns Rule";
assertEquals(expected, actual);
}
- public void testUnassignedAction1() throws Exception {
+ @Test public void testUnassignedAction1() throws Exception {
String actual = getContexts("Rule: {Foo};");
String expected = "Rule returns Foo";
assertEquals(expected, actual);
}
- public void testUnassignedAction2() throws Exception {
+ @Test public void testUnassignedAction2() throws Exception {
String actual = getContexts("Rule: ('foo' {Foo})? val=ID;");
String expected = "Rule returns Foo, Rule";
assertEquals(expected, actual);
}
- public void testUnassignedAction3() throws Exception {
+ @Test public void testUnassignedAction3() throws Exception {
String actual = getContexts("Rule: ('foo' {Foo})?;");
String expected = "Rule returns Foo, null";
assertEquals(expected, actual);
}
- public void testUnassignedAction4() throws Exception {
+ @Test public void testUnassignedAction4() throws Exception {
String actual = getContexts("Rule: {Foo} | {Bar};");
String expected = "Rule returns Bar, Foo";
assertEquals(expected, actual);
}
- public void testUnassignedAction5() throws Exception {
+ @Test public void testUnassignedAction5() throws Exception {
String actual = getContexts("Rule: {Foo} | {Bar} | val=ID;");
String expected = "Rule returns Bar, Foo, Rule";
assertEquals(expected, actual);
}
- public void testUnassignedAction6() throws Exception {
+ @Test public void testUnassignedAction6() throws Exception {
String actual = getContexts("Rule: 'foo' ('foo' {Foo})?;");
String expected = "Rule returns Foo, null";
assertEquals(expected, actual);
}
- public void testUnassignedRuleCall1() throws Exception {
+ @Test public void testUnassignedRuleCall1() throws Exception {
String actual = getContexts("Rule: Foo; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
@@ -114,7 +115,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall2() throws Exception {
+ @Test public void testUnassignedRuleCall2() throws Exception {
String actual = getContexts("Rule: Foo? val2=ID; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
@@ -122,7 +123,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall3() throws Exception {
+ @Test public void testUnassignedRuleCall3() throws Exception {
String actual = getContexts("Rule: Foo?; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
@@ -130,7 +131,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall4() throws Exception {
+ @Test public void testUnassignedRuleCall4() throws Exception {
String actual = getContexts("Rule: (Foo 'foo')?; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
@@ -138,7 +139,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall5() throws Exception {
+ @Test public void testUnassignedRuleCall5() throws Exception {
String actual = getContexts("Rule: Foo | Bar; Foo: val=ID; Bar: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Bar returns Bar\n");
@@ -147,7 +148,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall6() throws Exception {
+ @Test public void testUnassignedRuleCall6() throws Exception {
String actual = getContexts("Rule: Foo | Bar | val=ID; Foo: val=ID; Bar: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Bar returns Bar\n");
@@ -156,7 +157,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall7() throws Exception {
+ @Test public void testUnassignedRuleCall7() throws Exception {
String actual = getContexts("Rule: Foo | Bar | 'baz'; Foo: val=ID; Bar: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Bar returns Bar\n");
@@ -165,7 +166,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction1() throws Exception {
+ @Test public void testAssignedAction1() throws Exception {
String actual = getContexts("Rule: val=ID {Foo.bar=current};");
StringBuilder expected = new StringBuilder();
expected.append("Rule returns Foo\n");
@@ -173,7 +174,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction2() throws Exception {
+ @Test public void testAssignedAction2() throws Exception {
String actual = getContexts("Rule: val=ID ({Foo.bar=current} 'x')?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule returns Foo, Rule\n");
@@ -181,7 +182,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction3() throws Exception {
+ @Test public void testAssignedAction3() throws Exception {
String actual = getContexts("Rule: val=ID ({Foo.bar=current} 'x')*;");
StringBuilder expected = new StringBuilder();
expected.append("Rule returns Foo, Rule\n");
@@ -189,7 +190,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction4() throws Exception {
+ @Test public void testAssignedAction4() throws Exception {
String actual = getContexts("Rule: val=ID ({Foo.bar=current} 'x')+;");
StringBuilder expected = new StringBuilder();
expected.append("Rule returns Foo\n");
@@ -197,7 +198,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction5() throws Exception {
+ @Test public void testAssignedAction5() throws Exception {
String actual = getContexts("Rule: val=ID {Foo.bar=current} 'x' {Baz.bar=current} 'x';");
StringBuilder expected = new StringBuilder();
expected.append("Rule returns Baz\n");
@@ -206,7 +207,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAction6() throws Exception {
+ @Test public void testAssignedAction6() throws Exception {
String actual = getContexts("Model: {Foo.left=current} (val=ID? | {Foo.left=current});");
StringBuilder expected = new StringBuilder();
expected.append("Model returns Foo\n");
@@ -215,7 +216,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedRuleCall1() throws Exception {
+ @Test public void testAssignedRuleCall1() throws Exception {
String actual = getContexts("Rule: foo=Foo; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
@@ -223,7 +224,7 @@ public class ContextProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedRuleCall2() throws Exception {
+ @Test public void testAssignedRuleCall2() throws Exception {
String actual = getContexts("Rule: 'foo' foo=Foo; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Foo returns Foo\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextTypePDAProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextTypePDAProviderTest.java
index 21a7475fb..68b32eb20 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextTypePDAProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/ContextTypePDAProviderTest.java
@@ -18,7 +18,7 @@ import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.XtextStandaloneSetup;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.Context2NameFunction;
import org.eclipse.xtext.serializer.analysis.IContextProvider;
import org.eclipse.xtext.serializer.analysis.IContextTypePDAProvider;
@@ -27,6 +27,7 @@ import org.eclipse.xtext.util.Triple;
import org.eclipse.xtext.util.Tuples;
import org.eclipse.xtext.util.formallang.Pda;
import org.eclipse.xtext.util.formallang.PdaListFormatter;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -98,12 +99,12 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
- public void testKeywordAlternative() throws Exception {
+ @Test public void testKeywordAlternative() throws Exception {
String actual = getParserRule("Rule: a1=ID ('kw1' | 'kw2') a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -115,7 +116,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testDelegation1() throws Exception {
+ @Test public void testDelegation1() throws Exception {
String actual = getParserRule("Rule: Delegate; Delegate: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Delegate_Delegate:\n");
@@ -129,7 +130,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testLoop1() throws Exception {
+ @Test public void testLoop1() throws Exception {
String actual = getParserRule("Rule: ('x' x=ID*)*;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -142,7 +143,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testLoop2() throws Exception {
+ @Test public void testLoop2() throws Exception {
String actual = getParserRule("Model: (('x' x+=ID*) | ('y' y+=ID*))*;");
StringBuilder expected = new StringBuilder();
expected.append("Model_Model:\n");
@@ -158,7 +159,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testDelegation2() throws Exception {
+ @Test public void testDelegation2() throws Exception {
String actual = getParserRule("Rule: Foo | Delegate1; Delegate1: 'del' Delegate2 bar=ID; Delegate2: val=ID; Foo: val2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Delegate2_Delegate1:\n");
@@ -191,7 +192,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
String actual = getParserRule("Exp: 'kw' Addit; Addit returns Exp: Prim ({Add.left=current} '+' right=Prim)*; Prim returns Exp: {Val} val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Add_Addit:\n");
@@ -240,7 +241,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression2() throws Exception {
+ @Test public void testExpression2() throws Exception {
String actual = getParserRule("Addition returns Expr: Prim ({Add.left=current} '+' right=Prim)*; Prim returns Expr: {Val} name=ID | '(' Addition ')';");
StringBuilder expected = new StringBuilder();
expected.append("Add_Addition:\n");
@@ -309,7 +310,7 @@ public class ContextTypePDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testOptionalDelegate() throws Exception {
+ @Test public void testOptionalDelegate() throws Exception {
String actual = getParserRule("Rule: Mand | Opt; Mand: 'm' mand=ID; Opt: 'o' opt=ID?;");
StringBuilder expected = new StringBuilder();
expected.append("Mand_Mand:\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GenericSemanticSequencerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GenericSemanticSequencerTest.java
index 2b2668428..fe256775c 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GenericSemanticSequencerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GenericSemanticSequencerTest.java
@@ -9,6 +9,7 @@ package org.eclipse.xtext.serializer;
import org.eclipse.xtext.serializer.sequencer.GenericSemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
+import org.junit.Test;
/**
* @author Moritz Eysholdt - Initial contribution and API
@@ -21,152 +22,152 @@ public class GenericSemanticSequencerTest extends AbstractSemanticSequencerTest
}
@Override
- public void testUnorderedAlternative1() throws Exception {
+ @Test public void testUnorderedAlternative1() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative2() throws Exception {
+ @Test public void testUnorderedAlternative2() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative3() throws Exception {
+ @Test public void testUnorderedAlternative3() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative4() throws Exception {
+ @Test public void testUnorderedAlternative4() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative5() throws Exception {
+ @Test public void testUnorderedAlternative5() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative6() throws Exception {
+ @Test public void testUnorderedAlternative6() throws Exception {
// unsupported
}
@Override
- public void testUnorderedAlternative7() throws Exception {
+ @Test public void testUnorderedAlternative7() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup1() throws Exception {
+ @Test public void testUnorderedGroup1() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup2() throws Exception {
+ @Test public void testUnorderedGroup2() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup3() throws Exception {
+ @Test public void testUnorderedGroup3() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup4() throws Exception {
+ @Test public void testUnorderedGroup4() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup5() throws Exception {
+ @Test public void testUnorderedGroup5() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup6() throws Exception {
+ @Test public void testUnorderedGroup6() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup7() throws Exception {
+ @Test public void testUnorderedGroup7() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroup8() throws Exception {
+ @Test public void testUnorderedGroup8() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional1() throws Exception {
+ @Test public void testUnorderedGroupOptional1() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional2() throws Exception {
+ @Test public void testUnorderedGroupOptional2() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional3() throws Exception {
+ @Test public void testUnorderedGroupOptional3() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional4() throws Exception {
+ @Test public void testUnorderedGroupOptional4() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional5() throws Exception {
+ @Test public void testUnorderedGroupOptional5() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional6() throws Exception {
+ @Test public void testUnorderedGroupOptional6() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupOptional7() throws Exception {
+ @Test public void testUnorderedGroupOptional7() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean1() throws Exception {
+ @Test public void testUnorderedGroupBoolean1() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean2() throws Exception {
+ @Test public void testUnorderedGroupBoolean2() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean3() throws Exception {
+ @Test public void testUnorderedGroupBoolean3() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean4() throws Exception {
+ @Test public void testUnorderedGroupBoolean4() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean5() throws Exception {
+ @Test public void testUnorderedGroupBoolean5() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean6() throws Exception {
+ @Test public void testUnorderedGroupBoolean6() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean7() throws Exception {
+ @Test public void testUnorderedGroupBoolean7() throws Exception {
// unsupported
}
@Override
- public void testUnorderedGroupBoolean8() throws Exception {
+ @Test public void testUnorderedGroupBoolean8() throws Exception {
// unsupported
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignedActionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignedActionTest.java
index cfdcbf14c..3b4db4a97 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignedActionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignedActionTest.java
@@ -13,10 +13,11 @@ import java.util.Set;
import org.apache.log4j.Logger;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraint;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraintContext;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -65,7 +66,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
// }
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -97,7 +98,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
return Joiner.on("\n").join(result);
}
- public void testXtext() {
+ @Test public void testXtext() {
IGrammarConstraintProvider gcp = get(IGrammarConstraintProvider.class);
List ctxts = gcp.getConstraints(getGrammarAccess().getGrammar());
// try {
@@ -117,7 +118,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
// System.out.println(Joiner.on("\n").join(result));
}
- public void testAssignedActionMandatory1() throws Exception {
+ @Test public void testAssignedActionMandatory1() throws Exception {
String actual = getParserRule("Rule: Foo {Bar.left=current} '+' right=ID; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Bar;\n");
@@ -128,7 +129,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testAssignedActionMandatory2() throws Exception {
+ @Test public void testAssignedActionMandatory2() throws Exception {
String actual = getParserRule("Rule: val=ID {Bar.left=current} '+' right=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Bar;\n");
@@ -138,7 +139,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testAssignedActionOptional() throws Exception {
+ @Test public void testAssignedActionOptional() throws Exception {
String actual = getParserRule("Rule: Foo ({Bar.left=current} '+' right=ID)?; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Foo_Foo | Rule_Bar;\n");
@@ -149,7 +150,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testAssignedActionOptionalMany() throws Exception {
+ @Test public void testAssignedActionOptionalMany() throws Exception {
String actual = getParserRule("Rule: Foo ({Bar.left=current} '+' right=ID)*; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Foo_Foo | Rule_Bar;\n");
@@ -160,7 +161,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testAssignedActionManadatoryMany() throws Exception {
+ @Test public void testAssignedActionManadatoryMany() throws Exception {
String actual = getParserRule("Rule: Foo ({Bar.left=current} '+' right=ID)+; Foo: val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Bar;\n");
@@ -171,7 +172,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Prim ({Add.left=current} '+' right=Prim)*;\n");
grammar.append("Prim returns Expr: {Val} name=ID | '(' Addition ')';\n");
@@ -185,7 +186,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression2() throws Exception {
+ @Test public void testExpression2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Multiplication ({Add.left=current} '+' right=Multiplication)*;\n");
grammar.append("Multiplication returns Expr: Prim ({Mult.left=current} '*' right=Prim)*;\n");
@@ -203,7 +204,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression3() throws Exception {
+ @Test public void testExpression3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Prim ({Add.children+=current} ('+' children+=Prim)+)?;\n");
grammar.append("Prim returns Expr: {Val} name=ID | '(' Addition ')';\n");
@@ -217,7 +218,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression4() throws Exception {
+ @Test public void testExpression4() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Multiplication ({Add.addCh+=current} ('+' addCh+=Multiplication)+)?;\n");
grammar.append("Multiplication returns Expr: Prim ({Mult.mulCh+=current} ('*' mulCh+=Prim)+)?;\n");
@@ -235,7 +236,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression5() throws Exception {
+ @Test public void testExpression5() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Multiplication ({Bin.left+=current} op='+' right=Multiplication)*;\n");
grammar.append("Multiplication returns Expr: Prim ({Bin.left+=current} op='*' right=Prim)*;\n");
@@ -252,7 +253,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testExpression6() throws Exception {
+ @Test public void testExpression6() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Assignment returns Expr: Addition ({Bin.left+=current} op='=' right=Addition)*;\n");
grammar.append("Addition returns Expr: Multiplication ({Bin.left+=current} op='+' right=Multiplication)*;\n");
@@ -276,7 +277,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSequence1() throws Exception {
+ @Test public void testActionSequence1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: val1=ID {A.a1=current} a2=ID {B.b1=current} b2=ID {C.c1=current} c2=ID;\n");
String actual = getParserRule(grammar.toString());
@@ -292,7 +293,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSequence2() throws Exception {
+ @Test public void testActionSequence2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: val1=ID {A.a1=current} a2=ID {A.a1=current} a2=ID {A.a1=current} a2=ID;\n");
String actual = getParserRule(grammar.toString());
@@ -308,7 +309,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSequence3() throws Exception {
+ @Test public void testActionSequence3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: val1=ID ({A.a1=current} a2=ID ({A.a1=current} a2=ID ({A.a1=current} a2=ID)?)?)?;\n");
String actual = getParserRule(grammar.toString());
@@ -324,7 +325,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSequence4() throws Exception {
+ @Test public void testActionSequence4() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: {A1} ({A2.left=current})+;\n");
String actual = getParserRule(grammar.toString());
@@ -336,7 +337,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSequence5() throws Exception {
+ @Test public void testActionSequence5() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: INT? {Bar} 'bar' ({FooBar.bar=current} 'act')?;");
String actual = getParserRule(grammar.toString());
@@ -348,7 +349,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionAlternative1() throws Exception {
+ @Test public void testActionAlternative1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: root=ID (val1=ID | {A.a1=current} a2=ID | {B.b1=current} b2=ID | {C.c1=current} c2=ID);\n");
String actual = getParserRule(grammar.toString());
@@ -380,7 +381,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
')')?
)*;
*/
- public void testActionAlternative2() throws Exception {
+ @Test public void testActionAlternative2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Bar ({Foo.f1=current} f2=ID f3=ID? f4=ID)*; Bar: bar=ID;\n");
String actual = getParserRule(grammar.toString());
@@ -393,7 +394,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionAlternative3() throws Exception {
+ @Test public void testActionAlternative3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: {Foo} foo=ID ({Bar.bar=current} bar2=ID | {Baz.baz=current} baz2=ID);");
String actual = getParserRule(grammar.toString());
@@ -407,7 +408,7 @@ public class GrammarConstraintProviderAssignedActionTest extends AbstractXtextTe
assertEquals(expected.toString(), actual);
}
- public void testActionSingleAndAssigned() throws Exception {
+ @Test public void testActionSingleAndAssigned() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: {Act1} act1=ID | Foo ({Act2.left=current} act2=ID)?;\n");
grammar.append("Foo: foo=ID {Act1.f1=current} act1=ID val=ID;\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignmentsTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignmentsTest.java
index f0aa723f5..06244afa1 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignmentsTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderAssignmentsTest.java
@@ -11,12 +11,13 @@ import java.util.List;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraint;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraintElement;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.RelationalDependencyType;
import org.eclipse.xtext.util.Pair;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -27,7 +28,7 @@ import com.google.common.collect.Lists;
public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -50,7 +51,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
return Joiner.on("\n").join(result);
}
- public void testMandatoryGroup1() throws Exception {
+ @Test public void testMandatoryGroup1() throws Exception {
String actual = getParserRule("Rule: 'kw1' a1='a1' a2+='a2'* a3+='a3'+ a4+='a4'?;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -60,7 +61,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testMandatoryGroup2() throws Exception {
+ @Test public void testMandatoryGroup2() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2='a2') (b1='b1'? b2='b2'?) (c1+='c1'+ c2+='c2'+) (d1+='a1'* d2+='d2'*);");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -74,7 +75,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testOptionalGroup1() throws Exception {
+ @Test public void testOptionalGroup1() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2+='a2'* a3+='a3'+ a4+='a4'?)?;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -96,7 +97,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testOptionalGroup2() throws Exception {
+ @Test public void testOptionalGroup2() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2='a2')? (b1='b1'? b2='b2'?)? (c1+='c1'+ c2+='c2'+)? (d1+='a1'* d2+='d2'*)?;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -118,7 +119,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testManyGroup1() throws Exception {
+ @Test public void testManyGroup1() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1+='a1' a2+='a2'* a3+='a3'+ a4+='a4'?)+;");
StringBuilder expected = new StringBuilder();
expected.append("a1+='a1'\n");
@@ -140,7 +141,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testManyGroup2() throws Exception {
+ @Test public void testManyGroup2() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2='a2')+ (b1='b1'? b2='b2'?)+ (c1+='c1'+ c2+='c2'+)+ (d1+='a1'* d2+='d2'*)+;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -160,7 +161,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testOptionalManyGroup1() throws Exception {
+ @Test public void testOptionalManyGroup1() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2+='a2'* a3+='a3'+ a4+='a4'?)*;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -182,7 +183,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testOptionalManyGroup2() throws Exception {
+ @Test public void testOptionalManyGroup2() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' a2='a2')* (b1='b1'? b2='b2'?)* (c1+='c1'+ c2+='c2'+)* (d1+='a1'* d2+='d2'*)*;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -202,7 +203,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testKeywords2() throws Exception {
+ @Test public void testKeywords2() throws Exception {
String actual = getParserRule("Rule: 'kw1' (a1='a1' | a2+='a2') b1='b1' b2+='b2'* b3+='b3'+ b4+='b4'?;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
@@ -216,7 +217,7 @@ public class GrammarConstraintProviderAssignmentsTest extends AbstractXtextTests
assertEquals(expected.toString(), actual);
}
- public void testKeywords3() throws Exception {
+ @Test public void testKeywords3() throws Exception {
String actual = getParserRule("Rule: 'kw1' ((a1='a1' | a2+='a2') b1='b1' b2+='b2'* b3+='b3'+ b4+='b4'?)?;");
StringBuilder expected = new StringBuilder();
expected.append("a1='a1'\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderTest.java
index fb5777c65..9011872a8 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/GrammarConstraintProviderTest.java
@@ -12,10 +12,11 @@ import java.util.Set;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraint;
import org.eclipse.xtext.serializer.analysis.IGrammarConstraintProvider.IConstraintContext;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -27,7 +28,7 @@ import com.google.common.collect.Sets;
public class GrammarConstraintProviderTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -52,7 +53,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
return Joiner.on("\n").join(result);
}
- public void testKeywords() throws Exception {
+ @Test public void testKeywords() throws Exception {
String actual = getParserRule("Rule: 'kw1' a1='a1' a2+='a2'* a3+='a3'+ a4+='a4'?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -60,7 +61,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testTerminals() throws Exception {
+ @Test public void testTerminals() throws Exception {
String actual = getParserRule("Rule: ID a1=ID a2+=ID* a3+=ID+ a4+=ID?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -68,7 +69,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testDatatype() throws Exception {
+ @Test public void testDatatype() throws Exception {
String actual = getParserRule("Rule: DT a1=DT a2+=DT* a3+=DT+ a4+=DT?; DT: ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -76,7 +77,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testEnum() throws Exception {
+ @Test public void testEnum() throws Exception {
String actual = getParserRule("Rule: a1=EN a2+=EN* a3+=EN+ a4+=EN?; enum EN: foo | bar;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -84,7 +85,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testCrossRef1() throws Exception {
+ @Test public void testCrossRef1() throws Exception {
String actual = getParserRule("Rule: a1=[Rule|ID] a2+=[Rule|ID]* a3+=[Rule|ID]+ a4+=[Rule|ID]?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -92,7 +93,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testCrossRef2() throws Exception {
+ @Test public void testCrossRef2() throws Exception {
String actual = getParserRule("Rule: a1=[Rule] a2+=[Rule]* a3+=[Rule]+ a4+=[Rule]?;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -100,7 +101,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testCrossRef3() throws Exception {
+ @Test public void testCrossRef3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Rule: a1=[Rule|TERMINAL_RULE] a2=[Rule|DatatypeRule] a3=[Rule|EnumRule];\n");
grammar.append("terminal TERMINAL_RULE: 'a'..'z';\n");
@@ -113,7 +114,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testIgnoredRules() throws Exception {
+ @Test public void testIgnoredRules() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("ParserRule: foo=INT term=TERMINAL_RULE dat=DatatypeRule en=EnumRule;\n");
grammar.append("terminal TERMINAL_RULE: 'a'..'z';\n");
@@ -126,7 +127,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testInlineGroups() throws Exception {
+ @Test public void testInlineGroups() throws Exception {
String actual = getParserRule("Rule: (x1=ID x2=ID) (x3=ID x4=ID)* (x5=ID x6=ID)? (x7=ID x8=ID)+;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -134,7 +135,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testInlineAlternatives() throws Exception {
+ @Test public void testInlineAlternatives() throws Exception {
String actual = getParserRule("Rule: (x1=ID | x2=ID) | (x3=ID | x4=ID)* | (x5=ID | x6=ID)? | (x7=ID | x8=ID)+;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule | Rule_null;\n");
@@ -143,7 +144,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testEmptyAlternatives() throws Exception {
+ @Test public void testEmptyAlternatives() throws Exception {
String actual = getParserRule("Rule: (x1=ID | x2=ID | 'foo') (x3=ID | x4=ID | 'foo' | 'bar');");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule | Rule_null;\n");
@@ -152,7 +153,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAlternatives1() throws Exception {
+ @Test public void testAssignedAlternatives1() throws Exception {
String actual = getParserRule("Rule: a1=(ID|'id') a2=(ID|STRING|'bar') a3+=(ID|STRING|'bar')*;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -160,7 +161,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedAlternatives2() throws Exception {
+ @Test public void testAssignedAlternatives2() throws Exception {
String actual = getParserRule("Rule: a1=(ID|'id') | a2=(ID|STRING|'bar') | a3+=(ID|STRING|'bar')*;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule | Rule_null;\n");
@@ -176,7 +177,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testBooleanAlternative() throws Exception {
+ @Test public void testBooleanAlternative() throws Exception {
String actual = getParserRule("Rule: {Rule} ('false' | isTrue?='true');");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -184,7 +185,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall1() throws Exception {
+ @Test public void testUnassignedRuleCall1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub;\n");
grammar.append("Sub: val=ID;\n");
@@ -196,7 +197,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall2() throws Exception {
+ @Test public void testUnassignedRuleCall2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: (Sub1 | Sub2) name=ID 'kw1';\n");
grammar.append("Sub1: 'sub1' val1=ID;\n");
@@ -213,7 +214,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall3() throws Exception {
+ @Test public void testUnassignedRuleCall3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: (Sub1 | Sub2)? name=ID 'kw1';\n");
grammar.append("Sub1: 'sub1' val1=ID;\n");
@@ -231,7 +232,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall4() throws Exception {
+ @Test public void testUnassignedRuleCall4() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub1 | Sub2 | Sub3;\n");
grammar.append("Sub1: 'sub1' val1=ID;\n");
@@ -249,7 +250,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCallNested1() throws Exception {
+ @Test public void testUnassignedRuleCallNested1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub1 val1=ID;\n");
grammar.append("Sub1: Sub2 val2=ID;\n");
@@ -268,7 +269,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCallNested2() throws Exception {
+ @Test public void testUnassignedRuleCallNested2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub1? val1=ID;\n");
grammar.append("Sub1: Sub2? val2=ID;\n");
@@ -293,7 +294,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAction1() throws Exception {
+ @Test public void testAction1() throws Exception {
String actual = getParserRule("Rule: {Rule} val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule;\n");
@@ -301,7 +302,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAction2() throws Exception {
+ @Test public void testAction2() throws Exception {
String actual = getParserRule("Rule: {Type} val=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Type;\n");
@@ -309,7 +310,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAction3() throws Exception {
+ @Test public void testAction3() throws Exception {
String actual = getParserRule("Rule: 'kw1' {Type1} val1=ID | 'kw2' {Type2} val2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Type1 | Rule_Type2;\n");
@@ -318,7 +319,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAction4() throws Exception {
+ @Test public void testAction4() throws Exception {
String actual = getParserRule("Rule: 'kw1' {Type1} val1=ID | 'kw2' {Type2} val2=ID | 'kw3' val3=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Rule | Rule_Type1 | Rule_Type2;\n");
@@ -328,7 +329,7 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAction5() throws Exception {
+ @Test public void testAction5() throws Exception {
String actual = getParserRule("Rule: 'kw1' {Type1} val1=ID | 'kw2' {Type2} val2=ID | 'kw3' {Type3};");
StringBuilder expected = new StringBuilder();
expected.append("Rule: Rule_Type1 | Rule_Type2 | Rule_Type3;\n");
@@ -338,13 +339,13 @@ public class GrammarConstraintProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- // public void testReturnsNullAlways() throws Exception {
+ // @Test public void testReturnsNullAlways() throws Exception {
// String actual = getParserRule("Rule: val1=NullRule val2=ID; NullRule: 'kw1';");
// StringBuilder expected = new StringBuilder();
// assertEquals(expected.toString(), actual);
// }
//
- // public void testReturnsNullSometimes() throws Exception {
+ // @Test public void testReturnsNullSometimes() throws Exception {
// String actual = getParserRule("Rule: val1=NullRule val2=ID; NullRule: 'kw1' | 'kw2' {NullRule};");
// StringBuilder expected = new StringBuilder();
// assertEquals(expected.toString(), actual);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/HiddenTokenSequencerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/HiddenTokenSequencerTest.java
index 530189120..dc8587b49 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/HiddenTokenSequencerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/HiddenTokenSequencerTest.java
@@ -14,8 +14,8 @@ import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.Action;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.serializer.DebugSequenceAcceptor;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.serializer.DebugSequenceAcceptor;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.nodemodel.INode;
@@ -28,6 +28,7 @@ import org.eclipse.xtext.serializer.sequencer.IHiddenTokenSequencer;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer;
import org.eclipse.xtext.serializer.sequencer.NodeModelSemanticSequencer;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -40,7 +41,7 @@ import com.google.inject.Provider;
public class HiddenTokenSequencerTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SyntacticSequencerTestLanguageStandaloneSetup.class);
getInjector().injectMembers(this);
@@ -106,7 +107,7 @@ public class HiddenTokenSequencerTest extends AbstractXtextTests {
assertEquals(Joiner.on("\n").join(getNodeSequence(model)), Joiner.on("\n").join(actual.getColumn(4)));
}
- // public void testXtext() throws Exception {
+ // @Test public void testXtext() throws Exception {
// with(XtextStandaloneSetup.class);
// Grammar model = (Grammar) new XtextResourceSet()
// .getResource(URI.createURI("classpath:/org/eclipse/xtext/Xtext.xtext"), true).getContents().get(0);
@@ -119,7 +120,7 @@ public class HiddenTokenSequencerTest extends AbstractXtextTests {
// assertEquals(Join.join("\n", getNodeSequence(model)), Join.join("\n", actual.getColumn(4)));
// }
- public void testMandatoryKeywords() throws Exception {
+ @Test public void testMandatoryKeywords() throws Exception {
testSequence("#1 a kw1 b kw2 kw3 c kw4");
}
@@ -138,55 +139,55 @@ public class HiddenTokenSequencerTest extends AbstractXtextTests {
return result;
}
- public void testExp0_a() throws Exception {
+ @Test public void testExp0_a() throws Exception {
testSequence("#2 a + b + c + d");
}
- public void testExp1_a() throws Exception {
+ @Test public void testExp1_a() throws Exception {
testSequence("#3 a + b + c + d");
}
- public void testExp1_b() throws Exception {
+ @Test public void testExp1_b() throws Exception {
testSequence("#3 a + b");
}
- public void testExp1_c() throws Exception {
+ @Test public void testExp1_c() throws Exception {
testSequence("#3 (a + b)");
}
- public void testExp2_a() throws Exception {
+ @Test public void testExp2_a() throws Exception {
testSequence("#4 a * (b + c)");
}
- public void testExp2_b() throws Exception {
+ @Test public void testExp2_b() throws Exception {
testSequence("#4 a * (((b + c)))");
}
- public void testExp2_c() throws Exception {
+ @Test public void testExp2_c() throws Exception {
testSequence("#4 (a * (((b + c))))");
}
- public void testExp2_d() throws Exception {
+ @Test public void testExp2_d() throws Exception {
testSequence("#4 (b + c) * d");
}
- public void testExp2_e() throws Exception {
+ @Test public void testExp2_e() throws Exception {
testSequence("#4 ((a * (((b + c)) * d) + e)) + f");
}
- public void testCrossRef1_a() throws Exception {
+ @Test public void testCrossRef1_a() throws Exception {
testSequence("#5 $1terminal kw1 $1terminal");
}
- public void testCrossRef1_b() throws Exception {
+ @Test public void testCrossRef1_b() throws Exception {
testSequence("#5 datatype kw2 datatype");
}
- public void testCrossRef1_c() throws Exception {
+ @Test public void testCrossRef1_c() throws Exception {
testSequence("#5 someid kw3 someid");
}
- public void testCrossRef1_d() throws Exception {
+ @Test public void testCrossRef1_d() throws Exception {
testSequence("#5 someid kw4 someid");
}
}
\ No newline at end of file
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderNavigatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderNavigatorTest.java
index 5220f0c45..b58e4a509 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderNavigatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderNavigatorTest.java
@@ -15,7 +15,7 @@ import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynAbsorberState;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynEmitterState;
@@ -23,6 +23,7 @@ import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISyn
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.RuleCallStack;
+import org.junit.Test;
import com.google.common.collect.Sets;
@@ -32,7 +33,7 @@ import com.google.common.collect.Sets;
public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -101,7 +102,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
return result;
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
@@ -110,7 +111,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("['kw1']", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testTerminal() throws Exception {
+ @Test public void testTerminal() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID FOO a2=ID; terminal FOO: '$';");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertTrue(trans.involvesUnassignedTokenRuleCalls());
@@ -119,7 +120,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("[FOO]", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testDatatype() throws Exception {
+ @Test public void testDatatype() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID Foo a2=ID; Foo: ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertTrue(trans.involvesUnassignedTokenRuleCalls());
@@ -128,7 +129,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("[Foo]", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testAmbiguousOptional() throws Exception {
+ @Test public void testAmbiguousOptional() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' 'kw2'? a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
@@ -137,7 +138,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("['kw1']", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testAmbiguousMany() throws Exception {
+ @Test public void testAmbiguousMany() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' 'kw2'+ a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
@@ -146,7 +147,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("['kw1', 'kw2'+]", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testAmbiguousManyOptional() throws Exception {
+ @Test public void testAmbiguousManyOptional() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID 'kw1' 'kw2'* a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
@@ -155,7 +156,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("['kw1']", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testAmbiguousAlternative() throws Exception {
+ @Test public void testAmbiguousAlternative() throws Exception {
ISynAbsorberState start = getParserRule("Rule: a1=ID ('kw1' 'kw2' | 'kw3') a2=ID;");
ISynTransition trans = findTransition(start, "a1=ID", "a2=ID");
assertFalse(trans.involvesUnassignedTokenRuleCalls());
@@ -164,7 +165,7 @@ public class SyntacticSequencerPDAProviderNavigatorTest extends AbstractXtextTes
assertEquals("['kw3']", trans.getShortestPathToAbsorber(newStack()).toString());
}
- public void testAmbiguousRecursion() throws Exception {
+ @Test public void testAmbiguousRecursion() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Prim ({Add.left=current} '+' right=Prim)*;\n");
grammar.append("Prim returns Expr: {Val} name=ID | '(' Addition ')';\n");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderTest.java
index 04ba72b21..7d0c3d9ed 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerPDAProviderTest.java
@@ -21,7 +21,7 @@ import org.eclipse.xtext.XtextStandaloneSetup;
import org.eclipse.xtext.generator.serializer.SyntacticSequencerPDA2ExtendedDot;
import org.eclipse.xtext.grammaranalysis.IPDAState.PDAStateType;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.serializer.analysis.Context2NameFunction;
import org.eclipse.xtext.serializer.analysis.IContextProvider;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider;
@@ -33,6 +33,7 @@ import org.eclipse.xtext.util.Tuples;
import org.eclipse.xtext.util.formallang.NfaToProduction;
import org.eclipse.xtext.util.formallang.ProductionStringFactory;
import org.eclipse.xtext.xbase.lib.Pair;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -131,12 +132,12 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
- public void testKeyword() throws Exception {
+ @Test public void testKeyword() throws Exception {
String actual = getParserRule("Rule: a1=ID 'kw1' a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -146,7 +147,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testKeywordOptional() throws Exception {
+ @Test public void testKeywordOptional() throws Exception {
String actual = getParserRule("Rule: a1=ID 'kw1' 'kw2'? a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -156,7 +157,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testKeywordMany() throws Exception {
+ @Test public void testKeywordMany() throws Exception {
String actual = getParserRule("Rule: a1=ID 'kw1' 'kw2'+ a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -166,7 +167,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testKeywordOptionalMany() throws Exception {
+ @Test public void testKeywordOptionalMany() throws Exception {
String actual = getParserRule("Rule: a1=ID 'kw1' 'kw2'* a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -176,7 +177,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testKeywordAlternative() throws Exception {
+ @Test public void testKeywordAlternative() throws Exception {
String actual = getParserRule("Rule: a1=ID ('kw1' | 'kw2') a2=ID;");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -186,7 +187,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testKeywordAllMandatory() throws Exception {
+ @Test public void testKeywordAllMandatory() throws Exception {
String actual = getParserRule("Rule: a1=ID ('kw1' a2=ID | 'kw2' a3=ID 'kw3');");
StringBuilder expected = new StringBuilder();
expected.append("Rule_Rule:\n");
@@ -198,7 +199,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall1() throws Exception {
+ @Test public void testUnassignedRuleCall1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub;\n");
grammar.append("Sub: val=ID;\n");
@@ -213,7 +214,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testUnassignedRuleCall2() throws Exception {
+ @Test public void testUnassignedRuleCall2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: 'kw1' Sub 'kw4';\n");
grammar.append("Sub: 'kw2' val=ID 'kw3';\n");
@@ -228,7 +229,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedRuleCall2() throws Exception {
+ @Test public void testAssignedRuleCall2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: 'kw1' sub=Sub 'kw4';\n");
grammar.append("Sub: 'kw2' val=ID 'kw3';\n");
@@ -243,7 +244,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedRuleCallNested1() throws Exception {
+ @Test public void testAssignedRuleCallNested1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: start=ID sub1=Sub1 val1=ID;\n");
grammar.append("Sub1: 'sub1' sub2=Sub2 val2=ID;\n");
@@ -270,7 +271,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAssignedElements() throws Exception {
+ @Test public void testAssignedElements() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: t=MyTerminal 'kw1' d=MyDatatype 'kw2' e=MyEnum 'kw3' k='kw4' 'kw5' b='kw6'? \n");
grammar.append(" c1=[Model|MyTerminal] 'kw7' c2=[Model|MyDatatype] 'kw8' c3=[Model|'kw9'];\n");
@@ -293,7 +294,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testRecursion() throws Exception {
+ @Test public void testRecursion() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Recursion: val=ID | '(' Recursion ')';");
String actual = getParserRule(grammar.toString());
@@ -304,7 +305,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testReturnChoices() throws Exception {
+ @Test public void testReturnChoices() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: Sub1 | Sub2;\n");
grammar.append("Sub1: 'in1' Infix 'out1';\n");
@@ -331,7 +332,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression0() throws Exception {
+ @Test public void testExpression0() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Prim ({Add.left=current} '+' right=Prim)*;\n");
grammar.append("Prim returns Expr: {Val} name=ID;\n");
@@ -357,7 +358,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression1() throws Exception {
+ @Test public void testExpression1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Prim ({Add.left=current} '+' right=Prim)*;\n");
grammar.append("Prim returns Expr: {Val} name=ID | '(' Addition ')';\n");
@@ -387,7 +388,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testOptionalEnd() throws Exception {
+ @Test public void testOptionalEnd() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: 'model' foo=AbstractRule;\n");
grammar.append("AbstractRule: Rule1 | Rule2;\n");
@@ -469,7 +470,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testExpression5() throws Exception {
+ @Test public void testExpression5() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Addition returns Expr: Multiplication ({Add.left=current} '+' right=Multiplication)*;\n");
grammar.append("Multiplication returns Expr: Prim ({Mult.left=current} '*' right=Prim)*;\n");
@@ -534,7 +535,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testMultiOptional() throws Exception {
+ @Test public void testMultiOptional() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Optional: val1=ID? val2=ID? val3=ID?;");
String actual = getParserRule(grammar.toString());
@@ -554,7 +555,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActions1() throws Exception {
+ @Test public void testActions1() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: {Foo.left=current} (val=ID? | {Foo.left=current});");
String actual = getParserRule(grammar.toString());
@@ -574,7 +575,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActions2() throws Exception {
+ @Test public void testActions2() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: 'x' ('kw1' {Foo} | 'kw2' {Bar}) val1=ID;");
String actual = getParserRule(grammar.toString());
@@ -588,7 +589,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testActions3() throws Exception {
+ @Test public void testActions3() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: 'x' ('kw1' {Foo} | 'kw2' {Bar}) val1=ID;");
String actual = getParserRule(grammar.toString());
@@ -602,7 +603,7 @@ public class SyntacticSequencerPDAProviderTest extends AbstractXtextTests {
assertEquals(expected.toString(), actual);
}
- public void testAlternativeManyNested() throws Exception {
+ @Test public void testAlternativeManyNested() throws Exception {
StringBuilder grammar = new StringBuilder();
grammar.append("Model: (('x' x+=ID*) | ('y' y+=ID*))*;");
String actual = getParserRule(grammar.toString());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerTest.java
index cf66f51d4..118a1fac9 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/SyntacticSequencerTest.java
@@ -18,7 +18,7 @@ import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.grammaranalysis.impl.GrammarElementTitleSwitch;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.nodemodel.INode;
@@ -31,6 +31,7 @@ import org.eclipse.xtext.serializer.sequencer.EmitterNodeIterator;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ISyntacticSequencer;
import org.eclipse.xtext.serializer.sequencer.NodeModelSemanticSequencer;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
@@ -48,7 +49,7 @@ public class SyntacticSequencerTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(SyntacticSequencerTestLanguageStandaloneSetup.class);
getInjector().injectMembers(this);
@@ -204,87 +205,87 @@ public class SyntacticSequencerTest extends AbstractXtextTests {
return result;
}
- public void testMandatoryKeywords() throws Exception {
+ @Test public void testMandatoryKeywords() throws Exception {
testSequence("#1 a kw1 b kw2 kw3 c kw4");
}
- public void testExp0_a() throws Exception {
+ @Test public void testExp0_a() throws Exception {
testSequence("#2 a + b + c + d");
}
- public void testExp1_a() throws Exception {
+ @Test public void testExp1_a() throws Exception {
testSequence("#3 a + b + c + d");
}
- public void testExp1_b() throws Exception {
+ @Test public void testExp1_b() throws Exception {
testSequence("#3 a + b");
}
- public void testExp1_c() throws Exception {
+ @Test public void testExp1_c() throws Exception {
testSequence("#3 (a + b)");
}
- public void testExp2_a() throws Exception {
+ @Test public void testExp2_a() throws Exception {
testSequence("#4 a * (b + c)");
}
- public void testExp2_b() throws Exception {
+ @Test public void testExp2_b() throws Exception {
testSequence("#4 a * (((b + c)))");
}
- public void testExp2_c() throws Exception {
+ @Test public void testExp2_c() throws Exception {
testSequence("#4 (a * (((b + c))))");
}
- public void testExp2_d() throws Exception {
+ @Test public void testExp2_d() throws Exception {
testSequence("#4 (b + c) * d");
}
- public void testExp2_e() throws Exception {
+ @Test public void testExp2_e() throws Exception {
testSequence("#4 ((a * (((b + c)) * d) + e)) + f");
}
- public void testCrossRef1_a() throws Exception {
+ @Test public void testCrossRef1_a() throws Exception {
testSequence("#5 $1terminal kw1 $1terminal");
}
- public void testCrossRef1_b() throws Exception {
+ @Test public void testCrossRef1_b() throws Exception {
testSequence("#5 datatype kw2 datatype");
}
- public void testCrossRef1_c() throws Exception {
+ @Test public void testCrossRef1_c() throws Exception {
testSequence("#5 someid kw3 someid");
}
- public void testCrossRef1_d() throws Exception {
+ @Test public void testCrossRef1_d() throws Exception {
testSequence("#5 someid kw4 someid");
}
- public void testBooleanAlternative_a() throws Exception {
+ @Test public void testBooleanAlternative_a() throws Exception {
testSequence("#6 kw1");
}
- public void testBooleanAlternative_b() throws Exception {
+ @Test public void testBooleanAlternative_b() throws Exception {
testSequence("#6 kw2");
}
- public void testUnassignedDatatype() throws Exception {
+ @Test public void testUnassignedDatatype() throws Exception {
testSequence("#7 foo kw1", "#7 foo matched 1");
}
- public void testOpionalSingleTransition() throws Exception {
+ @Test public void testOpionalSingleTransition() throws Exception {
testSequence("#8 kw1 foo", "#8 matched 2 foo");
}
- public void testOpionalManyTransition() throws Exception {
+ @Test public void testOpionalManyTransition() throws Exception {
testSequence("#9 kw1 foo", "#9 matched 3 foo");
}
- public void testMandatoryManyTransition() throws Exception {
+ @Test public void testMandatoryManyTransition() throws Exception {
testSequence("#10 kw1 foo", "#10 matched 4 foo");
}
- public void testAlternativeTransition() throws Exception {
+ @Test public void testAlternativeTransition() throws Exception {
testSequence("#11 kw1 foo", "#11 matched 5 foo");
}
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/XtextSerializerTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/XtextSerializerTest.java
index 320d6004e..f2ebfa017 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/XtextSerializerTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/serializer/XtextSerializerTest.java
@@ -11,9 +11,10 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.mwe.utils.StandaloneSetup;
import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.serializer.SerializerTester;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.serializer.SerializerTester;
import org.eclipse.xtext.resource.XtextResourceSet;
+import org.junit.Test;
import com.google.inject.Guice;
import com.google.inject.Inject;
@@ -42,7 +43,7 @@ public class XtextSerializerTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
new StandaloneSetup().setPlatformUri("../..");
with(new XtextStandaloneSetup() {
@@ -61,7 +62,7 @@ public class XtextSerializerTest extends AbstractXtextTests {
getInjector().injectMembers(this);
}
- public void testDummy() {
+ @Test public void testDummy() {
}
public void _testXtextXtextWithNM() throws Exception {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/GenericModuleTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/GenericModuleTest.java
index e5efb9b36..55a3397b1 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/GenericModuleTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/GenericModuleTest.java
@@ -11,7 +11,8 @@ import java.lang.reflect.Type;
import java.util.Date;
import java.util.Iterator;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.inject.Guice;
import com.google.inject.Injector;
@@ -21,7 +22,7 @@ import com.google.inject.Provider;
import com.google.inject.internal.MoreTypes;
import com.google.inject.util.Types;
-public class GenericModuleTest extends TestCase {
+public class GenericModuleTest extends Assert {
public void assertConfigures(CompoundModule module, Class> from, Object to, boolean singleton,
boolean eagerSingleton, boolean provider) {
@@ -54,16 +55,16 @@ public class GenericModuleTest extends TestCase {
return false;
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
AbstractGenericModule module = new TestModule();
CompoundModule bindings = module.getBindings();
assertEquals(3, bindings.size());
assertConfigures(bindings, CharSequence.class, String.class, false, false, false);
assertConfigures(bindings, Type.class, Class.class, false, false, false);
- assertConfigures(bindings, TestCase.class, GenericModuleTest.class, false, false, false);
+ assertConfigures(bindings, Assert.class, GenericModuleTest.class, false, false, false);
}
- public void testParameterizedTypes() throws Exception {
+ @Test public void testParameterizedTypes() throws Exception {
ParameterizedTypeModule module = new ParameterizedTypeModule();
Injector createInjector = Guice.createInjector(module);
Object bindToType = createInjector.getInstance(Key.get(Types.newParameterizedType(Comparable.class, ParameterizedTypeModule.X.class)));
@@ -74,7 +75,7 @@ public class GenericModuleTest extends TestCase {
assertSame(module.PROVIDE_X,provide );
}
- public void testOverride() throws Exception {
+ @Test public void testOverride() throws Exception {
AbstractGenericModule module = new MyModule();
CompoundModule bindings = module.getBindings();
assertEquals(4, bindings.size());
@@ -83,7 +84,7 @@ public class GenericModuleTest extends TestCase {
assertConfiguresNot(bindings, CharSequence.class, String.class, false, false, false);
}
- public void testInstanceBinding() throws Exception {
+ @Test public void testInstanceBinding() throws Exception {
final Date date = new Date();
AbstractGenericModule m = new AbstractGenericModule() {
@SuppressWarnings("unused")
@@ -105,7 +106,7 @@ public class GenericModuleTest extends TestCase {
}
- public void testProviderClassBinding() throws Exception {
+ @Test public void testProviderClassBinding() throws Exception {
AbstractGenericModule m = new AbstractGenericModule() {
@SuppressWarnings("unused")
public Class extends Provider> provideDate() {
@@ -118,7 +119,7 @@ public class GenericModuleTest extends TestCase {
assertConfigures(bindings, Date.class, DateProvider.class, false, false, true);
}
- public void testProviderClassDeactivation() throws Exception {
+ @Test public void testProviderClassDeactivation() throws Exception {
AbstractGenericModule m = new AbstractGenericModule() {
@SuppressWarnings("unused")
public Class extends Provider> provideDate() {
@@ -137,7 +138,7 @@ public class GenericModuleTest extends TestCase {
}
}
- public void testProviderInstanceBinding() throws Exception {
+ @Test public void testProviderInstanceBinding() throws Exception {
final Provider provider = new Provider() {
public Date get() {
return null;
@@ -161,7 +162,7 @@ public class GenericModuleTest extends TestCase {
assertConfigures(bindings, String.class, FooProvider.class,false,false,true);
}
- public void testDeactivation() throws Exception {
+ @Test public void testDeactivation() throws Exception {
TestModule module = new TestModule() {
@Override
public Class extends CharSequence> bindString() {
@@ -169,7 +170,7 @@ public class GenericModuleTest extends TestCase {
}
@Override
- public Class extends TestCase> bindTestCase() {
+ public Class extends Assert> bindTestCase() {
return null;
}
@@ -184,10 +185,10 @@ public class GenericModuleTest extends TestCase {
assertConfigures(bindings, CharSequence.class, null, false, false,
false);
assertConfigures(bindings, Type.class, null, false, false, false);
- assertConfigures(bindings, TestCase.class, null, false, false, false);
+ assertConfigures(bindings, Assert.class, null, false, false, false);
}
- public void testSingletonBinding() throws Exception {
+ @Test public void testSingletonBinding() throws Exception {
Foo.instantiations = 0;
AbstractGenericModule m = new AbstractGenericModule() {
@@ -207,7 +208,7 @@ public class GenericModuleTest extends TestCase {
assertEquals(1, Foo.instantiations);
}
- public void testEagerSingletonBinding() throws Exception {
+ @Test public void testEagerSingletonBinding() throws Exception {
Foo.instantiations = 0;
AbstractGenericModule m = new AbstractGenericModule() {
@@ -227,7 +228,7 @@ public class GenericModuleTest extends TestCase {
assertEquals(1, Foo.instantiations);
}
- public void testNamedBinding() throws Exception {
+ @Test public void testNamedBinding() throws Exception {
@SuppressWarnings("unused")
AbstractGenericModule module = new AbstractGenericModule() {
String foo() {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/TestModule.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/TestModule.java
index eab73166d..f0c5f60dd 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/TestModule.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/service/TestModule.java
@@ -10,7 +10,7 @@ package org.eclipse.xtext.service;
import java.lang.reflect.Type;
-import junit.framework.TestCase;
+import org.junit.Assert;
public class TestModule extends AbstractGenericModule {
public Class extends CharSequence> bindString() {
@@ -21,7 +21,7 @@ public class TestModule extends AbstractGenericModule {
return Class.class;
}
- public Class extends TestCase> bindTestCase() {
+ public Class extends Assert> bindTestCase() {
return GenericModuleTest.class;
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/tests/EmfAssert.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/tests/EmfAssert.java
index 6b1c526ab..662d7b0a6 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/tests/EmfAssert.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/tests/EmfAssert.java
@@ -7,7 +7,7 @@
*******************************************************************************/
package org.eclipse.xtext.tests;
-import static junit.framework.Assert.*;
+import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.HashSet;
@@ -15,8 +15,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import junit.framework.ComparisonFailure;
-
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -24,6 +22,7 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.util.EmfFormatter;
+import org.junit.ComparisonFailure;
/**
* @author Moritz Eysholdt - Initial contribution and API
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AbstractStringsCountLinesTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AbstractStringsCountLinesTest.java
index 5790bd298..6c3db0e3c 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AbstractStringsCountLinesTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AbstractStringsCountLinesTest.java
@@ -7,17 +7,19 @@
*******************************************************************************/
package org.eclipse.xtext.util;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public abstract class AbstractStringsCountLinesTest extends TestCase {
+public abstract class AbstractStringsCountLinesTest extends Assert {
private char[] separator;
- @Override
- protected void setUp() {
+ @Before
+ public void setUp() {
separator = getSeparator();
}
@@ -25,34 +27,34 @@ public abstract class AbstractStringsCountLinesTest extends TestCase {
assertEquals(text, expected, Strings.countLines(text, separator));
}
- public void testCountLines_01() {
+ @Test public void testCountLines_01() {
checkLineCount(0, "foo");
checkLineCount(0, "");
}
- public void testCountLines_02() {
+ @Test public void testCountLines_02() {
checkLineCount(0, "foo\r");
checkLineCount(0, "\r");
}
- public void testCountLines_03() {
+ @Test public void testCountLines_03() {
checkLineCount(0, "foo\rbar");
checkLineCount(0, "\rbar");
}
- public void testCountLines_04() {
+ @Test public void testCountLines_04() {
checkLineCount(1, "foo\r\n");
checkLineCount(1, "\r\n");
checkLineCount(1, "\r\nbar");
}
- public void testCountLines_05() {
+ @Test public void testCountLines_05() {
checkLineCount(1, "foo\n");
checkLineCount(1, "\n");
checkLineCount(1, "\nbar");
}
- public void testCountLines_06() {
+ @Test public void testCountLines_06() {
checkLineCount(1, "foo\n\r");
checkLineCount(1, "\n\r");
checkLineCount(1, "\n\rbar");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AutoBoxingDispatcherTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AutoBoxingDispatcherTest.java
index 71d3f9345..e981a9214 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AutoBoxingDispatcherTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/AutoBoxingDispatcherTest.java
@@ -7,20 +7,20 @@
*******************************************************************************/
package org.eclipse.xtext.util;
-import junit.framework.TestCase;
-
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class AutoBoxingDispatcherTest extends TestCase {
+public class AutoBoxingDispatcherTest extends Assert {
- public void testPrimitiveToObject() throws Exception {
+ @Test public void testPrimitiveToObject() throws Exception {
PolymorphicDispatcher dispatcher = PolymorphicDispatcher.createForSingleTarget("methodWithObjectParameter", this);
assertTrue(dispatcher.invoke(true));
}
- public void testObjectToPrimitive() throws Exception {
+ @Test public void testObjectToPrimitive() throws Exception {
PolymorphicDispatcher dispatcher = PolymorphicDispatcher.createForSingleTarget("methodWithPrimitiveParameter", this);
assertTrue(dispatcher.invoke(Boolean.TRUE));
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java
index e2295a830..1abe4ba70 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ChainedIteratorTest.java
@@ -10,20 +10,21 @@ package org.eclipse.xtext.util;
import java.util.Arrays;
import java.util.Iterator;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
-public class ChainedIteratorTest extends TestCase {
+public class ChainedIteratorTest extends Assert {
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
Iterator iter = Iterators.concat(iter("a","b"), iter("c"), iter("d"));
assertEquals("abcd", Joiner.on("").join(Lists.newArrayList(iter)));
}
- public void testSecondArgNull() throws Exception {
+ @Test public void testSecondArgNull() throws Exception {
try {
Iterators.concat(iter("a","b"), null, null);
fail("NPE expected.");
@@ -32,7 +33,7 @@ public class ChainedIteratorTest extends TestCase {
}
}
- public void testFirstArgNull() throws Exception {
+ @Test public void testFirstArgNull() throws Exception {
try {
Iterators.concat(null, iter("a","b"));
fail("nullpointer exception expected");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/EcoreGenericsTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/EcoreGenericsTest.java
index c912fdd0f..6d40a775b 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/EcoreGenericsTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/EcoreGenericsTest.java
@@ -7,17 +7,17 @@
*******************************************************************************/
package org.eclipse.xtext.util;
-import junit.framework.TestCase;
-
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.xtext.util.genericTest.GenericTestPackage;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
*/
-public class EcoreGenericsTest extends TestCase {
+public class EcoreGenericsTest extends Assert {
- public void testReferenceType() throws Exception {
+ @Test public void testReferenceType() throws Exception {
EcoreGenericsUtil ecoreGenericsUtil = new EcoreGenericsUtil();
EClassifier referenceType = ecoreGenericsUtil.getReferenceType(GenericTestPackage.Literals.A__SOME_REFERENCE,
GenericTestPackage.Literals.D);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
index 21ccccb37..84405d0b3 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FilteringIteratorTest.java
@@ -12,7 +12,9 @@ import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
@@ -20,15 +22,14 @@ import com.google.common.collect.Iterators;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class FilteringIteratorTest extends TestCase implements Predicate {
+public class FilteringIteratorTest extends Assert implements Predicate {
private String matchMe;
private List list;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
matchMe = "matchMe";
list = new ArrayList();
}
@@ -37,12 +38,12 @@ public class FilteringIteratorTest extends TestCase implements Predicate
return param.equals(matchMe);
}
- public void testEmptyList() {
+ @Test public void testEmptyList() {
Iterator iter = Iterators.filter(list.iterator(), this);
assertFalse(iter.hasNext());
}
- public void testConcurrentModificationException() {
+ @Test public void testConcurrentModificationException() {
Iterator iter = Iterators.filter(list.iterator(), this);
list.add("null");
try {
@@ -52,7 +53,7 @@ public class FilteringIteratorTest extends TestCase implements Predicate
}
}
- public void testRemove() {
+ @Test public void testRemove() {
list.add(matchMe);
Iterator iter = Iterators.filter(list.iterator(), this);
iter.next();
@@ -63,7 +64,7 @@ public class FilteringIteratorTest extends TestCase implements Predicate
}
}
- public void testHasNext() {
+ @Test public void testHasNext() {
list.add("null");
list.add(matchMe);
list.add("null");
@@ -74,7 +75,7 @@ public class FilteringIteratorTest extends TestCase implements Predicate
assertFalse(iter.hasNext());
}
- public void testNext() {
+ @Test public void testNext() {
list.add("null");
list.add(matchMe);
list.add("null");
@@ -87,7 +88,7 @@ public class FilteringIteratorTest extends TestCase implements Predicate
assertFalse(iter.hasNext());
}
- public void testNextCallsHasNext() {
+ @Test public void testNextCallsHasNext() {
list.add("null");
list.add(matchMe);
list.add("null");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FormattingMigratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FormattingMigratorTest.java
index ce05760f8..c8034331d 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FormattingMigratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/FormattingMigratorTest.java
@@ -9,75 +9,75 @@ package org.eclipse.xtext.util;
import java.util.regex.Pattern;
-import junit.framework.TestCase;
-
import org.eclipse.xtext.util.internal.FormattingMigrator;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
-public class FormattingMigratorTest extends TestCase {
+public class FormattingMigratorTest extends Assert {
private FormattingMigrator mig = new FormattingMigrator();
private Pattern ws = Pattern.compile("\\s+");
- public void testRobust1() {
+ @Test public void testRobust1() {
String act = mig.migrate(" foo bar ", null, ws);
assertNull(act);
}
- public void testRobust2() {
+ @Test public void testRobust2() {
String act = mig.migrate(" foo bar ", "", ws);
assertEquals("", act);
}
- public void testRobust3() {
+ @Test public void testRobust3() {
String act = mig.migrate(null, " foo bar ", ws);
assertEquals(" foo bar ", act);
}
- public void testRobust4() {
+ @Test public void testRobust4() {
String act = mig.migrate("", " foo bar ", ws);
assertEquals(" foo bar ", act);
}
- public void testKeepFormatting() {
+ @Test public void testKeepFormatting() {
String act = mig.migrate(" foo bar ", " foo bar ", ws);
assertEquals(" foo bar ", act);
}
- public void testKeepFormatting2() {
+ @Test public void testKeepFormatting2() {
String act = mig.migrate(" foo bar ", " foo bar ", ws);
assertEquals(" foo bar ", act);
}
- public void testKeepFormatting3() {
+ @Test public void testKeepFormatting3() {
String act = mig.migrate(" foo bar baz ", "foo baar baz", ws);
assertEquals(" foo baar baz ", act);
}
- public void testInfix() {
+ @Test public void testInfix() {
String act = mig.migrate("foo z bar", "xoo z bax", ws);
assertEquals("xoo z bax", act);
}
- public void testPrefix() {
+ @Test public void testPrefix() {
String act = mig.migrate(" foo xx", "foo yy", ws);
assertEquals(" foo yy", act);
}
- public void testPostfix() {
+ @Test public void testPostfix() {
String act = mig.migrate("xx foo ", "yy foo", ws);
assertEquals("yy foo ", act);
}
- public void testNoMatch1() {
+ @Test public void testNoMatch1() {
String act = mig.migrate(" x y z ", "a b c", ws);
assertEquals("a b c", act);
}
- public void testPartialMatch() {
+ @Test public void testPartialMatch() {
String act = mig.migrate(" xxx zzz ", "xxx yyy zzz", ws);
assertEquals(" xxx yyy zzz ", act);
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/LineFilterOutputStreamTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/LineFilterOutputStreamTest.java
index 20b5e2e70..2dc55bcf9 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/LineFilterOutputStreamTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/LineFilterOutputStreamTest.java
@@ -10,12 +10,14 @@ package org.eclipse.xtext.util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class LineFilterOutputStreamTest extends TestCase {
+public class LineFilterOutputStreamTest extends Assert {
private ByteArrayOutputStream result;
@@ -23,9 +25,8 @@ public class LineFilterOutputStreamTest extends TestCase {
private String input;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
result = new ByteArrayOutputStream(500);
filterStream = new LineFilterOutputStream(result, " * $Id" + "$");
input = "/**\n" +
@@ -37,7 +38,7 @@ public class LineFilterOutputStreamTest extends TestCase {
"package foo";
}
- public void testWrite_01() throws IOException {
+ @Test public void testWrite_01() throws IOException {
filterStream.write(input.getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -51,7 +52,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_02() throws IOException {
+ @Test public void testWrite_02() throws IOException {
filterStream.write((" * $Id" + "$").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -59,7 +60,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_03() throws IOException {
+ @Test public void testWrite_03() throws IOException {
filterStream.write(("\n * $Id" + "$").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -67,7 +68,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_04() throws IOException {
+ @Test public void testWrite_04() throws IOException {
filterStream.write((" * $Id" + "$\n").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -75,7 +76,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_05() throws IOException {
+ @Test public void testWrite_05() throws IOException {
filterStream.write(("*\n * $Id" + "$").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -83,7 +84,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_06() throws IOException {
+ @Test public void testWrite_06() throws IOException {
filterStream.write((" * $Id" + "$\n *").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -91,7 +92,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_07() throws IOException {
+ @Test public void testWrite_07() throws IOException {
filterStream.write((" * $Id" + "$\n *\n").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
@@ -99,7 +100,7 @@ public class LineFilterOutputStreamTest extends TestCase {
assertEquals(expected, res);
}
- public void testWrite_08() throws IOException {
+ @Test public void testWrite_08() throws IOException {
filterStream.write((" * $Id" + "$\n */").getBytes());
filterStream.flush();
String res = new String(result.toByteArray());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MapVsMultimap.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MapVsMultimap.java
index 240e01d73..e9e25002b 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MapVsMultimap.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MapVsMultimap.java
@@ -10,7 +10,10 @@ package org.eclipse.xtext.util;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -18,7 +21,7 @@ import com.google.common.collect.Maps;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class MapVsMultimap extends TestCase {
+public class MapVsMultimap extends Assert {
private int valuesPerBatch = 0;
private int batches = 500000;
@@ -28,9 +31,8 @@ public class MapVsMultimap extends TestCase {
private Map map;
@SuppressWarnings("unchecked")
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
allElements = Lists.newArrayList();
for(int batch = 0; batch < batches; batch++) {
char c = 'A';
@@ -69,15 +71,14 @@ public class MapVsMultimap extends TestCase {
}
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
map = null;
multimap = null;
allElements = null;
- super.tearDown();
}
- public void testHashMultiMap() {
+ @Test public void testHashMultiMap() {
for(int i = 0; i < iterations; i++) {
for(int j = 0; j< allElements.size(); j++) {
String s = allElements.get(j);
@@ -96,7 +97,7 @@ public class MapVsMultimap extends TestCase {
}
}
- public void testHashMap() {
+ @Test public void testHashMap() {
for(int i = 0; i < iterations; i++) {
for(String s: allElements) {
map.get(s);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java
index 2dba0b619..cad889e3d 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/MappingIteratorTest.java
@@ -10,7 +10,8 @@ package org.eclipse.xtext.util;
import java.util.Arrays;
import java.util.Iterator;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.collect.Iterators;
@@ -18,25 +19,25 @@ import com.google.common.collect.Iterators;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class MappingIteratorTest extends TestCase implements Function {
+public class MappingIteratorTest extends Assert implements Function {
public String apply(String param) {
return param + "->" + param;
}
- public void testEmptyIter() {
+ @Test public void testEmptyIter() {
Iterator iter = createMappingIterator(new String[]{});
assertFalse(iter.hasNext());
}
- public void testSingleElementIter() {
+ @Test public void testSingleElementIter() {
Iterator iter = createMappingIterator("a");
assertTrue(iter.hasNext());
assertEquals("a->a", iter.next());
assertFalse(iter.hasNext());
}
- public void testMultiElementIter() {
+ @Test public void testMultiElementIter() {
Iterator iter = createMappingIterator("a", "b", "c");
assertEquals("a->a", iter.next());
assertEquals("b->b", iter.next());
@@ -44,7 +45,7 @@ public class MappingIteratorTest extends TestCase implements Function x) {return "comp";}
@@ -115,7 +115,7 @@ public class PolymorphicDispatcherTest extends TestCase {
assertEquals("i",target.invoke(42));
}
- public void testMixedTypes() throws Exception {
+ @Test public void testMixedTypes() throws Exception {
Object o1 = new Object() {
String label(Number i) {
@@ -136,7 +136,7 @@ public class PolymorphicDispatcherTest extends TestCase {
assertEquals("Integer_3", dispatcher.invoke(new Integer(3)));
}
- public void testDifferentParamLength() throws Exception {
+ @Test public void testDifferentParamLength() throws Exception {
Object o1 = new Object() {
String label(Integer i, Object stuff) {
return "Integer_" + i + "_" + stuff;
@@ -163,7 +163,7 @@ public class PolymorphicDispatcherTest extends TestCase {
assertEquals("Number_3_foo", dispatcher.invoke(BigInteger.valueOf(3), "foo"));
}
- public void testAmbiguous() throws Exception {
+ @Test public void testAmbiguous() throws Exception {
Object o1 = new Object() {
String label(CharSequence i) {
@@ -183,7 +183,7 @@ public class PolymorphicDispatcherTest extends TestCase {
}
}
- public void testNullParams() throws Exception {
+ @Test public void testNullParams() throws Exception {
Object o1 = new Object() {
String label(String i, CharSequence y) {
@@ -202,7 +202,7 @@ public class PolymorphicDispatcherTest extends TestCase {
assertEquals(CharSequence.class.getSimpleName(), dispatcher.invoke(null, new StringBuilder()));
}
- public void testNullParams_1() throws Exception {
+ @Test public void testNullParams_1() throws Exception {
Object o1 = new Object() {
String label(Void x, CharSequence y) {
@@ -221,7 +221,7 @@ public class PolymorphicDispatcherTest extends TestCase {
assertEquals(CharSequence.class.getSimpleName(), dispatcher.invoke(null, null));
}
- public void testPrivateMethodAccess() {
+ @Test public void testPrivateMethodAccess() {
Object o1 = new Object() {
private String label(Integer i) {
return "Integer_" + i;
@@ -241,7 +241,7 @@ public class PolymorphicDispatcherTest extends TestCase {
private @interface TestLabelAnnotation {
}
- public void testCustomFilter() {
+ @Test public void testCustomFilter() {
Object o1 = new Object() {
@TestLabelAnnotation
private String sillyMethodName(Integer i) {
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ReflectionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ReflectionTest.java
index dc4e6750d..6a829ef2d 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ReflectionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/ReflectionTest.java
@@ -9,12 +9,13 @@ package org.eclipse.xtext.util;
import java.lang.reflect.Method;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class ReflectionTest extends TestCase {
+public class ReflectionTest extends Assert {
private static class MyClass {
@SuppressWarnings("unused")
@@ -23,7 +24,7 @@ public class ReflectionTest extends TestCase {
}
}
- public void testGetMethodGivesCopy() throws Exception {
+ @Test public void testGetMethodGivesCopy() throws Exception {
Class clazz = MyClass.class;
Method declaredMethod = clazz.getDeclaredMethod("getString");
assertNotNull("declaredMethod", declaredMethod);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
index 720f3b051..6b414afae 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/SimpleCacheTest.java
@@ -7,14 +7,16 @@
*******************************************************************************/
package org.eclipse.xtext.util;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
import com.google.common.base.Function;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class SimpleCacheTest extends TestCase implements Function{
+public class SimpleCacheTest extends Assert implements Function{
private SimpleCache cache;
@@ -22,8 +24,8 @@ public class SimpleCacheTest extends TestCase implements Function(this);
expectedParam = null;
callCount = 0;
@@ -35,11 +37,11 @@ public class SimpleCacheTest extends TestCase implements Function split = Strings.split("foo.bar", ".");
assertEquals(2, split.size());
assertEquals("foo", split.get(0));
assertEquals("bar", split.get(1));
}
- public void testSplit2() throws Exception {
+ @Test public void testSplit2() throws Exception {
List split = Strings.split("foobar", ".");
assertEquals(1, split.size());
assertEquals("foobar", split.get(0));
}
- public void testSplit3() throws Exception {
+ @Test public void testSplit3() throws Exception {
List split = Strings.split("foobar", "oo");
assertEquals(2, split.size());
@@ -41,7 +42,7 @@ public class StringsTest extends TestCase {
}
- public void testSplit4() throws Exception {
+ @Test public void testSplit4() throws Exception {
List split = Strings.split("foobar", "o");
assertEquals(3, split.size());
assertEquals("f", split.get(0));
@@ -49,7 +50,7 @@ public class StringsTest extends TestCase {
assertEquals("bar", split.get(2));
}
- public void testPackUnpack() throws Exception {
+ @Test public void testPackUnpack() throws Exception {
String[] strings = new String[] {
";" , ":", "foo","bar"
};
@@ -65,7 +66,7 @@ public class StringsTest extends TestCase {
assertNull(Strings.unpack(""));
}
- public void testRemoveLeadingWhitespace() throws Exception {
+ @Test public void testRemoveLeadingWhitespace() throws Exception {
assertEquals("foo ", Strings.removeLeadingWhitespace("foo "));
assertEquals("foo ", Strings.removeLeadingWhitespace(" foo "));
assertEquals("foo ", Strings.removeLeadingWhitespace("\nfoo "));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TailWriterTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TailWriterTest.java
index 22ab3ae5e..33caa3065 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TailWriterTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TailWriterTest.java
@@ -11,23 +11,26 @@ import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class TailWriterTest extends TestCase {
+public class TailWriterTest extends Assert {
private StringWriter writer;
private BufferedWriter buff;
- @Override
- protected void setUp() {
+ @Before
+ public void setUp() {
writer = new StringWriter();
}
- @Override
- protected void tearDown() {
+ @After
+ public void tearDown() {
writer = null;
buff = null;
}
@@ -45,33 +48,33 @@ public class TailWriterTest extends TestCase {
assertEquals(s, writer.getBuffer().toString());
}
- public void testSuppressNothing() throws IOException {
+ @Test public void testSuppressNothing() throws IOException {
initWriter(0);
String s = "foo\nbar\n";
write(s);
check(s);
}
- public void testSuppressNegative() throws Exception {
+ @Test public void testSuppressNegative() throws Exception {
initWriter(-1);
String s = "foo\nbar\n";
write(s);
check(s);
}
- public void testSuppressOne() throws Exception {
+ @Test public void testSuppressOne() throws Exception {
initWriter(1);
write("foo\nbar\n");
check("bar\n");
}
- public void testSuppressTwo() throws Exception {
+ @Test public void testSuppressTwo() throws Exception {
initWriter(2);
write("foo\nbar\nzonk\n");
check("zonk\n");
}
- public void testSuppressAll() throws Exception {
+ @Test public void testSuppressAll() throws Exception {
initWriter(4);
write("foo\nbar\nzonk\n");
check("");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TextRegionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TextRegionTest.java
index 9800c59ac..986ddde7a 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TextRegionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TextRegionTest.java
@@ -7,14 +7,15 @@
*******************************************************************************/
package org.eclipse.xtext.util;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
-public class TextRegionTest extends TestCase {
+public class TextRegionTest extends Assert {
- public void testContainsByOffset() {
+ @Test public void testContainsByOffset() {
ITextRegion location = new TextRegion(3, 4);
assertTrue(location.contains(3));
assertTrue(location.contains(6));
@@ -22,7 +23,7 @@ public class TextRegionTest extends TestCase {
assertFalse(location.contains(7));
}
- public void testContainsByLocation() {
+ @Test public void testContainsByLocation() {
ITextRegion location = new TextRegion(3, 4);
assertTrue(location.contains(new TextRegion(4,2)));
assertTrue(location.contains(new TextRegion(4,3)));
@@ -33,7 +34,7 @@ public class TextRegionTest extends TestCase {
assertFalse(location.contains(new TextRegion(8,1)));
}
- public void testMerge() {
+ @Test public void testMerge() {
ITextRegion location = new TextRegion(2, 4);
ITextRegion merge = location.merge(ITextRegion.EMPTY_REGION);
assertEquals(2, merge.getOffset());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TuplesTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TuplesTest.java
index 389230485..3aae38952 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TuplesTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/TuplesTest.java
@@ -2,11 +2,12 @@ package org.eclipse.xtext.util;
import java.util.HashSet;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
-public class TuplesTest extends TestCase {
+public class TuplesTest extends Assert {
- public void testPair() throws Exception {
+ @Test public void testPair() throws Exception {
Pair p1 = Tuples.create("foo", "bar");
Pair p2 = Tuples.create("foo", null);
Pair p3 = Tuples.create(null, "bar");
@@ -26,7 +27,7 @@ public class TuplesTest extends TestCase {
assertTrue(set.add(Tuples.create((String) null,(String) null)));
}
- public void testTriple() throws Exception {
+ @Test public void testTriple() throws Exception {
assertFalse(Tuples.create("foo", "bar", "stuff").equals(Tuples.create("foo", "bar")));
assertFalse(Tuples.create("foo", "bar").equals(Tuples.create("foo", "bar", "stuff")));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/CfgToPdaTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/CfgToPdaTest.java
index 792656ba3..f6396dfd9 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/CfgToPdaTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/CfgToPdaTest.java
@@ -7,16 +7,15 @@
*******************************************************************************/
package org.eclipse.xtext.util.formallang;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.eclipse.xtext.util.formallang.StringProduction.ProdElement;
import org.eclipse.xtext.util.formallang.StringPda.StringPdaFactory;
+import org.eclipse.xtext.util.formallang.StringProduction.ProdElement;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
-public class CfgToPdaTest extends TestCase {
+public class CfgToPdaTest extends Assert {
private String createPda(StringCfg cfg) {
FollowerFunction ff = new FollowerFunctionImpl(cfg);
@@ -26,7 +25,7 @@ public class CfgToPdaTest extends TestCase {
return actual;
}
- public void testSimple() {
+ @Test public void testSimple() {
StringCfg cfg = new StringCfg();
cfg.rule("Foo: 'foo' Bar");
cfg.rule("Bar: 'bar'");
@@ -41,7 +40,7 @@ public class CfgToPdaTest extends TestCase {
Assert.assertEquals(exp.toString(), createPda(cfg));
}
- public void testSimple2() {
+ @Test public void testSimple2() {
StringCfg cfg = new StringCfg();
cfg.rule("Foo: Bar");
cfg.rule("Bar: 'bar1' Baz 'bar2'");
@@ -61,7 +60,7 @@ public class CfgToPdaTest extends TestCase {
Assert.assertEquals(exp.toString(), createPda(cfg));
}
- public void testRecursion() {
+ @Test public void testRecursion() {
StringCfg cfg = new StringCfg();
cfg.rule("Foo: Bar");
cfg.rule("Bar: 'bar1' Foo? 'bar2'");
@@ -78,7 +77,7 @@ public class CfgToPdaTest extends TestCase {
Assert.assertEquals(exp.toString(), createPda(cfg));
}
- public void testChain() {
+ @Test public void testChain() {
StringCfg cfg = new StringCfg();
cfg.rule("Foo: Bar1");
cfg.rule("Bar1: Bar2");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/FollowerFunctionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/FollowerFunctionTest.java
index 58e4d2488..ac6b25460 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/FollowerFunctionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/FollowerFunctionTest.java
@@ -8,10 +8,11 @@
package org.eclipse.xtext.util.formallang;
import static org.eclipse.xtext.util.formallang.FollowerFunctionImpl.UnorderedStrategy.*;
-import junit.framework.TestCase;
import org.eclipse.xtext.util.formallang.FollowerFunctionImpl.Direction;
import org.eclipse.xtext.util.formallang.StringProduction.ProdElement;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -20,7 +21,7 @@ import com.google.common.collect.Iterables;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
-public class FollowerFunctionTest extends TestCase {
+public class FollowerFunctionTest extends Assert {
private class ElementFormatter implements Function {
public String apply(ProdElement from) {
@@ -71,107 +72,107 @@ public class FollowerFunctionTest extends TestCase {
return result;
}
- public void testSimple() {
+ @Test public void testSimple() {
StringProduction p = sp("'a'");
assertEquals("null", new FF(p).followers("a"));
}
- public void testSequence1() {
+ @Test public void testSequence1() {
StringProduction p = sp("'a' 'b'");
assertEquals("'b'", new FF(p).followers("a"));
}
- public void testSequence2() {
+ @Test public void testSequence2() {
StringProduction p = sp("'a' 'b'?");
assertEquals("'b', null", new FF(p).followers("a"));
}
- public void testSequence3() {
+ @Test public void testSequence3() {
StringProduction p = sp("'a' 'b'? 'c'");
assertEquals("'b', 'c'", new FF(p).followers("a"));
}
- public void testSequence4() {
+ @Test public void testSequence4() {
StringProduction p = sp("'a' 'b'? 'c'?");
assertEquals("'b', 'c', null", new FF(p).followers("a"));
}
- public void testSequence5() {
+ @Test public void testSequence5() {
StringProduction p = sp("'a'+ 'b'");
assertEquals("'a', 'b'", new FF(p).followers("a"));
}
- public void testSequence6() {
+ @Test public void testSequence6() {
StringProduction p = sp("'a'* 'b'");
assertEquals("'a', 'b'", new FF(p).followers("a"));
}
- public void testSequence7() {
+ @Test public void testSequence7() {
StringProduction p = sp("'a' 'b'*");
assertEquals("'b', null", new FF(p).followers("a"));
}
- public void testSequence8() {
+ @Test public void testSequence8() {
StringProduction p = sp("'a' 'b'* 'c'?");
assertEquals("'b', 'c', null", new FF(p).followers("a"));
}
- public void testSequence9() {
+ @Test public void testSequence9() {
StringProduction p = sp("'a' ('b' 'c')");
assertEquals("'b'", new FF(p).followers("a"));
}
- public void testSequence10() {
+ @Test public void testSequence10() {
StringProduction p = sp("'a' ('b'? 'c')");
assertEquals("'b', 'c'", new FF(p).followers("a"));
}
- public void testSequence11() {
+ @Test public void testSequence11() {
StringProduction p = sp("'a' ('b'? 'c'?)");
assertEquals("'b', 'c', null", new FF(p).followers("a"));
}
- public void testSequence12() {
+ @Test public void testSequence12() {
StringProduction p = sp("'a' ('b' 'c')*");
assertEquals("'b', null", new FF(p).followers("c"));
}
- public void testAlternative1() {
+ @Test public void testAlternative1() {
StringProduction p = sp("'a' ('b' | 'c')");
assertEquals("'b', 'c'", new FF(p).followers("a"));
}
- public void testAlternative2() {
+ @Test public void testAlternative2() {
StringProduction p = sp("'a' ('b'? | 'c')");
assertEquals("'b', 'c', null", new FF(p).followers("a"));
}
- public void testAlternative3() {
+ @Test public void testAlternative3() {
StringProduction p = sp("'a' ('b' | 'c')?");
assertEquals("'b', 'c', null", new FF(p).followers("a"));
}
- public void testAlternative4() {
+ @Test public void testAlternative4() {
StringProduction p = sp("'a' 'b'? ('c' | 'd')?");
assertEquals("'b', 'c', 'd', null", new FF(p).followers("a"));
}
- public void testAlternative5() {
+ @Test public void testAlternative5() {
StringProduction p = sp("'a' ('b' | 'c')+");
assertEquals("'b', 'c'", new FF(p).followers("a"));
}
- public void testAlternative6() {
+ @Test public void testAlternative6() {
StringProduction p = sp("'a' ('b' | 'c')+");
assertEquals("'b', 'c', null", new FF(p).followers("b"));
}
- public void testAlternative7() {
+ @Test public void testAlternative7() {
StringProduction p = sp("'a' ('b' | 'c')+");
assertEquals("'b', 'c', null", new FF(p).followers("c"));
}
- public void testUnordered1() {
+ @Test public void testUnordered1() {
StringProduction p = sp("'a' ('b' & 'c')");
FF mult = new FF(p).setUnorderedStrategy(MULIT_ALTERNATIVE);
FF seq = new FF(p).setUnorderedStrategy(SEQUENCE);
@@ -183,7 +184,7 @@ public class FollowerFunctionTest extends TestCase {
assertEquals("null", seq.followers("c"));
}
- public void testUnordered2() {
+ @Test public void testUnordered2() {
StringProduction p = sp("'a' ('b' & 'c' & 'd')");
FF mult = new FF(p).setUnorderedStrategy(MULIT_ALTERNATIVE);
FF seq = new FF(p).setUnorderedStrategy(SEQUENCE);
@@ -197,7 +198,7 @@ public class FollowerFunctionTest extends TestCase {
assertEquals("null", seq.followers("d"));
}
- public void testUnordered3() {
+ @Test public void testUnordered3() {
StringProduction p = sp("'a' ('b'? & 'c')");
FF mult = new FF(p).setUnorderedStrategy(MULIT_ALTERNATIVE);
FF seq = new FF(p).setUnorderedStrategy(SEQUENCE);
@@ -209,7 +210,7 @@ public class FollowerFunctionTest extends TestCase {
assertEquals("null", seq.followers("c"));
}
- public void testUnordered4() {
+ @Test public void testUnordered4() {
StringProduction p = sp("'a' ('b'? & 'c'?)");
FF mult = new FF(p).setUnorderedStrategy(MULIT_ALTERNATIVE);
FF seq = new FF(p).setUnorderedStrategy(SEQUENCE);
@@ -221,47 +222,47 @@ public class FollowerFunctionTest extends TestCase {
assertEquals("null", seq.followers("c"));
}
- public void testStarts1() {
+ @Test public void testStarts1() {
StringProduction p = sp("'a'");
assertEquals("'a'", new FF(p).starts());
}
- public void testStarts2() {
+ @Test public void testStarts2() {
StringProduction p = sp("'a'?");
assertEquals("'a', null", new FF(p).starts());
}
- public void testStarts3() {
+ @Test public void testStarts3() {
StringProduction p = sp("'a'*");
assertEquals("'a', null", new FF(p).starts());
}
- public void testStarts4() {
+ @Test public void testStarts4() {
StringProduction p = sp("'a' 'b'");
assertEquals("'a'", new FF(p).starts());
}
- public void testStarts5() {
+ @Test public void testStarts5() {
StringProduction p = sp("'a'? 'b'");
assertEquals("'a', 'b'", new FF(p).starts());
}
- public void testStarts6() {
+ @Test public void testStarts6() {
StringProduction p = sp("('a' | 'b') 'c'");
assertEquals("'a', 'b'", new FF(p).starts());
}
- public void testStarts7() {
+ @Test public void testStarts7() {
StringProduction p = sp("('a' | 'b')*");
assertEquals("'a', 'b', null", new FF(p).starts());
}
- public void testStarts8() {
+ @Test public void testStarts8() {
StringProduction p = sp("('a' 'b')*");
assertEquals("'a', null", new FF(p).starts());
}
- public void testStarts9() {
+ @Test public void testStarts9() {
StringProduction p = sp("('a' & 'b')*");
assertEquals("'a', 'b', null", new FF(p).starts());
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/NfaToProductionTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/NfaToProductionTest.java
index ba4f7d110..bb342c8f5 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/NfaToProductionTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/NfaToProductionTest.java
@@ -7,21 +7,22 @@
*******************************************************************************/
package org.eclipse.xtext.util.formallang;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.base.Functions;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
-public class NfaToProductionTest extends TestCase {
+public class NfaToProductionTest extends Assert {
private String nfa2g(Nfa nfa) {
NfaToProduction nfa2g = new NfaToProduction();
return nfa2g.nfaToGrammar(nfa, Functions. identity(), new ProductionStringFactory());
}
- public void testAlternative() {
+ @Test public void testAlternative() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y");
nfa.state("x").followedBy("stop");
@@ -29,7 +30,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x | y) stop", nfa2g(nfa));
}
- public void testAlternative2() {
+ @Test public void testAlternative2() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "z");
nfa.state("x").followedBy("stop");
@@ -38,7 +39,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x | y | z) stop", nfa2g(nfa));
}
- public void testAlternative3() {
+ @Test public void testAlternative3() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "z", "v", "w");
nfa.state("x").followedBy("a");
@@ -51,7 +52,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start ((v | w) b | (x | y | z) a) stop", nfa2g(nfa));
}
- public void testAlternative4() {
+ @Test public void testAlternative4() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "stop");
nfa.state("x").followedBy("stop");
@@ -59,7 +60,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x | y)? stop", nfa2g(nfa));
}
- public void testAlternative5() {
+ @Test public void testAlternative5() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y");
nfa.state("x").followedBy("stop", "x");
@@ -67,7 +68,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x+ | y) stop", nfa2g(nfa));
}
- public void testAlternative6() {
+ @Test public void testAlternative6() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "stop");
nfa.state("x").followedBy("stop", "x");
@@ -75,7 +76,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x* | y?) stop", nfa2g(nfa));
}
- public void testAlternative7() {
+ @Test public void testAlternative7() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a", "b");
nfa.state("a").followedBy("x", "y");
@@ -85,7 +86,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (a | b) (x | y) stop", nfa2g(nfa));
}
- public void testAlternative8() {
+ @Test public void testAlternative8() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a", "b");
nfa.state("a").followedBy("c", "d");
@@ -97,7 +98,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (a | b) (c | d) (x | y) stop", nfa2g(nfa));
}
- public void testManyGroups1() {
+ @Test public void testManyGroups1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y");
nfa.state("x").followedBy("x", "y");
@@ -105,7 +106,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x* y)+ stop", nfa2g(nfa));
}
- public void testManyAlternative1() {
+ @Test public void testManyAlternative1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "stop");
nfa.state("x").followedBy("x", "y", "stop");
@@ -113,7 +114,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x | y)* stop", nfa2g(nfa));
}
- public void testManyAlternative2() {
+ @Test public void testManyAlternative2() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a", "b", "c", "stop");
nfa.state("a").followedBy("a", "b", "c", "stop");
@@ -122,7 +123,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (a | b | c)* stop", nfa2g(nfa));
}
- public void testManyAlternative3() {
+ @Test public void testManyAlternative3() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a1", "b1", "stop");
nfa.state("a1").followedBy("a2");
@@ -132,7 +133,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (a1 a2 | b1 b2)* stop", nfa2g(nfa));
}
- public void testManyAlternative4() {
+ @Test public void testManyAlternative4() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a1", "b1", "c1", "stop");
nfa.state("a1").followedBy("a2");
@@ -144,7 +145,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (a1 a2 | b1 b2 | c1 c2)* stop", nfa2g(nfa));
}
- public void testOptionalChain1() {
+ @Test public void testOptionalChain1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "stop");
nfa.state("x").followedBy("y", "stop");
@@ -152,7 +153,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start x? y? stop", nfa2g(nfa));
}
- public void testOptionalChain2() {
+ @Test public void testOptionalChain2() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "y", "z", "stop");
nfa.state("x").followedBy("y", "z", "stop");
@@ -161,27 +162,27 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start x? y? z? stop", nfa2g(nfa));
}
- public void testSimple() {
+ @Test public void testSimple() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("stop");
assertEquals("start stop", nfa2g(nfa));
}
- public void testSimpleMany() {
+ @Test public void testSimpleMany() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x");
nfa.state("x").followedBy("x", "stop");
assertEquals("start x+ stop", nfa2g(nfa));
}
- public void testSimpleManyOptional() {
+ @Test public void testSimpleManyOptional() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "stop");
nfa.state("x").followedBy("x", "stop");
assertEquals("start x* stop", nfa2g(nfa));
}
- public void testSimpleManyOptional2() {
+ @Test public void testSimpleManyOptional2() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "stop");
nfa.state("x").followedBy("y");
@@ -190,7 +191,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x y z)* stop", nfa2g(nfa));
}
- public void testSimpleManyOptional3() {
+ @Test public void testSimpleManyOptional3() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "stop");
nfa.state("x").followedBy("y", "z");
@@ -199,28 +200,28 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (x y? z+)* stop", nfa2g(nfa));
}
- public void testSimpleOne() {
+ @Test public void testSimpleOne() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x");
nfa.state("x").followedBy("stop");
assertEquals("start x stop", nfa2g(nfa));
}
- public void testSimpleOptional1() {
+ @Test public void testSimpleOptional1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x", "stop");
nfa.state("x").followedBy("stop");
assertEquals("start x? stop", nfa2g(nfa));
}
- public void testSimpleStartStopIdentical() {
+ @Test public void testSimpleStartStopIdentical() {
StringNfa nfa = new StringNfa("foo", "foo");
nfa.start().followedBy("x", "foo");
nfa.state("x").followedBy("foo");
assertEquals("foo x? foo", nfa2g(nfa));
}
- public void testSplitStateAlternatives1() {
+ @Test public void testSplitStateAlternatives1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("b", "c");
nfa.state("b").followedBy("d", "e");
@@ -230,7 +231,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start (b (d | e) | c e) stop", nfa2g(nfa));
}
- public void testSplitStateAlternatives2() {
+ @Test public void testSplitStateAlternatives2() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("a", "b");
nfa.state("a").followedBy("c", "d");
@@ -243,7 +244,7 @@ public class NfaToProductionTest extends TestCase {
assertEquals("start ((a | b) d (f | g) | a c f | b e g) stop", nfa2g(nfa));
}
- public void testSplitStateCycle1() {
+ @Test public void testSplitStateCycle1() {
StringNfa nfa = new StringNfa("start", "stop");
nfa.start().followedBy("x");
nfa.state("x").followedBy("stop", "y");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/PdaUtilTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/PdaUtilTest.java
index cb9535554..d6f207c29 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/PdaUtilTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/util/formallang/PdaUtilTest.java
@@ -11,14 +11,15 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
import com.google.common.collect.Lists;
/**
* @author Moritz Eysholdt - Initial contribution and API
*/
-public class PdaUtilTest extends TestCase {
+public class PdaUtilTest extends Assert {
private PdaUtil util = new PdaUtil();
@@ -33,14 +34,14 @@ public class PdaUtilTest extends TestCase {
assertEquals(expected, act);
}
- public void testShortestPathSimple() {
+ @Test public void testShortestPathSimple() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B");
pda.state("B").followedBy("C");
assertEquals("[A, B, C]", util.shortestPathTo(pda, newStack(), "C"));
}
- public void testShortestPathLoop() {
+ @Test public void testShortestPathLoop() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B");
pda.state("B").followedBy("C", "B");
@@ -48,7 +49,7 @@ public class PdaUtilTest extends TestCase {
assertEquals("[A, B, C]", util.shortestPathTo(pda, newStack(), "C"));
}
- public void testShortestPathStackSimple() {
+ @Test public void testShortestPathStackSimple() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B");
pda.state("B").followedBy("C").pop("X");
@@ -56,7 +57,7 @@ public class PdaUtilTest extends TestCase {
assertEquals("null", util.shortestPathTo(pda, newStack(), "C"));
}
- public void testShortestPathStackSimplePop() {
+ @Test public void testShortestPathStackSimplePop() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B").pop("X");
pda.state("B").followedBy("C").pop("Y");
@@ -65,7 +66,7 @@ public class PdaUtilTest extends TestCase {
assertEquals("[A, B, C]", util.shortestPathTo(pda, newStack("Y"), "C"));
}
- public void testShortestPathStackSimplePopLoop() {
+ @Test public void testShortestPathStackSimplePopLoop() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B", "A").pop("X");
pda.state("B").followedBy("C", "B").pop("Y");
@@ -74,14 +75,14 @@ public class PdaUtilTest extends TestCase {
assertEquals("[A, B, C]", util.shortestPathTo(pda, newStack("Y"), "C"));
}
- public void testShortestStackemptyingPathStackSimplePopLoop() {
+ @Test public void testShortestStackemptyingPathStackSimplePopLoop() {
StringPda pda = new StringPda("A", "C");
pda.state("A").followedBy("B");
pda.state("B").followedBy("C", "B").pop("Y");
assertEquals("[A, B, B, C]", util.shortestStackpruningPathTo(pda, newStack("Y", "Y"), "C"));
}
- public void testShortestStackemptyingPathTwoLoops() {
+ @Test public void testShortestStackemptyingPathTwoLoops() {
StringPda pda = new StringPda("A", "D");
pda.state("A").followedBy("B");
pda.state("B").followedBy("C", "B").push("Y");
@@ -91,13 +92,13 @@ public class PdaUtilTest extends TestCase {
assertEquals("[A, B, C, C, C, D]", util.shortestStackpruningPathTo(pda, newStack("Y", "Y"), "D"));
}
- // public void testShortestStackemptyingSingleState() {
+ // @Test public void testShortestStackemptyingSingleState() {
// PDA pda = newPDA();
// pda.state("A").start().stop();
// assertEquals("[A]", util.shortestStackpruningPathTo(pda, newStack(), "A"));
// }
- // public void testShortestStackemptyingPathLoops1() {
+ // @Test public void testShortestStackemptyingPathLoops1() {
// PDA pda = newPDA();
// pda.state("A").start().followedBy("B");
// pda.state("B").followedBy("C").pop("X");
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractCompositeValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractCompositeValidatorTest.java
index 01377ec93..246541ad9 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractCompositeValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractCompositeValidatorTest.java
@@ -23,9 +23,10 @@ import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
import org.eclipse.xtext.enumrules.enumRulesTestLanguage.EnumRulesTestLanguageFactory;
import org.eclipse.xtext.enumrules.enumRulesTestLanguage.EnumRulesTestLanguagePackage;
import org.eclipse.xtext.enumrules.enumRulesTestLanguage.Model;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport;
+import org.junit.Test;
import com.google.inject.Inject;
@@ -40,7 +41,7 @@ public abstract class AbstractCompositeValidatorTest extends AbstractXtextTests
private Second second;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(createStandaloneSetup());
registry = get(EValidator.Registry.class);
@@ -51,7 +52,7 @@ public abstract class AbstractCompositeValidatorTest extends AbstractXtextTests
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
registry = null;
pack = null;
first = null;
@@ -99,11 +100,11 @@ public abstract class AbstractCompositeValidatorTest extends AbstractXtextTests
}
}
- public void testSetup() {
+ @Test public void testSetup() {
assertNotNull("registry", registry);
}
- public void testFirstAndSecond() {
+ @Test public void testFirstAndSecond() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
@@ -116,7 +117,7 @@ public abstract class AbstractCompositeValidatorTest extends AbstractXtextTests
assertTrue(contents.contains(equalitySupport));
}
- public void testBug_279962() {
+ @Test public void testBug_279962() {
EValidator validator = registry.getEValidator(pack);
assertTrue(validator instanceof CompositeEValidator);
CompositeEValidator composite = (CompositeEValidator) validator;
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractConcreteSyntaxValidationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractConcreteSyntaxValidationTest.java
index 13af38d11..4b962a02c 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractConcreteSyntaxValidationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractConcreteSyntaxValidationTest.java
@@ -13,9 +13,9 @@ import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.junit.validation.AssertableDiagnostics;
-import org.eclipse.xtext.junit.validation.AssertableDiagnostics.DiagnosticPredicate;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
+import org.eclipse.xtext.junit4.validation.AssertableDiagnostics;
+import org.eclipse.xtext.junit4.validation.AssertableDiagnostics.DiagnosticPredicate;
import org.eclipse.xtext.validation.IConcreteSyntaxValidator.DiagnosticChainAcceptor;
import org.eclipse.xtext.validation.impl.ConcreteSyntaxDiagnosticProvider.ConcreteSyntaxFeatureDiagnostic;
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractValidationMessageAcceptingTestCase.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractValidationMessageAcceptingTestCase.java
index 738bcbdf5..70258d7be 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractValidationMessageAcceptingTestCase.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AbstractValidationMessageAcceptingTestCase.java
@@ -9,8 +9,7 @@ package org.eclipse.xtext.validation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.xtext.junit.AbstractXtextTests;
-import org.eclipse.xtext.validation.ValidationMessageAcceptor;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
/**
* @author Sebastian Zarnekow - Initial contribution and API
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AssignmentAllocatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AssignmentAllocatorTest.java
index 5e80fc0a5..0a50b1bbc 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AssignmentAllocatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/AssignmentAllocatorTest.java
@@ -8,13 +8,14 @@
package org.eclipse.xtext.validation;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.validation.IAssignmentQuantityAllocator.IQuantities;
import org.eclipse.xtext.validation.IConcreteSyntaxConstraintProvider.ISyntaxConstraint;
import org.eclipse.xtext.validation.IConcreteSyntaxDiagnosticProvider.IConcreteSyntaxDiagnostic;
import org.eclipse.xtext.validation.csvalidationtest.CsvalidationtestFactory;
import org.eclipse.xtext.validation.csvalidationtest.TransientSerializeables1;
import org.eclipse.xtext.validation.csvalidationtest.TransientSerializeables1Enum;
+import org.junit.Test;
import com.google.common.collect.Lists;
@@ -25,7 +26,7 @@ public class AssignmentAllocatorTest extends AbstractXtextTests {
private static CsvalidationtestFactory f = CsvalidationtestFactory.eINSTANCE;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ConcreteSyntaxValidationTestLanguageStandaloneSetup.class);
allocator = getInjector().getInstance(IAssignmentQuantityAllocator.class);
@@ -42,7 +43,7 @@ public class AssignmentAllocatorTest extends AbstractXtextTests {
return q.toString();
}
- public void testTransient() {
+ @Test public void testTransient() {
TransientSerializeables1 ts = f.createTransientSerializeables1();
assertEquals("((val1:0 enum1:0)? (val2:0 int1:0)?)", getAllocation(ts));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithEObjectValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithEObjectValidatorTest.java
index 2daa78f33..6d5aed6de 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithEObjectValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithEObjectValidatorTest.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.ecore.EValidator;
import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
import org.eclipse.xtext.enumrules.enumRulesTestLanguage.EnumRulesTestLanguagePackage;
import org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport;
+import org.junit.Test;
import com.google.inject.Binder;
import com.google.inject.Guice;
@@ -43,7 +44,7 @@ public class CompositeValidatorWithEObjectValidatorTest extends AbstractComposit
}
@Override
- public void testContentsSize() {
+ @Test public void testContentsSize() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithoutEObjectValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithoutEObjectValidatorTest.java
index 41063f102..c739cf77f 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithoutEObjectValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/CompositeValidatorWithoutEObjectValidatorTest.java
@@ -13,6 +13,7 @@ import org.eclipse.emf.ecore.EValidator;
import org.eclipse.xtext.enumrules.EnumRulesTestLanguageStandaloneSetup;
import org.eclipse.xtext.enumrules.enumRulesTestLanguage.EnumRulesTestLanguagePackage;
import org.eclipse.xtext.validation.CompositeEValidator.EValidatorEqualitySupport;
+import org.junit.Test;
import com.google.inject.Binder;
import com.google.inject.Guice;
@@ -43,7 +44,7 @@ public class CompositeValidatorWithoutEObjectValidatorTest extends AbstractCompo
}
@Override
- public void testContentsSize() {
+ @Test public void testContentsSize() {
EValidator validator = registry.getEValidator(pack);
assertNotNull(validator);
assertTrue(validator instanceof CompositeEValidator);
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxConstraintProviderTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxConstraintProviderTest.java
index 7822fdc24..fadab1501 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxConstraintProviderTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxConstraintProviderTest.java
@@ -18,9 +18,10 @@ import org.eclipse.xtext.Grammar;
import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.XtextStandaloneSetup;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.validation.IConcreteSyntaxConstraintProvider.ISyntaxConstraint;
import org.eclipse.xtext.validation.impl.ConcreteSyntaxConstraintProvider;
+import org.junit.Test;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@@ -54,7 +55,7 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(XtextStandaloneSetup.class);
}
@@ -91,87 +92,87 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
return "";
}
- public void testSimple() throws Exception {
+ @Test public void testSimple() throws Exception {
String constraint = parseRule("Model: name=ID;");
assertEquals("name", constraint);
}
- public void testGroup1() throws Exception {
+ @Test public void testGroup1() throws Exception {
String constraint = parseRule("Model: name=ID (val=INT 'somekw')?;");
assertEquals("(name val?)", constraint);
}
- public void testAlternatives1() throws Exception {
+ @Test public void testAlternatives1() throws Exception {
String constraint = parseRule("Model: name=ID | val=INT | 'somekw';");
assertEquals("(name|val)?", constraint);
}
- public void testAction1() throws Exception {
+ @Test public void testAction1() throws Exception {
String constraint = parseRule("Model: {Model} name=ID;");
assertEquals("({} name)", constraint);
}
- public void testAction2() throws Exception {
+ @Test public void testAction2() throws Exception {
String constraint = parseRule("Model: {Type1} name=ID;");
assertEquals("({} name)", constraint);
}
- public void testAction3() throws Exception {
+ @Test public void testAction3() throws Exception {
String constraint = parseRule("Model: 'something' ({Type1} name=ID)? val=INT;");
assertEquals("(({} name)? val)", constraint);
}
- public void testAction4() throws Exception {
+ @Test public void testAction4() throws Exception {
String constraint = parseRule("Model: 't1' {Type1} | 't2' {Type2} | 't3' {Type3};");
assertEquals("({}|{}|{})", constraint);
}
- public void testAction5() throws Exception {
+ @Test public void testAction5() throws Exception {
String constraint = parseRule("Model: 't1' {Type1} | 't2' {Type2} | 't3' {Type3} | 't4';");
assertEquals("({}|{}|{})?", constraint);
}
- public void testAction6() throws Exception {
+ @Test public void testAction6() throws Exception {
String constraint = parseRule("Model: 't1' {Type1} val=ID | 't2' {Type2} val=ID | 't3' {Type3} | 't4';");
assertEquals("(({} val)|({} val)|{})?", constraint);
}
- public void testAction7() throws Exception {
+ @Test public void testAction7() throws Exception {
String constraint = parseRule("Model: ('t1' {Type1} val=ID | 't2' {Type2} val=ID | 't3' {Type3})?;");
assertEquals("(({} val)|({} val)|{})?", constraint);
}
- public void testAction8() throws Exception {
+ @Test public void testAction8() throws Exception {
String constraint = parseRule("Model: 't1' {Type1} val=ID | ('something' ({Type2} 't2' | {Type3} 't3'));");
assertEquals("(({} val)|({}|{}))", constraint);
}
- public void testAction9() throws Exception {
+ @Test public void testAction9() throws Exception {
String constraint = parseRule("Model: ('t1' {Type1} val1=ID | val2=ID) val3=ID;");
assertEquals("((({} val1)|val2) val3)", constraint);
}
- public void testSummarizeAssignments1() throws Exception {
+ @Test public void testSummarizeAssignments1() throws Exception {
String constraint = parseRule("Model: val+=ID (',' val+=ID)*;");
assertEquals("val+", constraint);
}
- public void testSummarizeAssignments2() throws Exception {
+ @Test public void testSummarizeAssignments2() throws Exception {
String constraint = parseRule("Model: val+=ID (',' val+=ID)+;");
assertEquals("(val val+)", constraint);
}
- public void testSummarizeAssignments3() throws Exception {
+ @Test public void testSummarizeAssignments3() throws Exception {
String constraint = parseRule("Model: (val+=ID (',' val+=ID)*)?;");
assertEquals("val*", constraint);
}
- public void testMulti1() throws Exception {
+ @Test public void testMulti1() throws Exception {
String constraint = parseRule("model : ('kw1' a+=ID b+=ID)* ('kw2' a+=ID c+=ID)* ('kw3' b+=ID c+=ID)*;");
assertEquals("((a b)* (a c)* (b c)*)", constraint);
}
- public void testRuleCall1() throws Exception {
+ @Test public void testRuleCall1() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: Sub; ");
b.append("Sub: val=ID; ");
@@ -179,7 +180,7 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
assertEquals("val", constraint);
}
- public void testRuleCall2() throws Exception {
+ @Test public void testRuleCall2() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: (Sub1 | Sub2) name=ID 'somekeyword'; ");
b.append("Sub1: 'sub1' val1=ID; ");
@@ -188,7 +189,7 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
assertEquals("((val1|val2) name)", constraint);
}
- public void testRuleCall3() throws Exception {
+ @Test public void testRuleCall3() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: (Sub1 | Sub2)? name=ID 'somekeyword'; ");
b.append("Sub1: 'sub1' val1=ID; ");
@@ -197,7 +198,7 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
assertEquals("((val1|val2)? name)", constraint);
}
- public void testRecursion() throws Exception {
+ @Test public void testRecursion() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model returns Model: Sub1 | name=ID 'somekeyword'; ");
b.append("Sub1 returns Model: '(' Model ')'; ");
@@ -205,14 +206,14 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
assertNull(constraint);
}
- public void testAssignedActions() throws Exception {
+ @Test public void testAssignedActions() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: 'y' val=ID ({Evil.left=current} ',' right=ID)?; ");
String constraint = parseRule(b.toString());
assertNull(constraint);
}
- public void testNestedAssignedActions() throws Exception {
+ @Test public void testNestedAssignedActions() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: Foo | Bar; ");
b.append("Foo: 'x' val=ID; ");
@@ -222,12 +223,12 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
}
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=312220
- public void testUnassignedRuleCall() throws Exception {
+ @Test public void testUnassignedRuleCall() throws Exception {
String constraint = parseRule("WithoutHidden hidden(): '[' 'kw' WS x=INT '.' y=INT ']';");
assertEquals("(x y)", constraint);
}
- public void testNestedAlternative() throws Exception {
+ @Test public void testNestedAlternative() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: (SE | Decl) ';'; ");
b.append("Decl: type+=ID name+=ID; ");
@@ -236,12 +237,12 @@ public class ConcreteSyntaxConstraintProviderTest extends AbstractXtextTests {
assertEquals("((ids|ints)+|(type name))", constraint);
}
- public void testEmptyAlternative() throws Exception {
+ @Test public void testEmptyAlternative() throws Exception {
String constraint = parseRule("Import: ('import' | 'imp') foo=ID?;");
assertEquals("foo?", constraint);
}
- public void testOptionalGroupWithUnassignedElements() throws Exception {
+ @Test public void testOptionalGroupWithUnassignedElements() throws Exception {
StringBuilder b = new StringBuilder();
b.append("Model: ('(' INT ')')? a=STRING b=STRING;");
String constraint = parseRule(b.toString());
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxValidationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxValidationTest.java
index e7b959d16..1cf18c8e9 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxValidationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcreteSyntaxValidationTest.java
@@ -7,7 +7,7 @@
*******************************************************************************/
package org.eclipse.xtext.validation;
-import static org.eclipse.xtext.junit.validation.AssertableDiagnostics.*;
+import static org.eclipse.xtext.junit4.validation.AssertableDiagnostics.*;
import static org.eclipse.xtext.validation.IConcreteSyntaxDiagnosticProvider.*;
import org.eclipse.emf.common.util.BasicEList;
@@ -48,6 +48,7 @@ import org.eclipse.xtext.validation.csvalidationtest.UnassignedRuleCall2Sub;
import org.eclipse.xtext.validation.csvalidationtest.UnassignedRuleCall2SubAction;
import org.eclipse.xtext.validation.csvalidationtest.impl.TransientObjectImpl;
import org.eclipse.xtext.validation.impl.ConcreteSyntaxValidator;
+import org.junit.Test;
/**
* @author meysholdt - Initial contribution and API
@@ -55,7 +56,7 @@ import org.eclipse.xtext.validation.impl.ConcreteSyntaxValidator;
public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidationTest {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(ConcreteSyntaxValidationTestLanguageStandaloneSetup.class);
validator = getInjector().getInstance(ConcreteSyntaxValidator.class);
@@ -75,14 +76,14 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
return getModel(model).eContents().get(0);
}
- public void testSimpleGroup1() throws Exception {
+ @Test public void testSimpleGroup1() throws Exception {
SimpleGroup m = (SimpleGroup) getModel2("#1 abc def");
validate(m).assertOK();
m.setVal2(null);
validate(m).assertAll(err(p.getSimpleGroup_Val2(), ERROR_VALUE_REQUIRED, 1, 1, ""));
}
- public void testSimpleAlternative1() throws Exception {
+ @Test public void testSimpleAlternative1() throws Exception {
SimpleAlternative m = (SimpleAlternative) getModel2("#2 kw1 abc");
validate(m).assertOK();
m.setVal2("def2");
@@ -90,7 +91,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getSimpleAlternative_Val2(), ERROR_VALUE_PROHIBITED, null, 0, "(val1|val2)"));
}
- public void testSimpleMultiplicities1() throws Exception {
+ @Test public void testSimpleMultiplicities1() throws Exception {
SimpleMultiplicities m = (SimpleMultiplicities) getModel2("#3 abc kw1 def kw2 fgh ijk kw3 lmn opq");
validate(m).assertOK();
m.setVal2(null);
@@ -107,7 +108,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertAll(err(p.getSimpleMultiplicities_Val3(), ERROR_LIST_TOO_FEW, 1, null, ""));
}
- public void testGroupMultiplicities1() throws Exception {
+ @Test public void testGroupMultiplicities1() throws Exception {
GroupMultiplicities m = (GroupMultiplicities) getModel2("#4 abc kw1 def def kw2 fgh ijk kw3 lmn opq");
validate(m).assertOK();
@@ -150,7 +151,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
}
- public void testAlternativeMultiplicities1() throws Exception {
+ @Test public void testAlternativeMultiplicities1() throws Exception {
AlternativeMultiplicities m = (AlternativeMultiplicities) getModel2("#5 abc kw2 kw3 fgh kw3 xxx kw4 ijk lmn opq");
validate(m).assertOK();
@@ -183,7 +184,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testAssignedAction1() throws Exception {
+ @Test public void testAssignedAction1() throws Exception {
AssignedAction m = (AssignedAction) getModel2("#6 id1 id2 id3");
validate(m).assertOK();
m.setVal1(null);
@@ -192,7 +193,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(m).assertOK();
}
- public void testAssignedAction2() throws Exception {
+ @Test public void testAssignedAction2() throws Exception {
AssignedAction m = (AssignedAction) getModel2("#7 id1 kw1 id3");
validate(m).assertOK();
m.setVal1(null);
@@ -201,21 +202,21 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(m).assertOK();
}
- public void testUnassignedAction1() throws Exception {
+ @Test public void testUnassignedAction1() throws Exception {
UnassignedAction1 m = (UnassignedAction1) getModel2("#8 id1");
validate(m).assertOK();
m.setVal1(null);
validate(m).assertAll(err(p.getUnassignedAction1_Val1(), ERROR_VALUE_REQUIRED, 1, null, ""));
}
- public void testUnassignedAction2() throws Exception {
+ @Test public void testUnassignedAction2() throws Exception {
UnassignedAction2Sub m = (UnassignedAction2Sub) getModel2("#9 id1");
validate(m).assertOK();
m.setVal1(null);
validate(m).assertAll(err(p.getUnassignedAction2Sub_Val1(), ERROR_VALUE_REQUIRED, 1, 1, ""));
}
- public void testUnassignedAction3() throws Exception {
+ @Test public void testUnassignedAction3() throws Exception {
UnassignedAction3 m = (UnassignedAction3) getModel2("#10 kw1 id1 id2");
validate(m).assertOK();
m.setVal1(null);
@@ -226,7 +227,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(ua).assertAll(errorCode(ERROR_WRONG_TYPE));
}
- public void testUnassignedRuleCall1() throws Exception {
+ @Test public void testUnassignedRuleCall1() throws Exception {
UnassignedRuleCall1Sub m = (UnassignedRuleCall1Sub) getModel2("#11 id1 id2");
validate(m).assertOK();
@@ -237,7 +238,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(m1).assertAll(errorCode(ERROR_WRONG_TYPE));
}
- public void testUnassignedRuleCall2() throws Exception {
+ @Test public void testUnassignedRuleCall2() throws Exception {
UnassignedRuleCall2SubAction a = f.createUnassignedRuleCall2SubAction();
a.setVal2("foo");
validate(a).assertOK();
@@ -250,7 +251,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(c).assertAll(errorCode(ERROR_WRONG_TYPE));
}
- public void testCombination1() throws Exception {
+ @Test public void testCombination1() throws Exception {
Combination1 copy, m = (Combination1) getModel2("#13 id1 kw1 id2 kw2 id3");
validate(m).assertOK();
@@ -271,7 +272,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getCombination1_Val4(), ERROR_VALUE_REQUIRED, 1, null, "(val2 (val3|val4))?"));
}
- public void testCombination2() throws Exception {
+ @Test public void testCombination2() throws Exception {
Combination2 copy, m = (Combination2) getModel2("#14 id1 id31 id41 id32 id42");
validate(m).assertOK();
@@ -287,7 +288,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getCombination2_Val4(), ERROR_LIST_TOO_MANY, null, 0, "(val2|(val3 val4)*)"));
}
- public void testCombination3() throws Exception {
+ @Test public void testCombination3() throws Exception {
Combination3 copy, m = (Combination3) getModel2("#15 'string' id1 1234");
validate(m).assertOK();
@@ -301,7 +302,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testCombination4() throws Exception {
+ @Test public void testCombination4() throws Exception {
Combination4 copy, m = (Combination4) getModel2("#16 group id11 id12 id13 group id21 id22 id23");
validate(m).assertOK();
@@ -315,7 +316,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getCombination4_Val3(), ERROR_LIST_TOO_MANY, null, 1, "(val1 val2 val3)+"));
}
- public void testList1() throws Exception {
+ @Test public void testList1() throws Exception {
List1 copy, m = (List1) getModel2("#17 id1, id2, id2");
validate(m).assertOK();
@@ -329,7 +330,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertAll(err(p.getList1_Val1(), ERROR_LIST_TOO_FEW, 1, null, ""));
}
- public void testList2() throws Exception {
+ @Test public void testList2() throws Exception {
List2 copy, m = (List2) getModel2("#18 id1, id2, id2");
validate(m).assertOK();
@@ -343,7 +344,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testList3() throws Exception {
+ @Test public void testList3() throws Exception {
List3 copy, m = (List3) getModel2("#19 id1, id2, id2");
validate(m).assertOK();
@@ -363,7 +364,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testList4() throws Exception {
+ @Test public void testList4() throws Exception {
List4 copy, m = (List4) getModel2("#20 id11, id12, id13 kw3 id2");
validate(m).assertOK();
@@ -381,7 +382,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertAll(err(p.getList4_Val2(), ERROR_VALUE_REQUIRED, 1, null, ""));
}
- public void testList5() throws Exception {
+ @Test public void testList5() throws Exception {
List5 copy, m = (List5) getModel2("#21 id11, id12, id13 kw3 id2");
validate(m).assertOK();
@@ -411,7 +412,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getList5_Val3(), ERROR_VALUE_PROHIBITED, null, 0, "((val1+ val2)|val3)"));
}
- public void testAltList1() throws Exception {
+ @Test public void testAltList1() throws Exception {
AltList1 copy, m = (AltList1) getModel2("#22 id1 id2");
validate(m).assertOK();
@@ -430,7 +431,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testAltList2() throws Exception {
+ @Test public void testAltList2() throws Exception {
AltList2 copy, m = (AltList2) getModel2("#23 id1 id2");
validate(m).assertOK();
@@ -447,7 +448,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(copy).assertOK();
}
- public void testTransientObject() {
+ @Test public void testTransientObject() {
TransientObject to = new TransientObjectImpl() {
@Override
public boolean eIsSet(int featureID) {
@@ -476,7 +477,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(to).assertOK();
}
- public void testTransientSerializeables1() throws Exception {
+ @Test public void testTransientSerializeables1() throws Exception {
TransientSerializeables1 m = f.createTransientSerializeables1();
validate(m).assertOK();
@@ -511,7 +512,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
err(p.getTransientSerializeables1_Val2(), ERROR_VALUE_REQUIRED, 1, null, "(val2 int1)?"));
}
- public void testStaticSimplification() {
+ @Test public void testStaticSimplification() {
StaticSimplification m = f.createStaticSimplification();
validate(m).assertOK();
@@ -551,7 +552,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
validate(m).assertOK();
}
- public void testTwoVersion() {
+ @Test public void testTwoVersion() {
TwoVersion m = f.createTwoVersion();
validate(m).assertAll(
err(p.getTwoVersion_Shared2(), ERROR_VALUE_REQUIRED, null, null,
@@ -648,7 +649,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
// return result;
// }
//
- // public void testHeuristic1() {
+ // @Test public void testHeuristic1() {
// Heuristic1 m = f.createHeuristic1();
// m.getA().addAll(Lists.newArrayList("foo", "foo", "foo"));
// m.getB().addAll(Lists.newArrayList("foo", "foo", "foo"));
@@ -682,7 +683,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
//
// }
//
- // public void testHeuristic1Large1() {
+ // @Test public void testHeuristic1Large1() {
// Heuristic1 m = f.createHeuristic1();
// m.getA().addAll(strings(42));
// m.getB().addAll(strings(42));
@@ -693,7 +694,7 @@ public class ConcreteSyntaxValidationTest extends AbstractConcreteSyntaxValidati
// validate(m).assertOK();
// }
//
- // public void testHeuristic1Large2() {
+ // @Test public void testHeuristic1Large2() {
// Heuristic1 m = f.createHeuristic1();
// m.getA().addAll(strings(42));
// m.getB().addAll(strings(42));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcurrentValidationTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcurrentValidationTest.java
index d6813246d..5f5e919b3 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcurrentValidationTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ConcurrentValidationTest.java
@@ -7,12 +7,11 @@
*******************************************************************************/
package org.eclipse.xtext.validation;
-import junit.framework.AssertionFailedError;
-
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.validation.ValidationTestHelper.TestChain;
+import org.junit.Test;
/**
* @author Sebastian Zarnekow - Initial contribution and API
@@ -22,18 +21,18 @@ public class ConcurrentValidationTest extends AbstractXtextTests {
private ValidationTestHelper helper;
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
helper = null;
super.tearDown();
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
helper = new ValidationTestHelper();
}
- public void testConcurrentValidation() {
+ @Test public void testConcurrentValidation() {
AbstractDeclarativeValidator validator = new ValidationTestHelper.TestValidator() {
@Override
protected void foo(EStructuralFeature x) {
@@ -77,7 +76,7 @@ public class ConcurrentValidationTest extends AbstractXtextTests {
private final AbstractDeclarativeValidator validator;
private IllegalStateException lastEx;
- private AssertionFailedError lastError;
+ private AssertionError lastError;
private PoorMansValidationJob(AbstractDeclarativeValidator validator) {
this.validator = validator;
@@ -90,7 +89,7 @@ public class ConcurrentValidationTest extends AbstractXtextTests {
helper.assertMatch(diagnostics, EcorePackage.Literals.ENAMED_ELEMENT__NAME, EcorePackage.Literals.ECLASS__ABSTRACT);
} catch(IllegalStateException e) {
lastEx = e;
- } catch(AssertionFailedError error) {
+ } catch(AssertionError error) {
lastError = error;
}
}
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/DeclarativeValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/DeclarativeValidatorTest.java
index e6276bcc7..bc6dd79a1 100755
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/DeclarativeValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/DeclarativeValidatorTest.java
@@ -11,36 +11,35 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.xtext.validation.ValidationTestHelper.TestChain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
/**
* @author Sven Efftinge - Initial contribution and API
* @author Michael Clay
*/
-public class DeclarativeValidatorTest extends TestCase {
+public class DeclarativeValidatorTest extends Assert {
private ValidationTestHelper helper;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
this.helper = new ValidationTestHelper();
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
this.helper = null;
- super.tearDown();
}
- public void testSimpleDispatch() throws Exception {
+ @Test public void testSimpleDispatch() throws Exception {
AbstractDeclarativeValidator test = helper.validator();
TestChain chain = helper.chain();
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, null);
@@ -49,7 +48,7 @@ public class DeclarativeValidatorTest extends TestCase {
EcorePackage.Literals.ECLASS__ABSTRACT);
}
- public void testDeeperHierarchyWithOverwrittenJavaMethods() throws Exception {
+ @Test public void testDeeperHierarchyWithOverwrittenJavaMethods() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@Override
@Check
@@ -65,7 +64,7 @@ public class DeclarativeValidatorTest extends TestCase {
}
@SuppressWarnings("serial")
- public void testSkipExpensive() throws Exception {
+ @Test public void testSkipExpensive() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@SuppressWarnings("unused")
@Check(CheckType.EXPENSIVE)
@@ -102,7 +101,7 @@ public class DeclarativeValidatorTest extends TestCase {
EcorePackage.Literals.ECLASS__EALL_ATTRIBUTES);
}
- public void testGuard() throws Exception {
+ @Test public void testGuard() throws Exception {
AbstractDeclarativeValidator validator = new AbstractDeclarativeValidator() {
@SuppressWarnings("unused")
@Check
@@ -117,7 +116,7 @@ public class DeclarativeValidatorTest extends TestCase {
}
@SuppressWarnings("serial")
- public void testCheckModeSettedProperly() throws Exception {
+ @Test public void testCheckModeSettedProperly() throws Exception {
AbstractDeclarativeValidator test = helper.validator();
TestChain chain = helper.chain();
try {
@@ -133,7 +132,7 @@ public class DeclarativeValidatorTest extends TestCase {
fail("CheckMode with wrong type, should throw an IllegalArgumentException");
}
- public void testAssertThreadLocalState() throws Exception {
+ @Test public void testAssertThreadLocalState() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@Override
@Check
@@ -150,7 +149,7 @@ public class DeclarativeValidatorTest extends TestCase {
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.emptyMap());
}
- public void testCurrentObjectAndMethod() throws Exception {
+ @Test public void testCurrentObjectAndMethod() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@Override
@Check
@@ -167,7 +166,7 @@ public class DeclarativeValidatorTest extends TestCase {
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, Collections.emptyMap());
}
- public void testContext() throws Exception {
+ @Test public void testContext() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@Override
@Check
@@ -181,7 +180,7 @@ public class DeclarativeValidatorTest extends TestCase {
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, singletonMap);
}
- public void testCheckMode() throws Exception {
+ @Test public void testCheckMode() throws Exception {
AbstractDeclarativeValidator test = new ValidationTestHelper.TestValidator() {
@Override
@Check
@@ -194,7 +193,7 @@ public class DeclarativeValidatorTest extends TestCase {
test.validate(EcorePackage.eINSTANCE.getEClass(), chain, singletonMap);
}
- public void testError() {
+ @Test public void testError() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
@@ -212,7 +211,7 @@ public class DeclarativeValidatorTest extends TestCase {
assertEquals(Diagnostic.ERROR, diag.getSeverity());
}
- public void testErrorWithSource() {
+ @Test public void testErrorWithSource() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
@@ -234,7 +233,7 @@ public class DeclarativeValidatorTest extends TestCase {
assertEquals(Diagnostic.ERROR, diag.getSeverity());
}
- public void testErrorWithCode() {
+ @Test public void testErrorWithCode() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
@@ -258,7 +257,7 @@ public class DeclarativeValidatorTest extends TestCase {
assertEquals(Diagnostic.ERROR, diag.getSeverity());
}
- public void testWarning() {
+ @Test public void testWarning() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
@@ -276,7 +275,7 @@ public class DeclarativeValidatorTest extends TestCase {
assertEquals(Diagnostic.WARNING, diag.getSeverity());
}
- public void testWarningWithSource() {
+ @Test public void testWarningWithSource() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
@@ -298,7 +297,7 @@ public class DeclarativeValidatorTest extends TestCase {
assertEquals(Diagnostic.WARNING, diag.getSeverity());
}
- public void testWarningWithCode() {
+ @Test public void testWarningWithCode() {
AbstractDeclarativeValidator test = new AbstractDeclarativeValidator() {
@Check
@SuppressWarnings("unused")
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ImportUriValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ImportUriValidatorTest.java
index 9bec9fd2a..9fad97d9e 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ImportUriValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/ImportUriValidatorTest.java
@@ -14,10 +14,11 @@ import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.Diagnostician;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.ImportUriTestLanguageRuntimeModule;
import org.eclipse.xtext.linking.ImportUriTestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.importedURI.ImportedURIPackage;
+import org.junit.Test;
import com.google.inject.Binder;
import com.google.inject.Guice;
@@ -29,19 +30,19 @@ import com.google.inject.Injector;
public class ImportUriValidatorTest extends AbstractXtextTests {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
with(createStandaloneSetup());
}
- public void testValidURI() throws Exception {
+ @Test public void testValidURI() throws Exception {
String model = "import 'classpath:/org/eclipse/xtext/linking/ImportUriTestLanguage.xtext'";
Resource resource = getResourceFromString(model);
Diagnostic diagnostics = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
assertEquals(Diagnostic.OK, diagnostics.getSeverity());
}
- public void testInvalidURI() throws Exception {
+ @Test public void testInvalidURI() throws Exception {
String model = "import 'classpath:/org/eclipse/xtext/linking/ImportUriTestLanguage.unknown'";
Resource resource = getResourceFromString(model);
Diagnostic diagnostics = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
diff --git a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/InjectableValidatorTest.java b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/InjectableValidatorTest.java
index 191005aa0..5e30581b6 100644
--- a/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/InjectableValidatorTest.java
+++ b/tests/org.eclipse.xtext.tests/src/org/eclipse/xtext/validation/InjectableValidatorTest.java
@@ -21,12 +21,13 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.eclipse.xtext.junit.AbstractXtextTests;
+import org.eclipse.xtext.junit4.AbstractXtextTests;
import org.eclipse.xtext.linking.LangATestLanguageStandaloneSetup;
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguageFactory;
import org.eclipse.xtext.linking.langATestLanguage.LangATestLanguagePackage;
import org.eclipse.xtext.linking.langATestLanguage.Main;
import org.eclipse.xtext.resource.XtextResource;
+import org.junit.Test;
/**
* @author Jan Koehnlein - Initial contribution and API
@@ -39,7 +40,7 @@ public class InjectableValidatorTest extends AbstractXtextTests {
private Map