Commit 2795cea7 authored by Niklas Fors's avatar Niklas Fors
Browse files

Refactorings in test file

parent 56a853db
...@@ -2,14 +2,14 @@ Root ::= A* B*; ...@@ -2,14 +2,14 @@ Root ::= A* B*;
A ::= <Name>; A ::= <Name>;
B ::= <Name>; B ::= <Name>;
rel A.b1 <-> B.a1; rel A.bi1 <-> B.bi1;
rel A.b2 <-> B.a2?; rel A.bi2 <-> B.bi2?;
rel A.b3 <-> B.a3*; rel A.bi3 <-> B.bi3*;
rel A.b4? <-> B.a4; rel A.bi4? <-> B.bi4;
rel A.b5? <-> B.a5?; rel A.bi5? <-> B.bi5?;
rel A.b6? <-> B.a6*; rel A.bi6? <-> B.bi6*;
rel A.b7* <-> B.a7; rel A.bi7* <-> B.bi7;
rel A.b8* <-> B.a8?; rel A.bi8* <-> B.bi8?;
rel A.b9* <-> B.a9*; rel A.bi9* <-> B.bi9*;
...@@ -15,233 +15,233 @@ public class Test { ...@@ -15,233 +15,233 @@ public class Test {
} }
public void test() { public void test() {
test1(); testBi1();
test2(); testBi2();
test3(); testBi3();
test4(); testBi4();
test5(); testBi5();
test6(); testBi6();
test7(); testBi7();
test8(); testBi8();
test9(); testBi9();
} }
/** /**
* rel A.b1 <-> B.a1; * rel A.bi1 <-> B.bi1;
*/ */
private void test1() { private void testBi1() {
test11(); testBi11();
test12(); testBi12();
} }
private void test11() { private void testBi11() {
// Init // Init
setup(); setup();
a1.setB1(b1); a1.setBi1(b1);
a2.setB1(b2); a2.setBi1(b2);
// Change // Change
a2.setB1(b1); a2.setBi1(b1);
assertNull(a1.b1()); assertNull(a1.bi1());
assertSame(a2.b1(), b1); assertSame(a2.bi1(), b1);
assertSame(b1.a1(), a2); assertSame(b1.bi1(), a2);
assertNull(b2.a1()); assertNull(b2.bi1());
} }
private void test12() { private void testBi12() {
// Init // Init
setup(); setup();
a1.setB1(b2); a1.setBi1(b2);
// Change // Change
a2.setB1(b2); a2.setBi1(b2);
assertNull(a1.b1()); assertNull(a1.bi1());
assertSame(a2.b1(), b2); assertSame(a2.bi1(), b2);
assertNull(b1.a1()); assertNull(b1.bi1());
assertSame(b2.a1(), a2); assertSame(b2.bi1(), a2);
} }
/** /**
* rel A.b2 <-> B.a2?; * rel A.bi2 <-> B.bi2?;
*/ */
private void test2() { private void testBi2() {
test21(); testBi21();
test22(); testBi22();
} }
private void test21() { private void testBi21() {
// Init // Init
setup(); setup();
a1.setB2(b1); a1.setBi2(b1);
a2.setB2(b2); a2.setBi2(b2);
// Change // Change
a2.setB2(b1); a2.setBi2(b1);
assertNull(a1.b2()); assertNull(a1.bi2());
assertSame(a2.b2(), b1); assertSame(a2.bi2(), b1);
assertSame(b1.a2(), a2); assertSame(b1.bi2(), a2);
assertNull(b2.a2()); assertNull(b2.bi2());
} }
private void test22() { private void testBi22() {
// Init // Init
setup(); setup();
a1.setB2(b2); a1.setBi2(b2);
// Change // Change
a2.setB2(b2); a2.setBi2(b2);
assertNull(a1.b2()); assertNull(a1.bi2());
assertSame(a2.b2(), b2); assertSame(a2.bi2(), b2);
assertNull(b1.a2()); assertNull(b1.bi2());
assertSame(b2.a2(), a2); assertSame(b2.bi2(), a2);
} }
/** /**
* rel A.b3 <-> B.a3*; * rel A.bi3 <-> B.bi3*;
*/ */
private void test3() { private void testBi3() {
} }
/** /**
* rel A.b4? <-> B.a4; * rel A.bi4? <-> B.bi4;
*/ */
private void test4() { private void testBi4() {
test41(); testBi41();
test42(); testBi42();
} }
private void test41() { private void testBi41() {
// Init // Init
setup(); setup();
a1.setB4(b1); a1.setBi4(b1);
a2.setB4(b2); a2.setBi4(b2);
// Change // Change
a2.setB4(b1); a2.setBi4(b1);
assertNull(a1.b4()); assertNull(a1.bi4());
assertSame(a2.b4(), b1); assertSame(a2.bi4(), b1);
assertSame(b1.a4(), a2); assertSame(b1.bi4(), a2);
assertNull(b2.a4()); assertNull(b2.bi4());
} }
private void test42() { private void testBi42() {
// Init // Init
setup(); setup();
a1.setB4(b2); a1.setBi4(b2);
// Change // Change
a2.setB4(b2); a2.setBi4(b2);
assertNull(a1.b4()); assertNull(a1.bi4());
assertSame(a2.b4(), b2); assertSame(a2.bi4(), b2);
assertNull(b1.a4()); assertNull(b1.bi4());
assertSame(b2.a4(), a2); assertSame(b2.bi4(), a2);
} }
/** /**
* rel A.b5? <-> B.a5?; * rel A.bi5? <-> B.bi5?;
*/ */
private void test5() { private void testBi5() {
test51(); testBi51();
test52(); testBi52();
} }
private void test51() { private void testBi51() {
// Init // Init
setup(); setup();
a1.setB5(b1); a1.setBi5(b1);
a2.setB5(b2); a2.setBi5(b2);
// Change // Change
a2.setB5(b1); a2.setBi5(b1);
assertNull(a1.b5()); assertNull(a1.bi5());
assertSame(a2.b5(), b1); assertSame(a2.bi5(), b1);
assertSame(b1.a5(), a2); assertSame(b1.bi5(), a2);
assertNull(b2.a5()); assertNull(b2.bi5());
} }
private void test52() { private void testBi52() {
// Init // Init
setup(); setup();
a1.setB5(b2); a1.setBi5(b2);
// Change // Change
a2.setB5(b2); a2.setBi5(b2);
assertNull(a1.b5()); assertNull(a1.bi5());
assertSame(a2.b5(), b2); assertSame(a2.bi5(), b2);
assertNull(b1.a5()); assertNull(b1.bi5());
assertSame(b2.a5(), a2); assertSame(b2.bi5(), a2);
} }
/** /**
* rel A.b6? <-> B.a6*; * rel A.bi6? <-> B.bi6*;
*/ */
private void test6() { private void testBi6() {
} }
/** /**
* rel A.b7* <-> B.a7; * rel A.bi7* <-> B.bi7;
*/ */
private void test7() { private void testBi7() {
} }
/** /**
* rel A.b8* <-> B.a8?; * rel A.bi8* <-> B.bi8?;
*/ */
private void test8() { private void testBi8() {
} }
/** /**
* rel A.b9* <-> B.a9*; * rel A.bi9* <-> B.bi9*;
*/ */
private void test9() { private void testBi9() {
setup(); setup();
a1.addToB9(b1); a1.addToBi9(b1);
a1.addToB9(b2); a1.addToBi9(b2);
assertEquals(a1.b9(), Arrays.asList(b1, b2)); assertEquals(a1.bi9(), Arrays.asList(b1, b2));
assertEquals(a2.b9(), Arrays.asList()); assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList()); assertEquals(a3.bi9(), Arrays.asList());
assertEquals(b1.a9(), Arrays.asList(a1)); assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1)); assertEquals(b2.bi9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList()); assertEquals(b3.bi9(), Arrays.asList());
b3.addToA9(a1); b3.addToBi9(a1);
b3.addToA9(a3); b3.addToBi9(a3);
b3.addToA9(a1); b3.addToBi9(a1);
assertEquals(a1.b9(), Arrays.asList(b1, b2, b3, b3)); assertEquals(a1.bi9(), Arrays.asList(b1, b2, b3, b3));
assertEquals(a2.b9(), Arrays.asList()); assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList(b3)); assertEquals(a3.bi9(), Arrays.asList(b3));
assertEquals(b1.a9(), Arrays.asList(a1)); assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1)); assertEquals(b2.bi9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList(a1, a3, a1)); assertEquals(b3.bi9(), Arrays.asList(a1, a3, a1));
b3.removeFromA9(a1); b3.removeFromBi9(a1);
assertEquals(a1.b9(), Arrays.asList(b1, b2, b3)); assertEquals(a1.bi9(), Arrays.asList(b1, b2, b3));
assertEquals(a2.b9(), Arrays.asList()); assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList(b3)); assertEquals(a3.bi9(), Arrays.asList(b3));
assertEquals(b1.a9(), Arrays.asList(a1)); assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1)); assertEquals(b2.bi9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList(a3, a1)); assertEquals(b3.bi9(), Arrays.asList(a3, a1));
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment