コード例 #1
0
  @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);
  }
コード例 #2
0
  @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);
  }