@Test
public void addAssetCsvXlsReplaceConfigTest() {

    // config preserved
    ArgumentCaptor<ResourceConfiguration> resourceConfigCaptor = ArgumentCaptor.forClass(ResourceConfiguration.class);
    doThrow(new IllegalStateException("XLS resource not handled correctly!")).when(this.kbuilder).add(any(Resource.class), any(ResourceType.class));
    Resource resource = ResourceFactory.newClassPathResource("/data/resource.xls", getClass());
    DecisionTableConfigurationImpl config = new DecisionTableConfigurationImpl();
    config.setInputType(DecisionTableInputType.CSV);
    String worksheetName = "test-worksheet-name";
    config.setWorksheetName(worksheetName);
    resource.setConfiguration(config);
    // do method
    environment.addAsset(resource, ResourceType.DTABLE);
    verify(this.kbuilder).add(any(Resource.class), any(ResourceType.class), resourceConfigCaptor.capture());
    ResourceConfiguration replacedConfig = resourceConfigCaptor.getValue();
    assertTrue("Not a DecisionTableConfiguration, but a " + replacedConfig.getClass().getSimpleName(),
            replacedConfig instanceof DecisionTableConfiguration);
    assertEquals("Incorrect file type", DecisionTableInputType.XLS, ((DecisionTableConfiguration) replacedConfig).getInputType());
    assertEquals("Worksheet name not preserved", worksheetName, ((DecisionTableConfiguration) replacedConfig).getWorksheetName());
}