class ProfileCheck implements Command<String, Object, ProfileContext> {

    public Processing execute(ProfileContext context) {
        Profile profile = context.getProfile();

        if (null == profile) {
            context.setProfile(newProfile(context));
        }
        return Processing.CONTINUE;
    }

}

class ProfileCheckTest {

    @Test
    public void testProfileCheckNeed() {


        ProfileContext context = new ProfileContext();
        Command<String, Object, ProfileContext> command = new ProfileCheck();

        command.execute(context);

        Profile profile = context.getProfile();
        assertNotNull("Missing org.apache.commons.chain2.cookbook.profile.Profile", profile);
    }

}