Skip to content

Commit 48bc6aa

Browse files
committed
Polishing.
Add integration tests. See #3990 Original pull request: #3993
1 parent d73a925 commit 48bc6aa

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/support/EclipseLinkJpaRepositoryTests.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,68 @@
1515
*/
1616
package org.springframework.data.jpa.repository.support;
1717

18+
import static org.assertj.core.api.Assertions.*;
19+
20+
import jakarta.persistence.EntityManager;
21+
import jakarta.persistence.PersistenceContext;
22+
23+
import java.util.List;
24+
25+
import org.junit.jupiter.api.BeforeEach;
1826
import org.junit.jupiter.api.Disabled;
27+
import org.junit.jupiter.api.Test;
28+
29+
import org.springframework.data.jpa.domain.sample.User;
1930
import org.springframework.test.context.ContextConfiguration;
2031

2132
/**
2233
* Integration tests to execute {@link JpaRepositoryTests} against EclipseLink.
2334
*
2435
* @author Oliver Gierke
2536
* @author Greg Turnquist
37+
* @author Mark Paluch
2638
*/
2739
@ContextConfiguration("classpath:eclipselink.xml")
2840
class EclipseLinkJpaRepositoryTests extends JpaRepositoryTests {
2941

42+
@PersistenceContext EntityManager em;
43+
44+
SimpleJpaRepository<User, Integer> repository;
45+
User firstUser, secondUser;
46+
47+
@BeforeEach
48+
@Override
49+
void setUp() {
50+
51+
super.setUp();
52+
53+
repository = new SimpleJpaRepository<>(User.class, em);
54+
55+
firstUser = new User("Oliver", "Gierke", "[email protected]");
56+
firstUser.setAge(28);
57+
secondUser = new User("Joachim", "Arrasz", "[email protected]");
58+
secondUser.setAge(35);
59+
60+
repository.deleteAll();
61+
repository.saveAllAndFlush(List.of(firstUser, secondUser));
62+
}
63+
64+
@Test // GH-3990
65+
void deleteAllBySimpleIdInBatch() {
66+
67+
repository.deleteAllByIdInBatch(List.of(firstUser.getId(), secondUser.getId()));
68+
69+
assertThat(repository.count()).isZero();
70+
}
71+
72+
@Test // GH-3990
73+
void deleteAllInBatch() {
74+
75+
repository.deleteAllInBatch(List.of(firstUser, secondUser));
76+
77+
assertThat(repository.count()).isZero();
78+
}
79+
3080
@Override
3181
@Disabled("https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477")
3282
void deleteAllByIdInBatch() {
@@ -38,4 +88,5 @@ void deleteAllByIdInBatch() {
3888
void deleteAllByIdInBatchShouldConvertAnIterableToACollection() {
3989
// disabled
4090
}
91+
4192
}

0 commit comments

Comments
 (0)