/** Test comparator */ public void testComparator() { Exception exception = null; student = new Student(); student.setList(songList); student.setMajor(major); student.setHobby(hobby); student.setRegion(region); student.setHeard(num1); student.setLikes(num3); Student student2 = new Student(); student2.setList(songList); student2.setMajor("asdf"); student2.setHobby("asdf"); student2.setRegion("asd"); student2.setHeard(num3); student2.setLikes(num1); Type type = Type.ARTIST; try { student.compare(student2, type); } catch (Exception e) { exception = e; } assertNotNull(exception); assertTrue(exception instanceof UnsupportedOperationException); }
/** setup test */ public void setUp() { student = new Student(); songList = new SongList(); songList.add(new Song("Hotline Bling", "Drake", 2015, "Rap", 0)); student.setList(songList); student.setMajor(major); student.setHobby(hobby); student.setRegion(region); student.setHeard(num1); student.setLikes(num3); }
/** test set heard */ public void testSetHeard() { student.setHeard(num5); assertEquals(student.getHeard(), num5); }