예제 #1
0
 @Test
 public void testAddActivity() {
   User marge = pacemaker.getUserByEmail("*****@*****.**");
   Activity activity =
       pacemaker.createActivity(
           marge.id, activities[0].type, activities[0].location, activities[0].distance);
   Activity returnedActivity = pacemaker.getActivity(activity.id);
   assertEquals(activities[0], returnedActivity);
   assertNotSame(activities[0], returnedActivity);
 }
예제 #2
0
  void populate(PacemakerAPI pacemaker) {
    for (User user : users) {
      pacemaker.createUser(user.firstName, user.lastName, user.email, user.password);
    }
    User user1 = pacemaker.getUserByEmail(users[0].email);
    Activity activity =
        pacemaker.createActivity(
            user1.id, activities[0].type, activities[0].location, activities[0].distance);
    pacemaker.createActivity(
        user1.id, activities[1].type, activities[1].location, activities[1].distance);
    User user2 = pacemaker.getUserByEmail(users[1].email);
    pacemaker.createActivity(
        user2.id, activities[2].type, activities[2].location, activities[2].distance);
    pacemaker.createActivity(
        user2.id, activities[3].type, activities[3].location, activities[3].distance);

    for (Location location : locations) {
      pacemaker.addLocation(activity.id, location.latitude, location.longitude);
    }
  }
예제 #3
0
  @Test
  public void testAddActivityWithSingleLocation() {
    User marge = pacemaker.getUserByEmail("*****@*****.**");
    Long activityId =
        pacemaker.createActivity(
                marge.id, activities[0].type, activities[0].location, activities[0].distance)
            .id;

    pacemaker.addLocation(activityId, locations[0].latitude, locations[0].longitude);

    Activity activity = pacemaker.getActivity(activityId);
    assertEquals(1, activity.route.size());
    assertEquals(0.0001, locations[0].latitude, activity.route.get(0).latitude);
    assertEquals(0.0001, locations[0].longitude, activity.route.get(0).longitude);
  }
예제 #4
0
  @Test
  public void testAddActivityWithMultipleLocation() {
    User marge = pacemaker.getUserByEmail("*****@*****.**");
    Long activityId =
        pacemaker.createActivity(
                marge.id, activities[0].type, activities[0].location, activities[0].distance)
            .id;

    for (Location location : locations) {
      pacemaker.addLocation(activityId, location.latitude, location.longitude);
    }

    Activity activity = pacemaker.getActivity(activityId);
    assertEquals(locations.length, activity.route.size());
    int i = 0;
    for (Location location : activity.route) {
      assertEquals(location, locations[i]);
      i++;
    }
  }