@Test public void testValidateAttributes() {

    PeopleFlowActionTypeService peopleFlowActionTypeService =
            PeopleFlowActionTypeService.getInstance(PeopleFlowActionTypeService.Type.NOTIFICATION);
    peopleFlowActionTypeService.setConfigurationService(configurationService);
    // inject our mock PeopleFlowService:
    ((PeopleFlowActionTypeService)peopleFlowActionTypeService).setPeopleFlowService(mockPeopleFlowService);
    // set up attributes with an "invalid" peopleflow ID (according to our mock PeopleFlowService)
    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put(PeopleFlowActionTypeService.ATTRIBUTE_FIELD_NAME, INVALID_PEOPLEFLOW_ID);
    // test null ID parameter
    try {
        peopleFlowActionTypeService.validateAttributes(null, attributes);
        fail("null type id should throw an exception");
    } catch (RiceIllegalArgumentException e) {
        // good
    }
    // test null attributes parameter
    try {
        peopleFlowActionTypeService.validateAttributes("bogusTypeId", null);
        fail("null type id should throw an exception");
    } catch (RiceIllegalArgumentException e) {
        // good
    }
    // this should create errors
    List<RemotableAttributeError> errors = peopleFlowActionTypeService.validateAttributes("bogusTypeId", attributes);
    assertFalse(CollectionUtils.isEmpty(errors));
    // this should create errors
    errors = peopleFlowActionTypeService.validateAttributesAgainstExisting("bogusTypeId", attributes,
            Collections.<String, String>emptyMap());
    assertFalse(CollectionUtils.isEmpty(errors));
    // reset attribute to have a "valid" peopleFlow ID (according to our mock PeopleFlowService)
    attributes.clear();
    attributes.put(PeopleFlowActionTypeService.ATTRIBUTE_FIELD_NAME, VALID_PEOPLEFLOW_ID_1);
    // this should not create any errors
    errors = peopleFlowActionTypeService.validateAttributes("bogusTypeId", attributes);
    assertTrue(CollectionUtils.isEmpty(errors));
    // this should not create any errors
    errors = peopleFlowActionTypeService.validateAttributesAgainstExisting("bogusTypeId", attributes,
            Collections.<String, String>emptyMap());
    assertTrue(CollectionUtils.isEmpty(errors));
}