@Test public void testSuccess() { String id = "entity-id"; String kind = "entity-kind"; TombstoneEntity entity = tombstoneBackend.create(kind, id); assertThat(entity, notNullValue()); assertThat(entity, is(tombstoneBackend.getByEntityId(id))); tombstoneBackend.delete(entity); assertThat(tombstoneBackend.getByEntityId(id), nullValue()); }
@Test( expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "Multiple tombstones for entity: entity-id") public void testMultipleDocuments() { String id = "entity-id"; String kind = "entity-kind"; buildTombstones(3, id, kind); tombstoneBackend.getByEntityId(id); }
@Test public void testOneDocument() { String id = "entity-id"; String kind = "entity-kind"; buildTombstones(1, id, kind); TombstoneEntity entity = tombstoneBackend.getByEntityId(id); assertThat(entity, notNullValue()); assertThat(entity.getEntityId(), is(id)); assertThat(entity.getEntityKind(), is(kind)); assertThat(entity.getTombstoneTime(), notNullValue()); }
@Test public void testNoDocuments() { assertThat(tombstoneBackend.getByEntityId("missing-id"), nullValue()); }