@Test
 public void testDeleteUsers() {
   assertEquals(users.length, pacemaker.getUsers().size());
   User marge = pacemaker.getUserByEmail("*****@*****.**");
   pacemaker.deleteUser(marge.id);
   assertEquals(users.length - 1, pacemaker.getUsers().size());
 }
 @Test
 public void testUser() {
   assertEquals(users.length, pacemaker.getUsers().size());
   pacemaker.createUser("homer", "simpson", "*****@*****.**", "secret");
   assertEquals(users.length + 1, pacemaker.getUsers().size());
   assertEquals(users[0], pacemaker.getUserByEmail(users[0].email));
 }
示例#3
0
  @Test
  public void testPopulate() {
    pacemaker = new PacemakerAPI(null);
    assertEquals(0, pacemaker.getUsers().size());
    populate(pacemaker);

    assertEquals(users.length, pacemaker.getUsers().size());
    assertEquals(2, pacemaker.getUserByEmail(users[0].email).activities.size());
    assertEquals(2, pacemaker.getUserByEmail(users[1].email).activities.size());
    Long activityID =
        pacemaker.getUserByEmail(users[0].email).activities.keySet().iterator().next();
    assertEquals(locations.length, pacemaker.getActivity(activityID).route.size());
  }
 @Test
 public void testUsers() {
   assertEquals(users.length, pacemaker.getUsers().size());
   for (User user : users) {
     User eachUser = pacemaker.getUserByEmail(user.email);
     assertEquals(user, eachUser);
     assertNotSame(user, eachUser);
   }
 }
示例#5
0
  @Test
  public void testXMLSerializer() throws Exception {
    String datastoreFile = "testdatastore.xml";
    deleteFile(datastoreFile);

    Serializer serializer = new XMLSerializer(new File(datastoreFile));

    pacemaker = new PacemakerAPI(serializer);
    populate(pacemaker);
    pacemaker.store();

    PacemakerAPI pacemaker2 = new PacemakerAPI(serializer);
    pacemaker2.load();

    assertEquals(pacemaker.getUsers().size(), pacemaker2.getUsers().size());
    for (User user : pacemaker.getUsers()) {
      assertTrue(pacemaker2.getUsers().contains(user));
    }
    // deleteFile ("testdatastore.xml");
  }