### Question:
ExchangeConfig extends AbstractConfig { public boolean validate() { if (StringUtils.isEmpty(getName())) { log.error("Invalid Exchange Configuration : Name must be provided for an exchange"); return false; } log.info("Exchange configuration validated successfully for exchange '{}'", getName()); return true; }  boolean validate(); ExchangeConfig applyDefaultConfig(ExchangeConfig defaultExchangeConfig); AbstractExchange buildExchange(ExchangeConfig defaultExchangeConfig);  }### Answer:
@Test public void exchangeConfigWithNameAndValidationSuccessTest() { exchangeConfig = ExchangeConfig.builder().name(exchangeName).build(); assertTrue(exchangeConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Exchange configuration validated successfully for exchange '%s'", exchangeName))); }
@Test public void exchangeConfigWithoutNameAndValidationFailTest() { exchangeConfig = ExchangeConfig.builder().build(); assertFalse(exchangeConfig.validate()); assertThat(outputCapture.toString(), containsString(String.format("Invalid Exchange Configuration : Name must be provided for an exchange"))); }