Skip to content

Commit

Permalink
adds est converter
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviojava committed Mar 10, 2019
1 parent f296ebe commit 52d1f5c
Showing 1 changed file with 29 additions and 0 deletions.
Expand Up @@ -21,6 +21,7 @@
import org.jnosql.artemis.model.Contact;
import org.jnosql.artemis.model.ContactType;
import org.jnosql.artemis.model.Director;
import org.jnosql.artemis.model.Download;
import org.jnosql.artemis.model.Job;
import org.jnosql.artemis.model.Money;
import org.jnosql.artemis.model.Movie;
Expand Down Expand Up @@ -396,6 +397,34 @@ public void shouldConvertAndDoNotUseUnmodifiableCollection() {

}

@Test
public void shouldConvertEntityToDocumentWithArray() {
byte[] contents = {1, 2, 3, 4, 5, 6};

ColumnEntity entity = ColumnEntity.of("download");
entity.add("_id", 1L);
entity.add("contents", contents);

Download download = converter.toEntity(entity);
Assertions.assertEquals(1L, download.getId());
Assertions.assertEquals(contents, download.getContents());
}

@Test
public void shouldConvertDocumentToEntityWithArray() {
byte[] contents = {1, 2, 3, 4, 5, 6};

Download download = new Download();
download.setId(1L);
download.setContents(contents);

ColumnEntity entity = converter.toColumn(download);


Assertions.assertEquals(1L, entity.find("_id").get().get());
Assertions.assertEquals(contents, entity.find("contents").get().get());
}

private Object getValue(Optional<Column> column) {
return column.map(Column::getValue).map(Value::get).orElse(null);
}
Expand Down

0 comments on commit 52d1f5c

Please sign in to comment.