@Before public void setup() { pacemaker = new PacemakerAPI(); for (User user : users) { pacemaker.createUser(user.firstName, user.lastName, user.email, user.password); } }
@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)); }
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); } }