diff --git a/.classpath b/.classpath index 566d50e..c12c8d0 100644 --- a/.classpath +++ b/.classpath @@ -26,19 +26,20 @@ - + + - + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index f004f42..6d88dab 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -5,4 +5,5 @@ encoding//src/main/resources/jasper/calendar_month.jrxml=UTF-8 encoding//src/main/resources/jasper/calendar_year.jrxml=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 +encoding//target/generated-resources/gwt=UTF-8 encoding/=UTF-8 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 687d094..8216514 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,54 +1,65 @@ - + - - + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + diff --git a/pom.xml b/pom.xml index 9959344..3bafbcd 100644 --- a/pom.xml +++ b/pom.xml @@ -152,16 +152,20 @@ test + + + + + + org.seleniumhq.selenium - selenium-server - ${selenium.version} + selenium-java test org.seleniumhq.selenium - selenium-java - ${selenium.version} + selenium-api test diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusinessSpringTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusinessSpringTest.java index 67cd0fa..1560196 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusinessSpringTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusinessSpringTest.java @@ -1,7 +1,7 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.business; -import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.time.LocalDate; import java.util.ArrayList; @@ -46,6 +46,7 @@ class EventBusinessSpringTest { @BeforeEach void setUp() throws Exception { + testDatabaseHelper.cleanDatabase(); insertTestData(); eventBusiness.setSelected(event); @@ -60,21 +61,20 @@ class EventBusinessSpringTest { private void insertTestData() { persons = new ArrayList<>(); - - entityManager.getTransaction().begin(); - for (int i = 0; i < 3; i++) { - - Person p = new Person(); - p.setPrename("prename_" + i); - p.setSurname("surname_" + i); - p.setBirth(LocalDate.now()); - entityManager.persist(p); - persons.add(p); - } - event = testDatabaseHelper.creteEvent(); - assertNull(event.getPersons()); - entityManager.persist(event); - entityManager.getTransaction().commit(); + testDatabaseHelper.transactional(() -> { + for (int i = 0; i < 3; i++) { + + Person p = new Person(); + p.setPrename("prename_" + i); + p.setSurname("surname_" + i); + p.setBirth(LocalDate.now()); + entityManager.persist(p); + persons.add(p); + } + event = testDatabaseHelper.creteEvent(); + assertNull(event.getPersons()); + entityManager.persist(event); + }); } @Test @@ -94,14 +94,8 @@ class EventBusinessSpringTest { @Disabled void testAddPersonsToEvent() { assertEquals(0, all.getResultList().size()); - - entityManager.getTransaction().begin(); - eventBusiness.changePersons(new HashSet<>(persons.subList(0, 1))); - entityManager.getTransaction().commit(); - - entityManager.getTransaction().begin(); - eventBusiness.changePersons(new HashSet<>(persons.subList(0, 2))); - entityManager.getTransaction().commit(); + testDatabaseHelper.transactional(() -> eventBusiness.changePersons(new HashSet<>(persons.subList(0, 1)))); + testDatabaseHelper.transactional(() -> eventBusiness.changePersons(new HashSet<>(persons.subList(0, 2)))); List result = all.getResultList(); assertEquals(2, result.size()); diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionGroupTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionGroupTest.java index e2eb711..cf9a0f2 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionGroupTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionGroupTest.java @@ -7,10 +7,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -@Disabled public class CompetitionGroupTest { @Test