use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentDate.
@Test(dataProvider = "createDocumentDate")
public void createDocumentDate(LocalDate localDate, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.DATE);
when(entity.getLocalDate(attrIdentifier)).thenReturn(localDate);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentBool.
@Test(dataProvider = "createDocumentBool")
public void createDocumentBool(Boolean value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.BOOL);
when(entity.getBoolean(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentString.
@Test(dataProvider = "createDocumentString")
public void createDocumentString(AttributeType attributeType, String value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, attributeType);
when(entity.getString(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentDateTime.
@Test(dataProvider = "createDocumentDateTime")
public void createDocumentDateTime(Instant value, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, AttributeType.DATE_TIME);
when(entity.getInstant(attrIdentifier)).thenReturn(value);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
use of org.molgenis.data.elasticsearch.generator.model.Document in project molgenis by molgenis.
the class DocumentContentBuilderTest method createDocumentMultiReferenceAttribute.
@Test(dataProvider = "createDocumentMultiReference")
public void createDocumentMultiReferenceAttribute(AttributeType attributeType, Iterable<Entity> values, String expectedContent) {
String attrIdentifier = "attr";
Entity entity = createEntity(attrIdentifier, attributeType);
when(entity.getEntities(attrIdentifier)).thenReturn(values);
Document document = documentContentBuilder.createDocument(entity);
assertDocumentEquals(document, expectedContent);
}
Aggregations