@Test
public void testPatternWithSingleStage() {

    Pattern<String, Integer> pattern = new QueryBuilder<String, Integer>()
            .select(STAGE_1).where(TestMatcher.isEqualTo(0)).build();
    StagesFactory<String, Integer> factory = new StagesFactory<>();
    Stages<String, Integer> stages = factory.make(pattern);
    Assert.assertEquals(2, stages.getAllStages().size());
    final Stage<String, Integer> stage0 = stages.getAllStages().get(0);
    Assert.assertEquals(Stage.StateType.FINAL, stage0.getType());
    Assert.assertEquals(0, stage0.getEdges().size());
    final Stage<String, Integer> stage1 = stages.getAllStages().get(1);
    Assert.assertEquals(Stage.StateType.BEGIN, stage1.getType());
    Assert.assertEquals(1, stage1.getEdges().size());
    Assert.assertEquals(true, stage1.getEdges().get(0).is(EdgeOperation.BEGIN));
    Assert.assertEquals(stage0, stage1.getEdges().get(0).getTarget());
    Assert.assertEquals(STAGE_1, stage1.getName());
}