Esempio n. 1
0
 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"));
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public void testAddAndChangeDocument1() {
   mock.documentAdded("Document");
   mock.documentChanged("Document");
   EasyMock.expectLastCall().times(3);
   //
   EasyMock.replay(mock);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   EasyMock.verify(mock);
 }
Esempio n. 4
0
 public void testAddAndChangeDocument() {
   mock.documentAdded("Document");
   mock.documentChanged("Document");
   mock.documentChanged("Document");
   mock.documentChanged("Document");
   EasyMock.replay(mock);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   classUnderTest.addDocument("Document", new byte[0]);
   EasyMock.verify(mock);
 }
Esempio n. 5
0
 public void testDocumentChanged1() {
   mock.documentAdded("document");
   mock.documentChanged("document");
   // EasyMock.expectLastCall().times(3);
   LastControl.lastControl().times(3);
   control.replay();
   classUnderTest.addDocument("document", new byte[0]);
   classUnderTest.addDocument("document", new byte[0]);
   classUnderTest.addDocument("document", new byte[0]);
   classUnderTest.addDocument("document", new byte[0]);
   control.verify();
 }
Esempio n. 6
0
 protected void setUp() {
   mock = EasyMock.createMock(Collaborator.class); // 1
   mock1 = EasyMock.createMock(Collaborator.class); // 1
   classUnderTest = new ClassUnderTest();
   classUnderTest.addListener(mock);
   // classUnderTest.addListener(mock1);
 }
Esempio n. 7
0
 public void testDocumentChanged() {
   mock.documentAdded("document");
   mock.documentChanged("document");
   control.replay();
   classUnderTest.addDocument("document", new byte[0]);
   classUnderTest.addDocument("document", new byte[0]);
   control.verify();
 }
Esempio n. 8
0
  protected void setUp() {
    classUnderTest = new ClassUnderTest();
    // control = EasyMock.createStrictControl();
    control = EasyMock.createNiceControl();

    mock = control.createMock(Collaborator.class);
    classUnderTest.addListener(mock);
  }
Esempio n. 9
0
 public void testAddDocument() {
   mock.documentAdded("New Document"); // 2
   EasyMock.replay(mock); // 3
   classUnderTest.addDocument("New Document", new byte[0]);
   // verify(mock);
 }
Esempio n. 10
0
 public void testRemoveNonExistingDocument() {
   // 2 (we do not expect anything)
   EasyMock.replay(mock); // 3
   classUnderTest.removeDocument("Does not exist");
 }
Esempio n. 11
0
 public void testRemoveNonExistingDocument() {
   control.replay();
   // This call should not lead to any notification
   // of the Mock Object:
   classUnderTest.removeDocument("Does not exist");
 }