### Question:
BindingConfig extends AbstractConfig { @Override public boolean validate() { boolean valid = true; if (StringUtils.isEmpty(getExchange())) { log.error("Invalid Exchange : Exchange must be provided for a binding"); valid = false; } if (StringUtils.isEmpty(getQueue())) { log.error("Invalid Queue : Queue must be provided for a binding"); valid = false; } if (valid) { log.info("Binding configuration validated successfully for Binding '{}'", this); } return valid; }  @Override boolean validate(); Binding bind(Exchange exchange, Queue queue);  }### Answer:
@Test public void bindingConfigValidationSuccessTest() { bindingConfig = BindingConfig.builder().exchange(exchaneg).queue(queue).routingKey(routingKey).build(); assertTrue(bindingConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Binding configuration validated successfully for Binding '%s'", bindingConfig))); }
@Test public void bindingConfigWithoutExchnageAndValidationFailTest() { bindingConfig = BindingConfig.builder().exchange(null).queue(queue).routingKey(routingKey).build(); assertFalse(bindingConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Invalid Exchange : Exchange must be provided for a binding"))); }
@Test public void bindingConfigWithoutQueueAndValidationFailTest() { bindingConfig = BindingConfig.builder().exchange(exchaneg).queue(null).routingKey(routingKey).build(); assertFalse(bindingConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Invalid Queue : Queue must be provided for a binding"))); }
@Test public void bindingConfigNoExchangeAndNoQueueAndValidationFailTest() { bindingConfig = BindingConfig.builder().exchange(null).queue(null).routingKey(routingKey).build(); assertFalse(bindingConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Invalid Exchange : Exchange must be provided for a binding"))); assertThat(outputCapture.toString(), containsString(String.format("Invalid Queue : Queue must be provided for a binding"))); }