Browse Source

PersonController - Complete

Nick Satinover 6 years ago
parent
commit
07330ce17d

+ 11
- 0
src/main/java/io/zipcoder/crudapp/PersonController.java View File

45
         );
45
         );
46
     }
46
     }
47
 
47
 
48
+//    @RequestMapping(path="/user/{userId}",method=RequestMethod.PUT)
49
+//    public ResponseEntity<Void> updateExist(@RequestBody User user,@PathVariable long userId)  {
50
+//        try {
51
+//            user.setUserId(userId);
52
+//            userService.update(user);
53
+//            return ResponseEntity.noContent().build();
54
+//        } catch (ResourceNotFoundException e) {
55
+//            return ResponseEntity.notFound().build();
56
+//        }
57
+//    }
58
+
48
     @DeleteMapping("/people/{id}")
59
     @DeleteMapping("/people/{id}")
49
     void deletePerson(@PathVariable int id){
60
     void deletePerson(@PathVariable int id){
50
                 personRepository.delete(id);
61
                 personRepository.delete(id);

+ 8
- 8
src/test/java/io/zipcoder/crudapp/CRUDApplicationTests.java View File

40
 	}
40
 	}
41
 
41
 
42
 //    @Test
42
 //    @Test
43
-//    public void PersonControllerGetTest(){
44
-//         given
45
-//
46
-//         when
47
-//        String expected = "Satinover";
48
-//        Person actual = personController.getPerson(1);
49
-//
50
-//         then
43
+//    public void PersonControllerUpdateTest(){
44
+//         //given
45
+//        Person personUpdate = new Person("Nick", "Update");
46
+//         //when
47
+//        String expected = "Update";
48
+//        personController.updatePerson(personUpdate);
49
+//        String actual = personRepository.findOne(1).getLastName();
50
+//         //then
51
 //        Assert.assertEquals(expected, actual);
51
 //        Assert.assertEquals(expected, actual);
52
 //    }
52
 //    }
53
 
53