diff --git a/code/common/db/src/test/java/nu/marginalia/db/DomainRankingSetsServiceTest.java b/code/common/db/src/test/java/nu/marginalia/db/DomainRankingSetsServiceTest.java index 999f1a7e..797e2b55 100644 --- a/code/common/db/src/test/java/nu/marginalia/db/DomainRankingSetsServiceTest.java +++ b/code/common/db/src/test/java/nu/marginalia/db/DomainRankingSetsServiceTest.java @@ -33,6 +33,14 @@ class DomainRankingSetsServiceTest { dataSource = new HikariDataSource(config); TestMigrationLoader.flywayMigration(dataSource); + + // The migration SQL will insert a few default values, we want to remove them + wipeDomainRankingSets(dataSource); + } + + @AfterEach + public void tearDown() { + wipeDomainRankingSets(dataSource); } @AfterAll @@ -45,10 +53,6 @@ class DomainRankingSetsServiceTest { public void testScenarios() throws Exception { var service = new DomainRankingSetsService(dataSource); - // Clean up default values - service.get("BLOGS").ifPresent(service::delete); - service.get("NONE").ifPresent(service::delete); - var newValue = new DomainRankingSetsService.DomainRankingSet( "test", "Test domain set", @@ -81,4 +85,9 @@ class DomainRankingSetsServiceTest { allValues = service.getAll(); assertEquals(0, allValues.size()); } + + private static void wipeDomainRankingSets(HikariDataSource dataSource) { + var service = new DomainRankingSetsService(dataSource); + service.getAll().forEach(service::delete); + } } \ No newline at end of file