Search in sources :

Example 26 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamDAOTest method test_can_find_a_team_by_name.

@MediumTest
public void test_can_find_a_team_by_name() {
    dao.save(new Team("Test Team 1"));
    Team team = dao.findByName("Test Team 1");
    assertEquals("Test Team 1", team.getName());
    assertNotNull(team.getId());
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 27 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class MeetingTest method test_find_all_meetings_by_team.

@MediumTest
public void test_find_all_meetings_by_team() {
    Team team = new Team("Test Team");
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    List<Meeting> meetings = Meeting.findAllByTeam(team, mContext);
    assertEquals(5, meetings.size());
    assertEquals(new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), meetings.get(0).getDateTime());
    assertEquals(new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), meetings.get(1).getDateTime());
    assertEquals(new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), meetings.get(2).getDateTime());
    assertEquals(new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), meetings.get(3).getDateTime());
    assertEquals(new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), meetings.get(4).getDateTime());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 28 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class MeetingTest method test_find_by_team_and_date.

@MediumTest
public void test_find_by_team_and_date() {
    Team team = new Team("Test Team");
    new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    Meeting expected = new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120).save(mContext);
    ;
    Meeting actual = Meeting.findByTeamAndDate(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), mContext);
    assertEquals(expected.getId(), actual.getId());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 29 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamTest method test_delete_a_team.

@MediumTest
public void test_delete_a_team() {
    Team team = Team.create("Test Team", mContext);
    assertEquals(1, Team.findAllTeamNames(mContext).size());
    team.delete(mContext);
    assertEquals(0, Team.findAllTeamNames(mContext).size());
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 30 with Team

use of net.johnpwood.android.standuptimer.model.Team in project standup-timer by jwood.

the class TeamTest method test_get_average_meeting_stats.

@MediumTest
public void test_get_average_meeting_stats() {
    Team team = Team.create("Test Team", mContext);
    Date dateTime = new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime();
    new Meeting(team, dateTime, 5, 301, 343, 30, 65).save(mContext);
    new Meeting(team, dateTime, 8, 534, 550, 32, 120).save(mContext);
    new Meeting(team, dateTime, 2, 234, 300, 23, 122).save(mContext);
    new Meeting(team, dateTime, 3, 765, 765, 15, 78).save(mContext);
    new Meeting(team, dateTime, 9, 444, 445, 10, 93).save(mContext);
    MeetingStats averageStats = team.getAverageMeetingStats(mContext);
    assertEquals(5.4f, averageStats.getNumParticipants());
    assertEquals(455.6f, averageStats.getIndividualStatusLength());
    assertEquals(480.6f, averageStats.getMeetingLength());
    assertEquals(22f, averageStats.getQuickestStatus());
    assertEquals(95.6f, averageStats.getLongestStatus());
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) MeetingStats(net.johnpwood.android.standuptimer.model.MeetingStats) Date(java.util.Date) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

Team (net.johnpwood.android.standuptimer.model.Team)37 MediumTest (android.test.suitebuilder.annotation.MediumTest)28 Meeting (net.johnpwood.android.standuptimer.model.Meeting)17 GregorianCalendar (java.util.GregorianCalendar)16 Date (java.util.Date)3 ContentValues (android.content.ContentValues)2 Context (android.content.Context)2 Cursor (android.database.Cursor)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)2 RenamingDelegatingContext (android.test.RenamingDelegatingContext)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 CannotUpdateMeetingException (net.johnpwood.android.standuptimer.dao.CannotUpdateMeetingException)1 DuplicateTeamException (net.johnpwood.android.standuptimer.dao.DuplicateTeamException)1 InvalidTeamNameException (net.johnpwood.android.standuptimer.dao.InvalidTeamNameException)1 MeetingStats (net.johnpwood.android.standuptimer.model.MeetingStats)1