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*;
A ::= <Name>;
B ::= <Name>;
rel A.b1 <-> B.a1;
rel A.b2 <-> B.a2?;
rel A.b3 <-> B.a3*;
rel A.bi1 <-> B.bi1;
rel A.bi2 <-> B.bi2?;
rel A.bi3 <-> B.bi3*;
rel A.b4? <-> B.a4;
rel A.b5? <-> B.a5?;
rel A.b6? <-> B.a6*;
rel A.bi4? <-> B.bi4;
rel A.bi5? <-> B.bi5?;
rel A.bi6? <-> B.bi6*;
rel A.b7* <-> B.a7;
rel A.b8* <-> B.a8?;
rel A.b9* <-> B.a9*;
rel A.bi7* <-> B.bi7;
rel A.bi8* <-> B.bi8?;
rel A.bi9* <-> B.bi9*;
......@@ -15,233 +15,233 @@ public class Test {
}
public void test() {
test1();
test2();
test3();
test4();
test5();
test6();
test7();
test8();
test9();
testBi1();
testBi2();
testBi3();
testBi4();
testBi5();
testBi6();
testBi7();
testBi8();
testBi9();
}
/**
* rel A.b1 <-> B.a1;
* rel A.bi1 <-> B.bi1;
*/
private void test1() {
test11();
test12();
private void testBi1() {
testBi11();
testBi12();
}
private void test11() {
private void testBi11() {
// Init
setup();
a1.setB1(b1);
a2.setB1(b2);
a1.setBi1(b1);
a2.setBi1(b2);
// Change
a2.setB1(b1);
a2.setBi1(b1);
assertNull(a1.b1());
assertSame(a2.b1(), b1);
assertSame(b1.a1(), a2);
assertNull(b2.a1());
assertNull(a1.bi1());
assertSame(a2.bi1(), b1);
assertSame(b1.bi1(), a2);
assertNull(b2.bi1());
}
private void test12() {
private void testBi12() {
// Init
setup();
a1.setB1(b2);
a1.setBi1(b2);
// Change
a2.setB1(b2);
a2.setBi1(b2);
assertNull(a1.b1());
assertSame(a2.b1(), b2);
assertNull(b1.a1());
assertSame(b2.a1(), a2);
assertNull(a1.bi1());
assertSame(a2.bi1(), b2);
assertNull(b1.bi1());
assertSame(b2.bi1(), a2);
}
/**
* rel A.b2 <-> B.a2?;
* rel A.bi2 <-> B.bi2?;
*/
private void test2() {
test21();
test22();
private void testBi2() {
testBi21();
testBi22();
}
private void test21() {
private void testBi21() {
// Init
setup();
a1.setB2(b1);
a2.setB2(b2);
a1.setBi2(b1);
a2.setBi2(b2);
// Change
a2.setB2(b1);
a2.setBi2(b1);
assertNull(a1.b2());
assertSame(a2.b2(), b1);
assertSame(b1.a2(), a2);
assertNull(b2.a2());
assertNull(a1.bi2());
assertSame(a2.bi2(), b1);
assertSame(b1.bi2(), a2);
assertNull(b2.bi2());
}
private void test22() {
private void testBi22() {
// Init
setup();
a1.setB2(b2);
a1.setBi2(b2);
// Change
a2.setB2(b2);
a2.setBi2(b2);
assertNull(a1.b2());
assertSame(a2.b2(), b2);
assertNull(b1.a2());
assertSame(b2.a2(), a2);
assertNull(a1.bi2());
assertSame(a2.bi2(), b2);
assertNull(b1.bi2());
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() {
test41();
test42();
private void testBi4() {
testBi41();
testBi42();
}
private void test41() {
private void testBi41() {
// Init
setup();
a1.setB4(b1);
a2.setB4(b2);
a1.setBi4(b1);
a2.setBi4(b2);
// Change
a2.setB4(b1);
a2.setBi4(b1);
assertNull(a1.b4());
assertSame(a2.b4(), b1);
assertSame(b1.a4(), a2);
assertNull(b2.a4());
assertNull(a1.bi4());
assertSame(a2.bi4(), b1);
assertSame(b1.bi4(), a2);
assertNull(b2.bi4());
}
private void test42() {
private void testBi42() {
// Init
setup();
a1.setB4(b2);
a1.setBi4(b2);
// Change
a2.setB4(b2);
a2.setBi4(b2);
assertNull(a1.b4());
assertSame(a2.b4(), b2);
assertNull(b1.a4());
assertSame(b2.a4(), a2);
assertNull(a1.bi4());
assertSame(a2.bi4(), b2);
assertNull(b1.bi4());
assertSame(b2.bi4(), a2);
}
/**
* rel A.b5? <-> B.a5?;
* rel A.bi5? <-> B.bi5?;
*/
private void test5() {
test51();
test52();
private void testBi5() {
testBi51();
testBi52();
}
private void test51() {
private void testBi51() {
// Init
setup();
a1.setB5(b1);
a2.setB5(b2);
a1.setBi5(b1);
a2.setBi5(b2);
// Change
a2.setB5(b1);
a2.setBi5(b1);
assertNull(a1.b5());
assertSame(a2.b5(), b1);
assertSame(b1.a5(), a2);
assertNull(b2.a5());
assertNull(a1.bi5());
assertSame(a2.bi5(), b1);
assertSame(b1.bi5(), a2);
assertNull(b2.bi5());
}
private void test52() {
private void testBi52() {
// Init
setup();
a1.setB5(b2);
a1.setBi5(b2);
// Change
a2.setB5(b2);
a2.setBi5(b2);
assertNull(a1.b5());
assertSame(a2.b5(), b2);
assertNull(b1.a5());
assertSame(b2.a5(), a2);
assertNull(a1.bi5());
assertSame(a2.bi5(), b2);
assertNull(b1.bi5());
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();
a1.addToB9(b1);
a1.addToB9(b2);
assertEquals(a1.b9(), Arrays.asList(b1, b2));
assertEquals(a2.b9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList());
assertEquals(b1.a9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList());
a1.addToBi9(b1);
a1.addToBi9(b2);
assertEquals(a1.bi9(), Arrays.asList(b1, b2));
assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.bi9(), Arrays.asList());
assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.bi9(), Arrays.asList(a1));
assertEquals(b3.bi9(), Arrays.asList());
b3.addToA9(a1);
b3.addToA9(a3);
b3.addToA9(a1);
assertEquals(a1.b9(), Arrays.asList(b1, b2, b3, b3));
assertEquals(a2.b9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList(b3));
assertEquals(b1.a9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList(a1, a3, a1));
b3.removeFromA9(a1);
assertEquals(a1.b9(), Arrays.asList(b1, b2, b3));
assertEquals(a2.b9(), Arrays.asList());
assertEquals(a3.b9(), Arrays.asList(b3));
assertEquals(b1.a9(), Arrays.asList(a1));
assertEquals(b2.a9(), Arrays.asList(a1));
assertEquals(b3.a9(), Arrays.asList(a3, a1));
b3.addToBi9(a1);
b3.addToBi9(a3);
b3.addToBi9(a1);
assertEquals(a1.bi9(), Arrays.asList(b1, b2, b3, b3));
assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.bi9(), Arrays.asList(b3));
assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.bi9(), Arrays.asList(a1));
assertEquals(b3.bi9(), Arrays.asList(a1, a3, a1));
b3.removeFromBi9(a1);
assertEquals(a1.bi9(), Arrays.asList(b1, b2, b3));
assertEquals(a2.bi9(), Arrays.asList());
assertEquals(a3.bi9(), Arrays.asList(b3));
assertEquals(b1.bi9(), Arrays.asList(a1));
assertEquals(b2.bi9(), Arrays.asList(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