@Test
@Ignore( "Expectations need to be figured out." )
public void successfulBooking()
throws ActivationException, AssemblyException
{
SingletonAssembler assembler = new SingletonAssembler()
{
@Override
public void assemble( ModuleAssembly module )
throws AssemblyException
{
module.transients( ShippingServiceTestComposite.class );
}
};
ShippingService shippingService = createMock( ShippingService.class );
Cargo cargo = createMock( Cargo.class );
Voyage voyage = createMock( Voyage.class );
HasSequence generator = createMock( HasSequence.class );
Property<Integer> sequence = createMock( Property.class );
expect( shippingService.makeBooking( cargo, voyage ) ).andReturn( 100 );
expect( generator.sequence() ).andReturn( sequence ).anyTimes();
expect( sequence.get() ).andReturn( 1000 );
replay( shippingService, cargo, voyage, generator, sequence );
ShippingServiceTestComposite underTest =
assembler.module().newTransient( ShippingServiceTestComposite.class );
underTest.useMock( shippingService ).forClass( ShippingService.class );
underTest.useMock( generator ).forClass( HasSequence.class );
assertThat( "Booking result", underTest.makeBooking( cargo, voyage ), is( equalTo( 1000 ) ) );
verify( shippingService, cargo, voyage, generator, sequence );
}