-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenericClassTests.java
123 lines (105 loc) · 5.06 KB
/
GenericClassTests.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package org.queryongenericlist;
import org.junit.jupiter.api.Test;
import testHelpers.genericClasses.classDecleration.car.Car;
import testHelpers.genericClasses.classDecleration.datatypeholder.DataTypeHolder;
import testHelpers.genericClasses.classDecleration.developer.Developer;
import testHelpers.genericClasses.classDecleration.dog.Dog;
import testHelpers.genericClasses.classDecleration.pokemon.PokemonTrainer;
import testHelpers.genericClasses.classDecleration.shape.Circle;
import testHelpers.genericClasses.classDecleration.shape.Shape;
import testHelpers.genericClasses.classDecleration.shoppingList.ShoppingList;
import testHelpers.genericClasses.classTestCases.CaseTester;
import testHelpers.genericClasses.classTestCases.car.CarTestCases;
import testHelpers.genericClasses.classTestCases.datatypeholder.DataTypeHolderTestCases;
import testHelpers.genericClasses.classTestCases.developer.DeveloperTestCases;
import testHelpers.genericClasses.classTestCases.dog.DogTestCases;
import testHelpers.genericClasses.classTestCases.pokemon.PokemonTrainerTestCases;
import testHelpers.genericClasses.classTestCases.shape.CircleTestCases;
import testHelpers.genericClasses.classTestCases.shape.ShapeTestCases;
import testHelpers.genericClasses.classTestCases.shoppingList.ShoppingListTestCases;
public class GenericClassTests {
@Test
public void testOnCarClass() {
CaseTester<Car> carCaseTester = new CaseTester<>();
carCaseTester
.addCase(CarTestCases.filterFieldExtraction) // Add as many cases as you like
.addCase(CarTestCases.filterTrivialOr)
.addCase(CarTestCases.filterTrivialNot)
.addCase(CarTestCases.filterNotThenBrackets)
.addCase(CarTestCases.filterNotNot)
.addCase(CarTestCases.orderByEnginetypeThenHorsepowerDesc)
.testCases();
}
@Test
public void testOnDogClass() {
CaseTester<Dog> dogCaseTester = new CaseTester<>();
dogCaseTester
.addCase(DogTestCases.filterTrivialEqualString)
.addCase(DogTestCases.filterTrivialListField)
.addCase(DogTestCases.orderByNameDesc)
.addCase(DogTestCases.pagination10skip10top)
.testCases();
}
@Test
public void testOnShapeClass() {
CaseTester<Shape> shapeCaseTester = new CaseTester<>();
shapeCaseTester
.addCase(ShapeTestCases.filterSuperClassField)
.addCase(ShapeTestCases.OrderBySuperClassField)
.addCase(ShapeTestCases.filterAndOrderByEmptyQuery)
.addCase(ShapeTestCases.emptyQuery)
.testCases();
}
@Test
public void testOnCircleClass() {
CaseTester<Circle> circleCaseTester = new CaseTester<>();
circleCaseTester
.addCase(CircleTestCases.filterComplexQueryPrecedence)
.addCase(CircleTestCases.orderByRadius)
.addCase(CircleTestCases.filterAndOrderByComplexQuery)
.addCase(CircleTestCases.orderByAndFilterComplexQuery)
.addCase(CircleTestCases.filterAndOrderByComplexFullURL)
.testCases();
}
@Test
public void testOnShoppingListClass() {
CaseTester<ShoppingList> shoppingListCaseTester = new CaseTester<>();
shoppingListCaseTester
.addCase(ShoppingListTestCases.filterTrivialBoolean)
.addCase(ShoppingListTestCases.filterExtractFieldInList)
.testCases();
}
@Test
public void testOnPokemonTrainerClass() {
CaseTester<PokemonTrainer> pokemonTrainerCaseTester = new CaseTester<>();
pokemonTrainerCaseTester
.addCase(PokemonTrainerTestCases.filterOnIntArray)
.addCase(PokemonTrainerTestCases.orderByOnIntArray)
.addCase(PokemonTrainerTestCases.filterOnObjectArray)
.addCase(PokemonTrainerTestCases.orderByOnObjectArray)
.testCases();
}
@Test
public void testOnDeveloperClass() {
CaseTester<Developer> developerCaseTester = new CaseTester<>();
developerCaseTester
.addCase(DeveloperTestCases.filterWithNullAgeBetween30And40)
.addCase(DeveloperTestCases.filterWithNullOnSubclass)
.addCase(DeveloperTestCases.orderByLanguagesWithNullOnList)
.addCase(DeveloperTestCases.orderByLanguagesThenProjects)
.addCase(DeveloperTestCases.filterRoleEnum)
.testCases();
}
@Test
public void testOnDataTypeHolderClass() {
CaseTester<DataTypeHolder> dataTypeHolderCaseTester = new CaseTester<>();
dataTypeHolderCaseTester
// usual data types:
.addCase(DataTypeHolderTestCases.filterBooleanField)
.addCase(DataTypeHolderTestCases.filterStringField)
.addCase(DataTypeHolderTestCases.orderByIntegerFieldDesc)
// not so usual data types:
.addCase(DataTypeHolderTestCases.filterCharField)
.testCases();
}
}