Search in sources :

Example 6 with Document

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);
}
Also used : Entity(org.molgenis.data.Entity) Document(org.molgenis.data.elasticsearch.generator.model.Document) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 7 with Document

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);
}
Also used : Entity(org.molgenis.data.Entity) Document(org.molgenis.data.elasticsearch.generator.model.Document) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 8 with Document

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);
}
Also used : Entity(org.molgenis.data.Entity) Document(org.molgenis.data.elasticsearch.generator.model.Document) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 9 with Document

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);
}
Also used : Entity(org.molgenis.data.Entity) Document(org.molgenis.data.elasticsearch.generator.model.Document) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Example 10 with Document

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);
}
Also used : Entity(org.molgenis.data.Entity) Document(org.molgenis.data.elasticsearch.generator.model.Document) Test(org.testng.annotations.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

Document (org.molgenis.data.elasticsearch.generator.model.Document)11 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)11 Test (org.testng.annotations.Test)11 Entity (org.molgenis.data.Entity)10