+ "%s JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " t2 ON t1.\"item_id\" = t2.\"item_id\" "
+ "%s JOIN " + JOIN_ITEM_TABLE_FULL_NAME + " t3 ON t1.\"item_id\" = t3.\"item_id\" "
+ "WHERE t1.\"item_id\" = '0000000001' AND t2.\"item_id\" = '0000000002' AND t3.\"item_id\" = '0000000003'";
String query = String.format(queryTemplate, "INNER", "INNER");
JoinTable joinTable = getJoinTable(query, pconn);
assertEquals(1, joinTable.getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "INNER", "LEFT");
joinTable = getJoinTable(query, pconn);
assertEquals(1, joinTable.getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "INNER", "RIGHT");
joinTable = getJoinTable(query, pconn);
assertEquals(0, joinTable.getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "LEFT", "INNER");
joinTable = getJoinTable(query, pconn);
assertEquals(1, joinTable.getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "LEFT", "LEFT");
joinTable = getJoinTable(query, pconn);
assertEquals(1, joinTable.getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "LEFT", "RIGHT");
joinTable = getJoinTable(query, pconn);
assertEquals(0, joinTable.getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "RIGHT", "INNER");
joinTable = getJoinTable(query, pconn);
assertEquals(0, joinTable.getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
query = String.format(queryTemplate, "RIGHT", "RIGHT");
joinTable = getJoinTable(query, pconn);
assertEquals(0, joinTable.getTable().getPreFilters().size());
assertEquals(0, joinTable.getJoinSpecs().get(0).getJoinTable().getTable().getPreFilters().size());
assertEquals(1, joinTable.getJoinSpecs().get(1).getJoinTable().getTable().getPreFilters().size());
}