/** Test of insert method, of class Course. */ @Test public void testInsert() { System.out.println("insert"); List<Student> students = new ArrayList<Student>(); students.add(new Student("sahil", "c0657966", "Male", 80.3)); Course instance = new Course(students); Student stu = new Student("Toshif", "c0657050", "Male", 60.4); instance.insert(stu, 1); String expResult = "[" + instance.get(0).toString() + ", " + instance.get(1).toString() + "]"; String result = instance.getAll().toString(); assertEquals(expResult, result); }
/** Test of getAllByGender method, of class Course. */ @Test public void testGetAllByGender() { System.out.println("getAllByGender"); String gender = "Male"; List<Student> students = new ArrayList<Student>(); students.add(new Student("sahil", "c0657966", "Male", 80.3)); Course instance = new Course(students); Student stu = new Student("Simar", "c0657050", "Female", 60.3); instance.insert(stu, 1); String expResult = "[{\"name\":\"sahil\",\"id\":\"c0657966\",\"gender\":\"Male\",\"grade\":80.3}]"; String result = instance.getAllByGender(gender).toString(); assertEquals(expResult, result); }