use of org.activityinfo.store.testing.BioDataForm in project activityinfo by bedatadriven.
the class RecordTreeLoaderTest method references.
@Test
public void references() {
BioDataForm bioDataForm = setup.getBioDataForm();
Observable<Maybe<RecordTree>> recordTree = setup.getFormStore().getRecordTree(bioDataForm.getRecordRef(0));
Connection<Maybe<RecordTree>> recordTreeView = setup.connect(recordTree);
RecordTree tree = recordTreeView.assertLoaded().get();
LookupKeySet lookupKeySet = new LookupKeySet(tree.getFormTree(), tree.getFormTree().getRootField(BioDataForm.PROTECTION_CODE_FIELD_ID).getField());
assertThat(lookupKeySet.getLookupKeys(), hasSize(1));
ReferenceValue referenceValue = (ReferenceValue) tree.getRoot().get(BioDataForm.PROTECTION_CODE_FIELD_ID);
RecordRef ref = referenceValue.getOnlyReference();
assertThat(lookupKeySet.label(tree, ref), equalTo(Maybe.of("00667")));
}
Aggregations