|
40 | 40 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdLong; |
41 | 41 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdLongRepository; |
42 | 42 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdString; |
| 43 | +import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdStringNoAutoGenerate; |
| 44 | +import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdStringNoAutoGenerateRepository; |
43 | 45 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdStringRepository; |
44 | 46 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdUuid; |
45 | 47 | import software.xdev.spring.data.eclipse.store.integration.isolated.tests.id.model.CustomerWithIdUuidRepository; |
@@ -136,6 +138,45 @@ void saveBulkWithAutoIdIntAndHardcodedId(@Autowired final CustomerWithIdIntRepos |
136 | 138 | ); |
137 | 139 | } |
138 | 140 |
|
| 141 | + @Test |
| 142 | + void saveBulkWithNoAutoIdIntSameId( |
| 143 | + @Autowired final CustomerWithIdIntegerNoAutoGenerateRepository customerRepository) |
| 144 | + { |
| 145 | + final CustomerWithIdIntegerNoAutoGenerate customer1 = |
| 146 | + new CustomerWithIdIntegerNoAutoGenerate(1, TestData.FIRST_NAME, TestData.LAST_NAME); |
| 147 | + final CustomerWithIdIntegerNoAutoGenerate customer2 = |
| 148 | + new CustomerWithIdIntegerNoAutoGenerate(1, TestData.FIRST_NAME, TestData.LAST_NAME); |
| 149 | + Assertions.assertThrows( |
| 150 | + IllegalArgumentException.class, |
| 151 | + () -> customerRepository.saveAll(List.of(customer1, customer2)) |
| 152 | + ); |
| 153 | + } |
| 154 | + |
| 155 | + @Test |
| 156 | + void saveBulkWithNoAutoIdStringSameId( |
| 157 | + @Autowired final CustomerWithIdStringNoAutoGenerateRepository customerRepository) |
| 158 | + { |
| 159 | + final CustomerWithIdStringNoAutoGenerate customer1 = |
| 160 | + new CustomerWithIdStringNoAutoGenerate("1", TestData.FIRST_NAME, TestData.LAST_NAME); |
| 161 | + final CustomerWithIdStringNoAutoGenerate customer2 = |
| 162 | + new CustomerWithIdStringNoAutoGenerate("1", TestData.FIRST_NAME, TestData.LAST_NAME); |
| 163 | + Assertions.assertThrows( |
| 164 | + IllegalArgumentException.class, |
| 165 | + () -> customerRepository.saveAll(List.of(customer1, customer2)) |
| 166 | + ); |
| 167 | + } |
| 168 | + |
| 169 | + @Test |
| 170 | + void saveBulkWithNoAutoIdStringDifferentId( |
| 171 | + @Autowired final CustomerWithIdStringNoAutoGenerateRepository customerRepository) |
| 172 | + { |
| 173 | + final CustomerWithIdStringNoAutoGenerate customer1 = |
| 174 | + new CustomerWithIdStringNoAutoGenerate("1", TestData.FIRST_NAME, TestData.LAST_NAME); |
| 175 | + final CustomerWithIdStringNoAutoGenerate customer2 = |
| 176 | + new CustomerWithIdStringNoAutoGenerate("2", TestData.FIRST_NAME, TestData.LAST_NAME); |
| 177 | + Assertions.assertDoesNotThrow(() -> customerRepository.saveAll(List.of(customer1, customer2))); |
| 178 | + } |
| 179 | + |
139 | 180 | /** |
140 | 181 | * In other tests {@link EclipseStoreStorage#clearData} is called. Here the datastore is restarted again to ensure |
141 | 182 | * no previous method is called before the test. |
|
0 commit comments