PropertyDeclaration bValue = simple.findPropertyDeclaration("b_value");
assertThat(bValue, not(nullValue()));
assertThat(bValue.getType(), is(type(BasicTypeKind.DATE)));
JoinTrait trait = simple.getTrait(JoinTrait.class);
assertThat(trait, not(nullValue()));
assertThat(trait.getTerms().size(), is(2));
ReduceTerm<AstJoin> aTerm = trait.getTerms().get(0);
assertThat(aTerm.getSource(), is(model("a")));
assertThat(aTerm.getGrouping(), has(property("sid")));
assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.ANY, "sid", "sid")));
assertThat(aTerm.getMappings(), has(mapping(PropertyMappingKind.ANY, "value", "a_value")));
ReduceTerm<AstJoin> bTerm = trait.getTerms().get(1);
assertThat(bTerm.getSource(), is(model("b")));
assertThat(bTerm.getGrouping(), has(property("sid")));
assertThat(bTerm.getMappings(), has(mapping(PropertyMappingKind.ANY, "sid", "sid")));
assertThat(bTerm.getMappings(), has(mapping(PropertyMappingKind.ANY, "value", "b_value")));
}