@Test public void testRowUniquenessConstraint() throws Exception { RowUniquenessConstraint<String, String> unique = new RowUniquenessConstraint<String, String>( keyspace, UNIQUE_CF, "testRowUniquenessConstraint", UUIDStringSupplier.getInstance()) .withConsistencyLevel(ConsistencyLevel.CL_ONE); RowUniquenessConstraint<String, String> unique2 = new RowUniquenessConstraint<String, String>( keyspace, UNIQUE_CF, "testRowUniquenessConstraint", UUIDStringSupplier.getInstance()) .withConsistencyLevel(ConsistencyLevel.CL_ONE); try { unique.withData("abc").acquire(); try { unique2.acquire(); Assert.fail(); } catch (Exception e) { LOG.info(e.getMessage()); } String data = unique.readDataAsString(); Assert.assertNotNull(data); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); LOG.error(e.getMessage()); } finally { unique.release(); } try { String data = unique.readDataAsString(); Assert.fail(); } catch (Exception e) { LOG.info("", e); } }