@Test
public void testValidatePath() throws Exception {

    try {
        QueryGenUtil.validatePath("Company", os.getModel()); // too short
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        QueryGenUtil.validatePath("Company departments Department manager", os.getModel());  // wrong length
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        QueryGenUtil.validatePath("Department manager Monkey", os.getModel());  // no Monkeys
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        QueryGenUtil.validatePath("Department teaboy Employee", os.getModel());  // no teaboys
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        QueryGenUtil.validatePath("Company reverse.departments Department", os.getModel()); // no departments collection in Department
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    try {
        QueryGenUtil.validatePath("Company 1.departments Department", os.getModel()); // reference to future
        Assert.fail("expected IllegalArgumentException");
    } catch (IllegalArgumentException e) {
    }
    // valid
    QueryGenUtil.validatePath("Company departments Department", os.getModel());
    QueryGenUtil.validatePath("Company address Address", os.getModel());  // inherited reference
    QueryGenUtil.validatePath("Company departments Department manager Manager", os.getModel());
    QueryGenUtil.validatePath("Company reverse.company Department", os.getModel());
    QueryGenUtil.validatePath("Company departments Department 1.address Address", os.getModel());
}