Skip to content

Commit e30431e

Browse files
Added test for immutable findAll result
1 parent 425143e commit e30431e

File tree

1 file changed

+10
-1
lines changed
  • spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests

1 file changed

+10
-1
lines changed

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/tests/RealLifeTests.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ void testReplacePositionWithNewArticleAndUseImmutableList()
190190
{
191191
this.buildDefaultModelAndSaveIt();
192192

193-
final List<Position> positions = this.positionRepository.findAll();
193+
final List<Position> positions = new ArrayList<>(this.positionRepository.findAll());
194194
createAndAddShoeToPosition(positions);
195195
this.positionRepository.saveAll(positions);
196196

@@ -213,6 +213,15 @@ private static void createAndAddShoeToPosition(final List<Position> positions)
213213
positions.add(new Position(shoe, 4));
214214
}
215215

216+
@Test
217+
void addPositionToFoundPositions()
218+
{
219+
this.buildDefaultModelAndSaveIt();
220+
221+
final List<Position> positions = this.positionRepository.findAll();
222+
Assertions.assertThrows(UnsupportedOperationException.class, () -> positions.add(new Position(null, 0)));
223+
}
224+
216225
@Test
217226
void testSaveTwoObjectsWithSameReferenceThroughPositionRepository()
218227
{

0 commit comments

Comments
 (0)