Search in sources :

Example 1 with EntityWithEnum

use of com.datastax.driver.mapping.entity.EntityWithEnum in project cassandra-driver-mapping by valchkou.

the class MappingSessionAsyncTest method saveEntityWithEnumTest.

@Test
public void saveEntityWithEnumTest() throws Exception {
    UUID uuid = UUID.randomUUID();
    EntityWithEnum obj = new EntityWithEnum();
    obj.setId(uuid);
    obj.setMonth(Month.JUNE);
    EntityWithEnum loaded = target.get(EntityWithEnum.class, uuid);
    assertNull(loaded);
    ResultSetFuture f = target.saveAsync(obj);
    f.getUninterruptibly();
    loaded = target.get(EntityWithEnum.class, uuid);
    assertEquals(obj, loaded);
    obj.setMonth(Month.APRIL);
    f = target.saveAsync(obj);
    f.getUninterruptibly();
    loaded = target.get(EntityWithEnum.class, uuid);
    assertEquals(obj, loaded);
    f = target.deleteAsync(loaded);
    f.getUninterruptibly();
    loaded = target.get(EntityWithEnum.class, uuid);
    assertNull(loaded);
}
Also used : ResultSetFuture(com.datastax.driver.core.ResultSetFuture) EntityWithEnum(com.datastax.driver.mapping.entity.EntityWithEnum) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

ResultSetFuture (com.datastax.driver.core.ResultSetFuture)1 EntityWithEnum (com.datastax.driver.mapping.entity.EntityWithEnum)1 UUID (java.util.UUID)1 Test (org.junit.Test)1