StubSequence

The test of stub sequences is made with the use of the object StubSequence. This object can be loaded with the sequence which will have to be verified. Then the comparison is made with the use of the corresponding method of the object TestSynchroStub.

Examples

public void teststub3()

{

  PasStub another = new PasStub();

  another.call1();

  StubSequence testof = new StubSequence(this);

  verifyLogMessage("verify one enter method");

  testof.addEltToSequence( new StubbedOne().getClass() , "methodone", StubInfo.ENTER) ;

  verifyEquals("Test single sequence",TestSynchroStub.isSeqRespected(testof),true);

}

public void teststub4()

{

  PasStub another = new PasStub();

  another.call1();

  StubSequence testof = new StubSequence(this);

  testof = new StubSequence(this);

  testof.addEltToSequence( new StubbedOne().getClass() , "methodone",StubInfo.ENTER) ;

  testof.addEltToSequence( new StubbedTwo().getClass() , "m1",StubInfo.ENTER) ;

  testof.addEltToSequence( new StubbedTwo().getClass() , "m1",StubInfo.EXIT) ;

  verifyLogMessage("Check true for stub calls");

  verifyEquals("Test single sequence",TestSynchroStub.isSeqRespected(testof),true);

}

TestSynchroStub

It is possible to test if a Stub has been declared failed. To do this the corresponding method of the class TestSynchroStub has to be used.

Example

public void testStubFail()

{

  StubbedThree st = new StubbedThree();

  st.call();

  verifyLogMessage("Check fail call from stub");

  verifyEquals("Test single sequence",TestSynchroStub.areStubfail(this),true);

}