@Test
public void testSetIfNotNull() {

    Object objectToSet = new Object();
    Object nullObject = null;
    Object defaultValue = new Object();
    String exampleMessage = "TestMessage";
    assertThat(SteemJUtils.setIfNotNull(objectToSet, exampleMessage), equalTo(objectToSet));
    try {
        SteemJUtils.setIfNotNull(nullObject, exampleMessage);
        fail();
    } catch (InvalidParameterException e) {
        assertThat(e.getMessage(), equalTo(exampleMessage));
    }
    assertThat(SteemJUtils.setIfNotNull(objectToSet, defaultValue), equalTo(objectToSet));
    assertThat(SteemJUtils.setIfNotNull(nullObject, defaultValue), equalTo(defaultValue));
    try {
        SteemJUtils.setIfNotNull(nullObject, nullObject);
        fail();
    } catch (InvalidParameterException e) {
        assertThat(e.getMessage(), equalTo("Both, the objectToSet and the default value are null."));
    }
}