class Command implements Serializable {

	public void validate() {
		Optional.ofNullable(getAction())
			.orElseThrow(()->new InvalidConfigException(String.format(MISSING_COMMAND_ARGUMENTS_MSG, getAbsoluteUri(), "Action")));
		
		if(CollectionUtils.isEmpty(getBehaviors()))
			throw new InvalidConfigException(String.format(MISSING_COMMAND_ARGUMENTS_MSG, getAbsoluteUri(), "Behavior"));
		
		validateCommandArgument(Type.ClientAlias);
		validateCommandArgument(Type.AppAlias);
		validateCommandArgument(Type.PlatformMarker);
		validateCommandArgument(Type.DomainAlias);
	}

}

class CommandTest {

	@Rule
	public ExpectedException expectedEx;

	@Test
	public void testInvalidCommandMissingBehavior() throws Exception {

		expectedEx.expect(InvalidConfigException.class);
		expectedEx.expectMessage("Command with URI: /anthem/org/fep/p/umcase_view:100/_get cannot have null Behavior.");
		Command cmd = CommandBuilder.withUri("/anthem/org/fep/p/umcase_view:100/_get").getCommand();
		cmd.setBehaviors(null);
		cmd.validate();
	}

}