test_class.declarator: studentService
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private StudentService studentService;
test_class.type: StudentService
test_class.var_name: studentService
test_class.declarator: studentRepository
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private StudentRepository studentRepository;
test_class.type: StudentRepository
test_class.var_name: studentRepository
test_class.file: spring-boot-demo/src/test/java/bd/edu/seu/springbootdemo/service/StudentServiceTest.java
test_class.identifier: StudentServiceTest
test_case.body: @Test(expected = ResourceAlreadyExistsException.class)
      public void testInsertExistingStudent() throws ResourceAlreadyExistsException {
          Student student1 = new Student(1234, "John Doe", LocalDate.of(2011, Month.JANUARY, 1));
          Student student2 = new Student(1234, "Jane Doe", LocalDate.of(2012, Month.MAY, 1));
          try {
              Student insertedStudent = studentService.insertStudent(student1);
              assertEquals(student1, insertedStudent);
          } catch (ResourceAlreadyExistsException e) {
              e.printStackTrace();
          }
  
  //        try {
              Student insertedStudent = studentService.insertStudent(student2);
              assertEquals(student2, insertedStudent);
  //        } catch (ResourceAlreadyExistsException e) {
  //            throw e;
  //        }
      }
test_case.class_method_signature: StudentServiceTest.testInsertExistingStudent()
test_case.full_signature: @Test(expected = ResourceAlreadyExistsException.class) public void testInsertExistingStudent()
test_case.identifier: testInsertExistingStudent
test_case.invocations: of of insertStudent assertEquals printStackTrace insertStudent assertEquals
test_case.modifiers: @Test(expected = ResourceAlreadyExistsException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInsertExistingStudent()
focal_class.declarator: studentRepository
focal_class.modifier: private
focal_class.original_string: private StudentRepository studentRepository;
focal_class.type: StudentRepository
focal_class.var_name: studentRepository
focal_class.file: spring-boot-demo/src/main/java/bd/edu/seu/springbootdemo/service/StudentService.java
focal_class.identifier: StudentService
focal_class.class_method_signature: StudentService.StudentService(StudentRepository studentRepository)
focal_class.full_signature: public  StudentService(StudentRepository studentRepository)
focal_class.identifier: StudentService
focal_class.modifiers: public
focal_class.parameters: (StudentRepository studentRepository)
focal_class.signature:  StudentService(StudentRepository studentRepository)
focal_class.class_method_signature: StudentService.findById(long id)
focal_class.full_signature: public Student findById(long id)
focal_class.identifier: findById
focal_class.modifiers: public
focal_class.parameters: (long id)
focal_class.return: Student
focal_class.signature: Student findById(long id)
focal_class.class_method_signature: StudentService.findAll()
focal_class.full_signature: public List<Student> findAll()
focal_class.identifier: findAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Student>
focal_class.signature: List<Student> findAll()
focal_class.class_method_signature: StudentService.deleteById(long id)
focal_class.full_signature: public boolean deleteById(long id)
focal_class.identifier: deleteById
focal_class.modifiers: public
focal_class.parameters: (long id)
focal_class.return: boolean
focal_class.signature: boolean deleteById(long id)
focal_class.class_method_signature: StudentService.insertStudent(Student student)
focal_class.full_signature: public Student insertStudent(Student student)
focal_class.identifier: insertStudent
focal_class.modifiers: public
focal_class.parameters: (Student student)
focal_class.return: Student
focal_class.signature: Student insertStudent(Student student)
focal_class.class_method_signature: StudentService.updateStudent(long id, Student student)
focal_class.full_signature: public Student updateStudent(long id, Student student)
focal_class.identifier: updateStudent
focal_class.modifiers: public
focal_class.parameters: (long id, Student student)
focal_class.return: Student
focal_class.signature: Student updateStudent(long id, Student student)
focal_method.body: public Student insertStudent(Student student) throws ResourceAlreadyExistsException {
          Optional<Student> optionalStudent = studentRepository.findById(student.getId());
          if (optionalStudent.isPresent()) {
              throw new ResourceAlreadyExistsException(student.getId() + "");
          } else {
              return studentRepository.save(student);
          }
      }
focal_method.class_method_signature: StudentService.insertStudent(Student student)
focal_method.full_signature: public Student insertStudent(Student student)
focal_method.identifier: insertStudent
focal_method.invocations: findById getId isPresent getId save
focal_method.modifiers: public
focal_method.parameters: (Student student)
focal_method.return: Student
focal_method.signature: Student insertStudent(Student student)