Skip to content

Commit

Permalink
Remove extra deleteAll(). Because of that - GH build failed
Browse files Browse the repository at this point in the history
(On GH - DAO test run before controller test, so last was failed because of out migrated records in DB)
  • Loading branch information
andrei-punko committed Sep 4, 2024
1 parent cc8c1ce commit 227a125
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ public class ArticleRepositoryCustomImplTest {

@BeforeEach
void setUp() {
repository.deleteAll();
entity = buildArticle("Ivan", "HD", "FR", "Brest");
entity2 = buildArticle("Vasily", "HD", "BY", "Brest");
entity3 = buildArticle("Ivan", "4K", "BY", "Minsk");
repository.saveAll(Arrays.asList(entity, entity2, entity3));
repository.saveAll(List.of(entity, entity2, entity3));
}

public static Article buildArticle(String title, String summary, String country, String city) {
Expand All @@ -50,7 +49,7 @@ public static Article buildArticle(String title, String summary, String country,

@AfterEach
public void tearDown() {
repository.deleteAll();
repository.deleteAll(List.of(entity, entity2, entity3));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -31,23 +32,22 @@ class ArticleRepositoryTest {

@BeforeEach
public void setup() {
repository.deleteAll();
entity = buildArticle("Ivan", "HD", LocalDateTime.parse("2010-12-03T10:15:30"));
entity2 = buildArticle("Vasily", "HD", LocalDateTime.parse("2011-12-03T10:15:30"));
entity3 = buildArticle("Ivan", "4K", LocalDateTime.parse("2012-12-03T10:15:30"));
repository.saveAll(Arrays.asList(entity, entity2, entity3));
repository.saveAll(List.of(entity, entity2, entity3));
}

@AfterEach
public void tearDown() {
repository.deleteAll();
repository.deleteAll(List.of(entity, entity2, entity3));
}

@Test
public void findAll() {
var result = repository.findAll(Pageable.ofSize(10));
var result = repository.findAll(Pageable.ofSize(2));

assertThat("Wrong records amount", result.getNumberOfElements(), is(3));
assertThat("Wrong records amount", result.getNumberOfElements(), is(2));
}

@Test
Expand Down

0 comments on commit 227a125

Please sign in to comment.