|
|
|
@ -19,6 +19,8 @@ import org.springframework.test.context.ContextConfiguration; |
|
|
|
|
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubEvent; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubeventHasPerson; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.ClubeventHasPerson; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.CompetitionType; |
|
|
|
|
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.CompetitionType.Type; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.tests.TestConfiguration; |
|
|
|
import de.kreth.vaadin.clubhelper.vaadinclubhelper.ui.tests.TestConfiguration; |
|
|
|
|
|
|
|
|
|
|
|
@ -37,6 +39,26 @@ public class ClubEventDataTest { |
|
|
|
testDatabaseHelper.cleanDatabase(); |
|
|
|
testDatabaseHelper.cleanDatabase(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testEventAddon() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClubEvent ev = testDatabaseHelper.creteEvent(); |
|
|
|
|
|
|
|
CompetitionType competitionType = new CompetitionType(); |
|
|
|
|
|
|
|
competitionType.setType(Type.EINZEL); |
|
|
|
|
|
|
|
ev.setCompetitionType(competitionType); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testDatabaseHelper.transactional(() -> entityManager.persist(ev)); |
|
|
|
|
|
|
|
List<ClubEvent> allClubEvent = testDatabaseHelper.allClubEvent(); |
|
|
|
|
|
|
|
assertEquals(1, allClubEvent.size()); |
|
|
|
|
|
|
|
assertEquals(Type.EINZEL, allClubEvent.get(0).getCompetitionType()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
competitionType.setType(Type.DOPPELMINI); |
|
|
|
|
|
|
|
testDatabaseHelper.transactional(() -> entityManager.merge(ev)); |
|
|
|
|
|
|
|
allClubEvent = testDatabaseHelper.allClubEvent(); |
|
|
|
|
|
|
|
assertEquals(1, allClubEvent.size()); |
|
|
|
|
|
|
|
assertEquals(Type.DOPPELMINI, allClubEvent.get(0).getCompetitionType()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testSaveAndSelectEvent() { |
|
|
|
public void testSaveAndSelectEvent() { |
|
|
|
ClubEvent ev = testDatabaseHelper.creteEvent(); |
|
|
|
ClubEvent ev = testDatabaseHelper.creteEvent(); |
|
|
|
|