@Test public void testFindById() { Student expectedStudent = new Student(221l, "Sherlock Holmes", LocalDate.of(1981, Month.JULY, 31)); Student actualStudent = studentService.findById(221l); assertEquals(expectedStudent, actualStudent); }
public Student findById(Long id) { System.out.printf("findById Base URL: [%s]\n", baseUrl); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Student> response = restTemplate.exchange( baseUrl + "/" + id, HttpMethod.GET, null, Student.class); Student student = response.getBody(); System.out.println(student); return student; }
StudentService implements GenericService<Student, Long> { public Student findById(Long id) { System.out.printf("findById Base URL: [%s]\n", baseUrl); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Student> response = restTemplate.exchange( baseUrl + "/" + id, HttpMethod.GET, null, Student.class); Student student = response.getBody(); System.out.println(student); return student; } }
StudentService implements GenericService<Student, Long> { public Student findById(Long id) { System.out.printf("findById Base URL: [%s]\n", baseUrl); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Student> response = restTemplate.exchange( baseUrl + "/" + id, HttpMethod.GET, null, Student.class); Student student = response.getBody(); System.out.println(student); return student; } StudentService(StudentRepository studentRepository); }
StudentService implements GenericService<Student, Long> { public Student findById(Long id) { System.out.printf("findById Base URL: [%s]\n", baseUrl); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Student> response = restTemplate.exchange( baseUrl + "/" + id, HttpMethod.GET, null, Student.class); Student student = response.getBody(); System.out.println(student); return student; } StudentService(StudentRepository studentRepository); Student findById(Long id); List<Student> findAll(); Student save(Student student); void delete(Student student); }
StudentService implements GenericService<Student, Long> { public Student findById(Long id) { System.out.printf("findById Base URL: [%s]\n", baseUrl); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<Student> response = restTemplate.exchange( baseUrl + "/" + id, HttpMethod.GET, null, Student.class); Student student = response.getBody(); System.out.println(student); return student; } StudentService(StudentRepository studentRepository); Student findById(Long id); List<Student> findAll(); Student save(Student student); void delete(Student student);  }