@@ -44,17 +44,19 @@ class TypesTest
4444 public static final String TYPES_DATA_SOURCE =
4545 "software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types"
4646 + ".TypesData#generateData" ;
47+ public static final String TYPES_NOT_WORKING_DATA_SOURCE =
48+ "software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types"
49+ + ".TypesData#generateNotWorkingData" ;
4750
4851 @ Autowired
4952 private EclipseStoreStorage storage ;
5053
5154 @ ParameterizedTest
5255 @ MethodSource (TYPES_DATA_SOURCE )
53- @ Disabled ("Should get fixed" )
54- <T > void simpleStoreAndRead (
56+ <T extends ComplexObject <?>> void simpleStoreAndRead (
5557 final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
5658 final Function <Integer , T > objectCreator ,
57- final Consumer <T > objectChanger ,
59+ final Consumer <T > ignoredObjectChanger ,
5860 @ Autowired final ApplicationContext context )
5961 {
6062 final EclipseStoreRepository <T , Integer > repository = context .getBean (repositoryClass );
@@ -64,39 +66,50 @@ <T> void simpleStoreAndRead(
6466 TestUtil .doBeforeAndAfterRestartOfDatastore (
6567 this .storage ,
6668 () -> {
67- final List <T > customers = TestUtil .iterableToList (repository .findAll ());
68- Assertions .assertEquals (1 , customers .size ());
69- Assertions .assertEquals (objectToStore , customers .get (0 ));
69+ final List <T > storedObjects = TestUtil .iterableToList (repository .findAll ());
70+ Assertions .assertEquals (1 , storedObjects .size ());
71+ Assertions .assertEquals (objectToStore , storedObjects .get (0 ));
7072 }
7173 );
7274 }
7375
76+ @ ParameterizedTest
77+ @ MethodSource (TYPES_NOT_WORKING_DATA_SOURCE )
78+ <T extends ComplexObject <?>> void simpleStoreAndReadForNotWorkingTypes (
79+ final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
80+ final Function <Integer , T > objectCreator ,
81+ final Consumer <T > ignoredObjectChanger ,
82+ @ Autowired final ApplicationContext context )
83+ {
84+ Assertions .assertThrows (
85+ Exception .class ,
86+ () -> this .simpleChangeAfterStore (repositoryClass , objectCreator , ignoredObjectChanger , context ));
87+ }
88+
7489 @ ParameterizedTest
7590 @ MethodSource (TYPES_DATA_SOURCE )
76- @ Disabled ("Should get fixed" )
77- <T extends ComplexObject > void simpleChangeToNullAfterStore (
91+ <T extends ComplexObject <?>> void simpleChangeToNullAfterStore (
7892 final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
7993 final Function <Integer , T > objectCreator ,
80- final Consumer <T > objectChanger ,
94+ final Consumer <T > ignoredObjectChanger ,
8195 @ Autowired final ApplicationContext context )
8296 {
8397 this .simpleChangeAfterStore (repositoryClass , objectCreator , object -> object .setValue (null ), context );
8498 }
8599
86100 @ ParameterizedTest
87101 @ MethodSource (TYPES_DATA_SOURCE )
88- @ Disabled ("Should get fixed" )
89- <T extends ComplexObject > void simpleChangeAfterStore (
102+ <T extends ComplexObject <?>> void simpleChangeAfterStore (
90103 final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
91104 final Function <Integer , T > objectCreator ,
92105 final Consumer <T > objectChanger ,
93106 @ Autowired final ApplicationContext context )
94107 {
95108 final EclipseStoreRepository <T , Integer > repository = context .getBean (repositoryClass );
96- final T objectToStore = objectCreator .apply (2 );
109+ final T objectToStore = objectCreator .apply (1 );
97110 repository .save (objectToStore );
98111
99- final Optional <T > storedObject = repository .findById (2 );
112+ final Optional <T > storedObject = repository .findById (1 );
100113 Assertions .assertTrue (storedObject .isPresent ());
101114
102115 objectChanger .accept (storedObject .get ());
@@ -105,7 +118,7 @@ <T extends ComplexObject> void simpleChangeAfterStore(
105118 TestUtil .doBeforeAndAfterRestartOfDatastore (
106119 this .storage ,
107120 () -> {
108- final Optional <T > storedObject2 = repository .findById (2 );
121+ final Optional <T > storedObject2 = repository .findById (1 );
109122 Assertions .assertTrue (storedObject2 .isPresent ());
110123 Assertions .assertEquals (storedObject , storedObject2 );
111124 }
@@ -114,22 +127,48 @@ <T extends ComplexObject> void simpleChangeAfterStore(
114127
115128 @ ParameterizedTest
116129 @ MethodSource (TYPES_DATA_SOURCE )
117- @ Disabled ("Should get fixed" )
118- <T extends ComplexObject > void simpleChangeBeforeStore (
130+ // TODO: Fix this.
131+ @ Disabled ("Is not fixed yet, but will be." )
132+ <T extends ComplexObject <?>> void doubleStoreSameEntityWithChange (
119133 final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
120134 final Function <Integer , T > objectCreator ,
121135 final Consumer <T > objectChanger ,
122136 @ Autowired final ApplicationContext context )
123137 {
124138 final EclipseStoreRepository <T , Integer > repository = context .getBean (repositoryClass );
125- final T objectToStore = objectCreator .apply (3 );
139+ final T objectToStore = objectCreator .apply (1 );
140+ repository .save (objectToStore );
141+
142+ objectChanger .accept (objectToStore );
143+ repository .save (objectToStore );
144+
145+ TestUtil .doBeforeAndAfterRestartOfDatastore (
146+ this .storage ,
147+ () -> {
148+ final Optional <T > storedObject = repository .findById (1 );
149+ Assertions .assertTrue (storedObject .isPresent ());
150+ Assertions .assertEquals (objectToStore , storedObject .get ());
151+ }
152+ );
153+ }
154+
155+ @ ParameterizedTest
156+ @ MethodSource (TYPES_DATA_SOURCE )
157+ <T extends ComplexObject <?>> void simpleChangeBeforeStore (
158+ final Class <? extends EclipseStoreRepository <T , Integer >> repositoryClass ,
159+ final Function <Integer , T > objectCreator ,
160+ final Consumer <T > objectChanger ,
161+ @ Autowired final ApplicationContext context )
162+ {
163+ final EclipseStoreRepository <T , Integer > repository = context .getBean (repositoryClass );
164+ final T objectToStore = objectCreator .apply (1 );
126165 objectChanger .accept (objectToStore );
127166 repository .save (objectToStore );
128167
129168 TestUtil .doBeforeAndAfterRestartOfDatastore (
130169 this .storage ,
131170 () -> {
132- final Optional <T > storedObject2 = repository .findById (3 );
171+ final Optional <T > storedObject2 = repository .findById (1 );
133172 Assertions .assertTrue (storedObject2 .isPresent ());
134173 Assertions .assertEquals (objectToStore , storedObject2 .get ());
135174 }
0 commit comments