StubHeartbeat heartbeat = new StubHeartbeat();
Mock glyphFactoryMock = mock(GlyphFactory.class);
LivingGlyph firstGlyph = new LivingGlyph(GlyphType.T, new StubCollisionDetector(13), 3);
LivingGlyph secondGlyph = new LivingGlyph(GlyphType.S, CollisionDetector.NULL, 3);
Junk junk = new Junk(7, 13);
glyphFactoryMock.expects("nextGlyph").inOrder()
.with(new Matcher[] {isA(CollisionDetector.class), isA(ListenerSet.class)})
.will(returnValue(firstGlyph), returnValue(secondGlyph));
glyphFactoryMock.expects("createJunk").with(isA(ListenerSet.class)).will(returnValue(junk));
Segments segmentsForTShapeOnFloor = droppedToFloor(GlyphType.T.getSegments(0).movedRight(3), 13);
Game game = new Game((GlyphFactory) glyphFactoryMock, heartbeat, 7, 13);
game.requestStartGame();
// When...
game.requestGlyphMovement(GlyphMovement.DROP);
heartbeat.beat();
//Then...
ensureThat(firstGlyph.getSegments(), eq(Segments.EMPTY));
ensureThat(junk.getSegments(), eq(segmentsForTShapeOnFloor));
verifyMocks();
}