use of jakarta.nosql.tck.entities.Download in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertDocumentToEntityWithArray.
@Test
public void shouldConvertDocumentToEntityWithArray() {
byte[] contents = { 1, 2, 3, 4, 5, 6 };
Download download = new Download();
download.setId(1L);
download.setContents(contents);
DocumentEntity entity = converter.toDocument(download);
Assertions.assertEquals(1L, entity.find("_id").get().get());
final byte[] bytes = entity.find("contents").get().get(byte[].class);
Assertions.assertArrayEquals(contents, bytes);
}
use of jakarta.nosql.tck.entities.Download in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertEntityToDocumentWithArray.
@Test
public void shouldConvertEntityToDocumentWithArray() {
byte[] contents = { 1, 2, 3, 4, 5, 6 };
DocumentEntity entity = DocumentEntity.of("download");
entity.add("_id", 1L);
entity.add("contents", contents);
Download download = converter.toEntity(entity);
Assertions.assertEquals(1L, download.getId());
Assertions.assertArrayEquals(contents, download.getContents());
}
use of jakarta.nosql.tck.entities.Download in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertEntityToDocumentWithArray.
@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.assertArrayEquals(contents, download.getContents());
}
use of jakarta.nosql.tck.entities.Download in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertDocumentToEntityWithArray.
@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());
final byte[] bytes = entity.find("contents").map(v -> v.get(byte[].class)).orElse(new byte[0]);
Assertions.assertArrayEquals(contents, bytes);
}
Aggregations