@Test public void noKeyField() { final Object o = new Object() { @SuppressWarnings("unused") private final String domainProperty = "tomatoes"; }; assertNull(KeyUtil.getKey(o)); }
@Test public void nullKeyField() { final Object o = new Object() { @SuppressWarnings("unused") @RiakKey private final Date domainProperty = null; }; assertNull(KeyUtil.getKey(o)); }
@Test public void getNonStringKey() { final Date expected = Calendar.getInstance().getTime(); final Object o = new Object() { @SuppressWarnings("unused") @RiakKey private final Date domainProperty = expected; }; assertEquals(expected.toString(), KeyUtil.getKey(o)); }
@Test public void getKey() { final String expected = "aKey"; final Object o = new Object() { @SuppressWarnings("unused") @RiakKey private final String domainProperty = expected; }; assertEquals(expected, KeyUtil.getKey(o)); }