コード例 #1
0
ファイル: ExampleTest.java プロジェクト: cnewday/webapp
 public void testDocumentRemoved() {
   mock.documentAdded("document");
   EasyMock.expect(mock.voteForRemoval("document")).andReturn((byte) 42);
   mock.documentRemoved("document");
   control.replay();
   classUnderTest.addDocument("document", new byte[0]);
   assertTrue(classUnderTest.removeDocument("document"));
 }
コード例 #2
0
ファイル: ExampleMockTest.java プロジェクト: cnewday/webapp
 public void testVoteAgainstRemoval() {
   mock.documentAdded("Document"); // expect document addition
   // expect to be asked to vote for document removal, and vote against it
   EasyMock.expect(mock.voteForRemoval("Document")).andReturn((byte) -42);
   EasyMock.replay(mock);
   classUnderTest.addDocument("Document", new byte[0]);
   assertFalse(classUnderTest.removeDocument("Document"));
   EasyMock.verify(mock);
 }