Search in sources :

Example 21 with Team

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

the class MeetingDAO method createMeetingFromCursorData.

private Meeting createMeetingFromCursorData(Cursor cursor) {
    long id = cursor.getLong(0);
    String teamName = cursor.getString(1);
    Date meetingTime = new Date(cursor.getLong(2));
    int numParticipants = cursor.getInt(3);
    int individualStatusLength = cursor.getInt(4);
    int meetingLength = cursor.getInt(5);
    int quickestStatus = cursor.getInt(6);
    int longestStatus = cursor.getInt(7);
    return new Meeting(id, new Team(teamName), meetingTime, numParticipants, individualStatusLength, meetingLength, quickestStatus, longestStatus);
}
Also used : Meeting(net.johnpwood.android.standuptimer.model.Meeting) Team(net.johnpwood.android.standuptimer.model.Team) Date(java.util.Date)

Example 22 with Team

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

the class MeetingDAOTest method test_delete_all_by_team.

@MediumTest
public void test_delete_all_by_team() {
    Team team = new Team("Test Team");
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    assertFalse(dao.findAllByTeam(team).isEmpty());
    dao.deleteAllByTeam(team);
    assertTrue(dao.findAllByTeam(team).isEmpty());
}
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 23 with Team

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

the class MeetingDAOTest method test_find_all_meetings_by_team_in_cronological_order.

@MediumTest
public void test_find_all_meetings_by_team_in_cronological_order() {
    Team team = new Team("Test Team");
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 5, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 4, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 7, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 1, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    dao.save(new Meeting(team, new GregorianCalendar(2010, 1, 2, 10, 15, 0).getTime(), 5, 240, 300, 30, 120));
    List<Meeting> meetings = dao.findAllByTeam(team);
    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 24 with Team

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

the class TeamDAOTest method test_can_delete_a_team.

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

Example 25 with Team

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

the class TeamDAOTest method test_cannot_create_a_team_with_a_name_that_already_exists.

@MediumTest
public void test_cannot_create_a_team_with_a_name_that_already_exists() {
    dao.save(new Team("Test Team 1"));
    try {
        dao.save(new Team("Test Team 1"));
        assertTrue("Should have thrown an exception", false);
    } catch (DuplicateTeamException e) {
        assertTrue(true);
    }
}
Also used : Team(net.johnpwood.android.standuptimer.model.Team) DuplicateTeamException(net.johnpwood.android.standuptimer.dao.DuplicateTeamException) 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