@Test(expected = StagesFactory.InvalidPatternException.class)
public void testInvalidPatternGivenAFinalOptionalStage() {

    Pattern<Object, String> pattern = new QueryBuilder<Object, String>()
            .select()
            .optional()
            .where(TestMatcher.isEqualTo("N/A"))
            .build();
    StagesFactory<Object, String> factory = new StagesFactory<>();
    factory.make(pattern);
}