@Test
public void getAssignCacheKey() {

    AnnotationData data = new AnnotationData();
    try {
        data.setAssignedKey(null);
        data.setNamespace(null);
        cacheKeyBuilder.getAssignCacheKey(data);
        fail("Expected exception.");
    } catch (InvalidParameterException ex) {
        assertTrue(ex.getMessage().indexOf("at least 1 character") != -1);
        System.out.println(ex.getMessage());
    }
    try {
        data.setAssignedKey("");
        cacheKeyBuilder.getAssignCacheKey(data);
        fail("Expected exception.");
    } catch (InvalidParameterException ex) {
        assertTrue(ex.getMessage().indexOf("at least 1 character") != -1);
        System.out.println(ex.getMessage());
    }
    final String objectId = RandomStringUtils.randomAlphanumeric(20);
    final String namespace = RandomStringUtils.randomAlphanumeric(12);
    data.setAssignedKey(objectId);
    data.setNamespace(namespace);
    final String result = cacheKeyBuilder.getAssignCacheKey(data);
    assertTrue(result.indexOf(objectId) != -1);
    assertTrue(result.indexOf(namespace) != -1);
}