@Test public void getBio() { String somethingAboutYourself = "Something about myself?"; FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.setBio(somethingAboutYourself); assertTrue(test.getBio().equals(somethingAboutYourself)); }
@Test public void createSubProfileTest() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.createSubProfile("Kitty"); assertTrue(test.getSubProfile().getName().equals("Kitty")); }
@Test public void testAddFriend() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy"); test.addFriend(jimmy); // assertEquals(1, test.getFriends().size()); String friend = test.getFriends().get(0); assertEquals("Jimmy", friend); }
@Test public void testGetImage() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); String testImagePath = "/Images/StanfordTree.jpg"; String testImageTitle = "Tree"; ImagePanel testImagePanel = new ImagePanel(testImageTitle, testImagePath); test.setImage(testImagePanel); assertTrue(test.getImage().equals(testImagePanel)); }
@Test public void testGetSecondOrderFriends() { FacePamphletDatabase theBase = new FacePamphletDatabase(); FacePamphletProfile test = new FacePamphletProfile("Test Profile"); FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy"); FacePamphletProfile timmy = new FacePamphletProfile("Timmy"); FacePamphletProfile shimmy = new FacePamphletProfile("Shimmy"); FacePamphletProfile joseph = new FacePamphletProfile("Joseph"); FacePamphletProfile mom = new FacePamphletProfile("Your Mother"); theBase.addProfile(test); theBase.addProfile(jimmy); theBase.addProfile(timmy); theBase.addProfile(shimmy); theBase.addProfile(joseph); theBase.addProfile(mom); jimmy.addFriend(timmy); jimmy.addFriend(mom); timmy.addFriend(shimmy); timmy.addFriend(joseph); timmy.addFriend(timmy); test.addFriend(jimmy); test.addFriend(timmy); ArrayList<String> testList = new ArrayList<String>(); testList.add("Timmy"); testList.add("Shimmy"); testList.add("Joseph"); testList.add("Your Mother"); assertEquals(testList, test.getSecondOrderFriends()); }
@Test public void testRemoveFriend() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy"); test.addFriend(jimmy); test.removeFriend(jimmy.getName()); assertEquals(0, test.getFriends().size()); }
@Test public void testGetFriendsOf() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy"); FacePamphletProfile timmy = new FacePamphletProfile("Timmy"); FacePamphletProfile mom = new FacePamphletProfile("Your Mother"); test.addFriend(jimmy); jimmy.addFriend(timmy); jimmy.addFriend(mom); ArrayList<String> testList = new ArrayList<String>(); testList.add("Timmy"); testList.add("Your Mother"); assertEquals(testList, test.getFriendsOf(jimmy)); }
@Test public void testAddBirthdayNotification() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); FacePamphletProfile jimmy = new FacePamphletProfile("Jimmy"); Calendar currentDate = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("MM/dd"); String dateNow = formatter.format(currentDate.getTime()); jimmy.setBirthday(12, 4); test.addFriend(jimmy); test.addBirthdayNotifications(); assertTrue(test.getNotifications().contains("Jimmy's birthday is coming up on 12/4!!")); }
/** * This method adds the given profile to the database. If the name associated with the profile is * the same as an existing name in the database, the existing profile is replaced by the new * profile passed in. */ public void addProfile(FacePamphletProfile profile) { // You fill this in profileData.put(profile.getName(), profile); }
@Test public void testSetBirthday() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.setBirthday(2, 7); assertTrue(test.getBirthdayMonth() == 2 && test.getBirthdayDate() == 7); }
@Test public void testGetBirthday() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.setBirthday(1, 8); assertTrue(test.getBirthdayMonth() == 1 && test.getBirthdayDate() == 8); }
@Test public void testSetStatus() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.setStatus("Busy"); assertEquals("Busy", test.getStatus()); }
@Test public void testGetStatus() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); test.setStatus("Busy"); assertTrue(test.getStatus().equals("Busy")); }
@Test public void testGetName() { FacePamphletProfile test = new FacePamphletProfile("Test Profile"); assertTrue(test.getName().equals("Test Profile")); }
/** * This method adds the given profile to the database. If the name associated with the profile is * the same as an existing name in the database, the existing profile is replaced by the new * profile passed in. */ private void addProfile(FacePamphletProfile profile) { if (!allPeople.containsKey(profile.getName())) { allPeople.put(profile.getName(), profile); } }