diff --git a/pom.xml b/pom.xml index 99cadc3..872ae90 100644 --- a/pom.xml +++ b/pom.xml @@ -184,12 +184,6 @@ ${selenium.version} test - - com.google.code.gson - gson - 2.8.2 - test - simple-jndi diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDatabaseTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDatabaseTest.java index d1aa362..be5370e 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDatabaseTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/AbstractDatabaseTest.java @@ -3,7 +3,7 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Adress; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Attendance; @@ -22,7 +22,7 @@ public abstract class AbstractDatabaseTest { protected SessionFactory sessionFactory; protected Session session; - @Before + @BeforeEach public void setUp() throws Exception { // setup the session factory @@ -46,15 +46,11 @@ public abstract class AbstractDatabaseTest { configuration.addAnnotatedClass(Startpaesse.class); configuration.addAnnotatedClass(StartpassStartrechte.class); configuration.addAnnotatedClass(Version.class); - configuration.addInputStream( - getClass().getResourceAsStream("/schema/ClubEvent.hbm.xml")); - - configuration.setProperty("hibernate.dialect", - "org.hibernate.dialect.H2Dialect"); - configuration.setProperty("hibernate.connection.driver_class", - "org.h2.Driver"); - configuration.setProperty("hibernate.connection.url", - "jdbc:h2:mem:test"); + configuration.addInputStream(getClass().getResourceAsStream("/schema/ClubEvent.hbm.xml")); + + configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); + configuration.setProperty("hibernate.connection.driver_class", "org.h2.Driver"); + configuration.setProperty("hibernate.connection.url", "jdbc:h2:mem:test"); configuration.setProperty("hibernate.hbm2ddl.auto", "create"); return configuration; } diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoTest.java index 94caf42..2067251 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDaoTest.java @@ -1,14 +1,14 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.List; import org.hibernate.query.Query; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -21,7 +21,7 @@ import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEventBuilder; @RunWith(SpringRunner.class) @DataJpaTest @EnableAutoConfiguration -@Ignore +@Disabled public class ClubEventDaoTest extends AbstractDatabaseTest { @Autowired @@ -34,22 +34,18 @@ public class ClubEventDaoTest extends AbstractDatabaseTest { public void storeEvent() { dao.save(creteEvent()); - Query query = session.createNamedQuery("ClubEvent.findAll", - ClubEvent.class); + Query query = session.createNamedQuery("ClubEvent.findAll", ClubEvent.class); List result = query.list(); assertEquals(1, result.size()); } private ClubEvent creteEvent() { - ClubEvent ev = ClubEventBuilder.builder().withId("id").withAllDay(true) - .withCaption("caption").withDescription("description") - .withStart(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, - ZoneId.systemDefault())) - .withEnd(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, - ZoneId.systemDefault())) - .withiCalUID("iCalUID") + ClubEvent ev = ClubEventBuilder.builder().withId("id").withAllDay(true).withCaption("caption") + .withDescription("description") + .withStart(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, ZoneId.systemDefault())) + .withEnd(ZonedDateTime.of(2018, 8, 13, 0, 0, 0, 0, ZoneId.systemDefault())).withiCalUID("iCalUID") .withOrganizerDisplayName("organizerDisplayName").build(); return ev; } - + } diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDataTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDataTest.java index 5a7eabd..ae187b0 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDataTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/ClubEventDataTest.java @@ -1,9 +1,9 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.sql.Connection; import java.sql.ResultSet; @@ -22,7 +22,7 @@ import org.hibernate.IdentifierLoadAccess; import org.hibernate.Transaction; import org.hibernate.jdbc.Work; import org.hibernate.query.Query; -import org.junit.Test; +import org.junit.jupiter.api.Test; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEventBuilder; @@ -58,7 +58,7 @@ public class ClubEventDataTest extends AbstractDatabaseTest { } tx.commit(); for (Person p : inserted) { - assertTrue("not saved: " + p, p.getId() > 0); + assertTrue(p.getId() > 0, "not saved: " + p); } return inserted; } diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoTest.java index faf7fbe..91dd8d1 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/dao/PersonDaoTest.java @@ -1,14 +1,14 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.dao; -import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.time.LocalDate; import java.util.List; import org.hibernate.Transaction; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; @@ -18,7 +18,7 @@ public class PersonDaoTest extends AbstractDatabaseTest { private Person person; @Override - @Before + @BeforeEach public void setUp() throws Exception { super.setUp(); personDao = new PersonDaoImpl(); diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionDetailsTest.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionDetailsTest.java index 5695d14..e91a23e 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionDetailsTest.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/data/CompetitionDetailsTest.java @@ -1,22 +1,21 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CompetitionDetailsTest extends AbstractCompetitionDataTests { @Test public void parseGroupInsertsElementPerLine() throws Exception { - + CompetitionDetails detail = new CompetitionDetails(); detail.parseCompetitionGroups(getGroupTable1()); assertEquals(8, detail.getCpGroups().size()); - + detail = new CompetitionDetails(); detail.parseCompetitionGroups(getGroupTable2()); assertEquals(6, detail.getCpGroups().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 53d6257..e2eb711 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 @@ -1,27 +1,29 @@ package de.kreth.vaadin.clubhelper.vaadinclubhelper.data; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Ignore +@Disabled public class CompetitionGroupTest { @Test public void testTwo4DigitYears() { - + CompetitionGroup group = CompetitionGroup.parseLine("Schüler – innen E 2008 -2009 P4"); assertEquals(2009, group.getYoungestBirthYear()); assertValuesOrder(group); - + group = CompetitionGroup.parseLine("Heranwachsende 2001-1995 P8"); assertEquals(1995, group.getOldestBirthYear()); assertValuesOrder(group); - + group = CompetitionGroup.parseLine("Jugend C: Jg. 2004/2005 W11 - W13"); assertEquals(2005, group.getYoungestBirthYear()); assertValuesOrder(group); @@ -29,11 +31,11 @@ public class CompetitionGroupTest { group = CompetitionGroup.parseLine("Schüler – innen E 2008 -2009 P4"); assertEquals(2008, group.getOldestBirthYear()); assertValuesOrder(group); - + group = CompetitionGroup.parseLine("Heranwachsende 2001-1995 P8"); assertEquals(2001, group.getYoungestBirthYear()); assertValuesOrder(group); - + group = CompetitionGroup.parseLine("Jugend C: Jg. 2004/2005 W11 - W13"); assertEquals(2004, group.getOldestBirthYear()); assertValuesOrder(group); @@ -47,7 +49,7 @@ public class CompetitionGroupTest { assertEquals(1996, group.getYoungestBirthYear()); assertValuesOrder(group); } - + @Test public void testParseCompulsory() { @@ -59,12 +61,12 @@ public class CompetitionGroupTest { group = CompetitionGroup.parseLine("Heranwachsende 2001-1995 P10"); assertEquals("P10", group.getCompulsory()); - + group = CompetitionGroup.parseLine("Jugend C: Jg. 2004/2005 W11 - W13"); assertEquals("W13", group.getCompulsory()); } - + @Test public void testOneYearIsOldest() { CompetitionGroup group = CompetitionGroup.parseLine("Schüler – innen F 2010 und jünger P3"); @@ -74,19 +76,19 @@ public class CompetitionGroupTest { group = CompetitionGroup.parseLine("Jugend E: 2008 und jünger P8 - W11"); assertEquals(2008, group.getOldestBirthYear()); assertValuesOrder(group); - + } - + @Test public void testTestConstructor() { CompetitionGroup g = new CompetitionGroup(2008, 2009); assertValuesOrder(g); } - + @Test public void testBirthYearTest() { CompetitionGroup g = new CompetitionGroup(2000, 2009); - for (int i = 2000; i<=2009; i++) { + for (int i = 2000; i <= 2009; i++) { assertTrue(g.isBirthyearInGroup(i)); } assertFalse(g.isBirthyearInGroup(0)); @@ -94,20 +96,20 @@ public class CompetitionGroupTest { assertFalse(g.isBirthyearInGroup(2010)); assertFalse(g.isBirthyearInGroup(9999)); } - + CompetitionGroup assertValuesOrder(CompetitionGroup g) { assertTrue(g.getOldestBirthYear() <= g.getYoungestBirthYear()); return g; } - + @Test public void testRegexPattern() { Pattern pattern = Pattern.compile("\\d{2,4}"); String twoYears = "text 1999 bis 2009 text"; Matcher matcher = pattern.matcher(twoYears); - assertTrue("didnt find first year", matcher.find()); + assertTrue(matcher.find(), "didnt find first year"); assertEquals("1999", matcher.group()); - assertTrue("didnt find second year", matcher.find()); + assertTrue(matcher.find(), "didnt find second year"); assertEquals("2009", matcher.group()); } } diff --git a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java index ed6be79..13eae30 100644 --- a/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java +++ b/src/test/java/de/kreth/vaadin/clubhelper/vaadinclubhelper/ui/tests/VaadinClubhelperApplicationTests.java @@ -25,8 +25,6 @@ import org.springframework.boot.web.server.LocalServerPort; public class VaadinClubhelperApplicationTests { private static ChromeOptions options; -// @Autowired -// private WebTestClient webClient; @LocalServerPort int port; @@ -41,7 +39,6 @@ public class VaadinClubhelperApplicationTests { options = new ChromeOptions(); options.setHeadless(!GraphicsEnvironment.isHeadless()); -// options.setPageLoadStrategy(PageLoadStrategy.EAGER); }