use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepositoryTest method testSaveMediaWithBadArgs.
@DontRepeat
@Test
public void testSaveMediaWithBadArgs() throws Exception {
// Missing media id
assertThrows(() -> instance.saveMedia("", image)).isInstanceOf(InvalidArgumentException.class);
// Missing Image
assertThrows(() -> instance.saveMedia(mediaId, null)).isInstanceOf(InvalidArgumentException.class);
// bad Id
assertThrows(() -> instance.saveMedia(badId, image)).isInstanceOf(InvalidArgumentException.class);
// Empty Image
Image emptyImage = new Image();
assertThrows(() -> instance.saveMedia(badId, emptyImage)).isInstanceOf(InvalidArgumentException.class);
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testDeleteAllThumbnails.
@Test
public void testDeleteAllThumbnails() throws Exception {
for (Image thumbnail : thumbnails) {
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
assertThat(instance.containsThumbnail(mediaId, dimension), is(true));
}
instance.deleteAllThumbnails(mediaId);
assertThat(instance.containsThumbnail(mediaId, image.getDimension()), is(false));
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testSaveThumbnail.
@Test
public void testSaveThumbnail() throws Exception {
Image thumbnail = Lists.oneOf(thumbnails);
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
assertThat(instance.containsThumbnail(mediaId, dimension), is(true));
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testGetThumbnail.
@Test
public void testGetThumbnail() throws Exception {
Image thumbnail = Lists.oneOf(thumbnails);
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
Image result = instance.getThumbnail(mediaId, dimension);
assertThat(result, is(thumbnail));
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepositoryIT method testDeleteAllThumbnails.
@Test
public void testDeleteAllThumbnails() throws Exception {
for (Image thumbnail : thumbnails) {
Dimension dimension = thumbnail.dimension;
instance.saveThumbnail(mediaId, dimension, thumbnail);
}
instance.deleteAllThumbnails(mediaId);
Image oneThumbnail = Lists.oneOf(thumbnails);
assertThat(instance.containsThumbnail(mediaId, oneThumbnail.dimension), is(false));
}
Aggregations