@Test public void get() { // setup EasyMock.expect(mockNoteBookService.findById(TEST_NOTEBOOK_ID)).andReturn(noteBook); EasyMock.replay(mockNoteBookService); // method under test NoteBook actual = controller.get(TEST_NOTEBOOK_ID); // check results assertNotNull(actual); assertEquals(noteBook.getName(), actual.getName()); EasyMock.verify(mockNoteBookService); }
@Test public void post() { // setup EasyMock.expect(mockNoteBookService.create(noteBook)).andReturn(noteBook); EasyMock.replay(mockNoteBookService); // method under test NoteBook actual = controller.post(noteBook); // check results assertNotNull(actual); assertNotNull(actual.getId()); assertEquals(noteBook.getName(), actual.getName()); EasyMock.verify(mockNoteBookService); }