@Test
public void testTuplePatternsAreOrdered() {

    GraphPattern<String, String> pattern = new GraphPattern<>(
            tuplePattern("?x", "knows", "?y"),
            tuplePattern("?x", "age", "21")
    );
    assertEquals(2, pattern.getPatterns().length);
    assertEquals(3, pattern.getPatterns()[0].getPattern().length);
    assertEquals(3, pattern.getPatterns()[1].getPattern().length);
    assertEquals("?x", pattern.getPatterns()[0].getPattern()[0].getVariable());
    assertNull(pattern.getPatterns()[0].getPattern()[0].getConstant());
    assertNull(pattern.getPatterns()[0].getPattern()[1].getVariable());
    assertEquals("knows", pattern.getPatterns()[0].getPattern()[1].getConstant());
    assertEquals("?y", pattern.getPatterns()[0].getPattern()[2].getVariable());
    assertNull(pattern.getPatterns()[0].getPattern()[2].getConstant());
    assertEquals("?x", pattern.getPatterns()[1].getPattern()[0].getVariable());
    assertNull(pattern.getPatterns()[1].getPattern()[0].getConstant());
    assertNull(pattern.getPatterns()[1].getPattern()[1].getVariable());
    assertEquals("age", pattern.getPatterns()[1].getPattern()[1].getConstant());
    assertNull(pattern.getPatterns()[1].getPattern()[2].getVariable());
    assertEquals("21", pattern.getPatterns()[1].getPattern()[2].getConstant());
}