Tests fixed.

master
Markus Kreth 7 years ago
parent 45eefaebd3
commit 3a2f410398
  1. 5
      .classpath
  2. 1
      .settings/org.eclipse.core.resources.prefs
  3. 35
      .settings/org.eclipse.wst.common.component
  4. 12
      pom.xml
  5. 42
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/business/EventBusinessSpringTest.java
  6. 2
      src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionGroupTest.java

@ -26,19 +26,20 @@
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="target/generated-resources/gwt"> <classpathentry excluding="**" kind="src" output="target/classes" path="target/generated-resources/gwt">
<attributes> <attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>

@ -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/main/resources/jasper/calendar_year.jrxml=UTF-8
encoding//src/test/java=UTF-8 encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8 encoding//src/test/resources=UTF-8
encoding//target/generated-resources/gwt=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8

@ -1,54 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="vaadin-clubhelper-0.0.2-SNAPSHOT">
<wb-module deploy-name="vaadin-clubhelper-1.0.2-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/WebContent"/> <wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/gwt"/>
<property name="context-root" value="vaadin-clubhelper"/> <property name="context-root" value="vaadin-clubhelper"/>
<property name="java-output-path" value="/vaadin-clubhelper/target/classes"/> <property name="java-output-path" value="/vaadin-clubhelper/target/classes"/>
</wb-module> </wb-module>

@ -152,16 +152,20 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- <dependency> -->
<!-- <groupId>org.seleniumhq.selenium</groupId> -->
<!-- <artifactId>selenium-server</artifactId> -->
<!-- <version>${selenium.version}</version> -->
<!-- <scope>test</scope> -->
<!-- </dependency> -->
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId> <artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId> <artifactId>selenium-api</artifactId>
<version>${selenium.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

@ -1,7 +1,7 @@
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business; 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.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
@ -46,6 +46,7 @@ class EventBusinessSpringTest {
@BeforeEach @BeforeEach
void setUp() throws Exception { void setUp() throws Exception {
testDatabaseHelper.cleanDatabase();
insertTestData(); insertTestData();
eventBusiness.setSelected(event); eventBusiness.setSelected(event);
@ -60,21 +61,20 @@ class EventBusinessSpringTest {
private void insertTestData() { private void insertTestData() {
persons = new ArrayList<>(); persons = new ArrayList<>();
testDatabaseHelper.transactional(() -> {
entityManager.getTransaction().begin(); for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
Person p = new Person();
Person p = new Person(); p.setPrename("prename_" + i);
p.setPrename("prename_" + i); p.setSurname("surname_" + i);
p.setSurname("surname_" + i); p.setBirth(LocalDate.now());
p.setBirth(LocalDate.now()); entityManager.persist(p);
entityManager.persist(p); persons.add(p);
persons.add(p); }
} event = testDatabaseHelper.creteEvent();
event = testDatabaseHelper.creteEvent(); assertNull(event.getPersons());
assertNull(event.getPersons()); entityManager.persist(event);
entityManager.persist(event); });
entityManager.getTransaction().commit();
} }
@Test @Test
@ -94,14 +94,8 @@ class EventBusinessSpringTest {
@Disabled @Disabled
void testAddPersonsToEvent() { void testAddPersonsToEvent() {
assertEquals(0, all.getResultList().size()); assertEquals(0, all.getResultList().size());
testDatabaseHelper.transactional(() -> eventBusiness.changePersons(new HashSet<>(persons.subList(0, 1))));
entityManager.getTransaction().begin(); testDatabaseHelper.transactional(() -> eventBusiness.changePersons(new HashSet<>(persons.subList(0, 2))));
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();
List<ClubeventHasPerson> result = all.getResultList(); List<ClubeventHasPerson> result = all.getResultList();
assertEquals(2, result.size()); assertEquals(2, result.size());

@ -7,10 +7,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@Disabled
public class CompetitionGroupTest { public class CompetitionGroupTest {
@Test @Test

Loading…
Cancel
Save