コード例 #1
0
  /** Test of process method, of class AuditServiceThreadImpl. */
  public void testProcess() {
    System.out.println("process");

    AuditCommand mockAuditCommand = createMock(AuditCommand.class);
    mockAuditCommand.process();
    expectLastCall().once();
    replay(mockAuditCommand);

    AuditServiceThreadImpl instance = initialiseAuditServiceThread(mockAuditCommand);
    instance.process();

    verify(mockAuditCommand);
  }
コード例 #2
0
  /** Test of run method, of class AuditServiceThreadImpl. */
  public void testRun() {
    System.out.println("run");

    Audit mockAudit = createMock(Audit.class);
    expect(mockAudit.getId()).andReturn(1l).anyTimes();

    AuditCommand mockAuditCommand = createMock(AuditCommand.class);
    mockAuditCommand.init();
    expectLastCall().once();
    mockAuditCommand.loadContent();
    expectLastCall().once();
    mockAuditCommand.adaptContent();
    expectLastCall().once();
    mockAuditCommand.process();
    expectLastCall().once();
    mockAuditCommand.consolidate();
    expectLastCall().once();
    mockAuditCommand.analyse();
    expectLastCall().once();
    expect(mockAuditCommand.getAudit()).andReturn(mockAudit).anyTimes();

    replay(mockAudit);
    replay(mockAuditCommand);

    AuditServiceThreadImpl instance = initialiseAuditServiceThread(mockAuditCommand);

    AuditServiceThreadListener auditServiceThreadListener =
        createMock(AuditServiceThreadListener.class);
    auditServiceThreadListener.auditCompleted(instance);
    expectLastCall().once();
    replay(auditServiceThreadListener);

    instance.add(auditServiceThreadListener);
    instance.run();

    verify(mockAudit);
    verify(mockAuditCommand);
    verify(auditServiceThreadListener);
  }