Examples of StandingsHistory


Examples of org.newinstance.gucoach.model.StandingsHistory

     * @param team the team
     * @param matchDay the date of the matchday
     * @return a new entity
     */
    protected StandingsHistory createStandingsHistory(final Team team, final Date matchDay) {
        final StandingsHistory standingsHistory = new StandingsHistory();
        standingsHistory.setMatchesWon(2);
        standingsHistory.setMatchesDrawn(1);
        standingsHistory.setMatchesLost(3);
        standingsHistory.setGoalsFor(4);
        standingsHistory.setGoalsAgainst(7);
        standingsHistory.setMatchDay(matchDay);
        standingsHistory.setPosition(6);
        standingsHistory.setTeam(team);
        return standingsHistory;
    }
View Full Code Here

Examples of org.newinstance.gucoach.model.StandingsHistory

        em.getTransaction().commit();

        final Date matchDay = new Date();
        team = teamService.findAllTeams().get(0);

        final StandingsHistory standingsHistory = createStandingsHistory(team, matchDay);
        standingsHistoryService.insertStandingsHistory(standingsHistory);

        StandingsHistory result = standingsHistoryService.findStandingsHistoryByTeamAndDate(team, matchDay);
        Assert.assertNotNull(result);
        Assert.assertEquals(team.getId(), result.getTeam().getId());

        // DELETE
        em.getTransaction().begin();
        standingsHistoryService.removeAllStandingsHistory();
        em.getTransaction().commit();
View Full Code Here

Examples of org.newinstance.gucoach.model.StandingsHistory

        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Olympique Marseille", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory1 = createStandingsHistory(team, matchDay1);

        final Calendar matchDay2 = Calendar.getInstance();
        matchDay2.set(Calendar.DAY_OF_MONTH, -1);
        final StandingsHistory standingsHistory2 = createStandingsHistory(team, matchDay2.getTime());

        em.getTransaction().begin();
        teamService.insertTeams(teams);
        standingsHistoryService.insertStandingsHistory(standingsHistory1);
        standingsHistoryService.insertStandingsHistory(standingsHistory2);
        em.getTransaction().commit();

        StandingsHistory result = standingsHistoryService.findStandingsHistoryByTeamAndDate(team, standingsHistory1.getMatchDay());
        Assert.assertEquals(team, result.getTeam());
        result = standingsHistoryService.findStandingsHistoryByTeamAndDate(team, standingsHistory2.getMatchDay());
        Assert.assertEquals(team, result.getTeam());

        // DELETE
        em.getTransaction().begin();
        standingsHistoryService.removeAllStandingsHistory();
        em.getTransaction().commit();
View Full Code Here

Examples of org.newinstance.gucoach.model.StandingsHistory

        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Olympique Marseille", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory = createStandingsHistory(team, matchDay1);

        em.getTransaction().begin();
        teamService.insertTeams(teams);
        standingsHistoryService.insertStandingsHistory(standingsHistory);
        em.getTransaction().commit();

        Assert.assertEquals(4, standingsHistory.getGoalsFor().intValue());

        // UPDATE
        standingsHistory.setGoalsFor(20);
        standingsHistory.setPosition(1);

        em.getTransaction().commit();
        standingsHistoryService.updateStandingsHistory(standingsHistory);
        em.getTransaction().commit();

        final StandingsHistory result = standingsHistoryService.findStandingsHistoryByTeamAndDate(team, matchDay1);
        Assert.assertEquals(20, result.getGoalsFor().intValue());
        Assert.assertEquals(1, result.getPosition().intValue());
    }
View Full Code Here

Examples of org.newinstance.gucoach.model.StandingsHistory

        final List<Team> teams = new ArrayList<Team>();
        Team team = createTeam("Paris SG", 1);
        teams.add(team);

        final Date matchDay1 = Calendar.getInstance().getTime();
        final StandingsHistory standingsHistory1 = createStandingsHistory(team, matchDay1);

        final StandingsHistory standingsHistory2 = createStandingsHistory(team, matchDay1);

        em.getTransaction().begin();
        teamService.insertTeams(teams);
        standingsHistoryService.insertStandingsHistory(standingsHistory1);
        standingsHistoryService.insertStandingsHistory(standingsHistory2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.