XmlConfigurationStrategy implements ConfigurationStrategy { static XmlConfigurationStrategy newInstance(ConfigurationStreamProvider provider) throws ConfigurationException { InputStream stream = null; try { stream = provider.getConfigurationStream(); return new XmlConfigurationStrategy(stream); } finally { IOUtils.closeQuietly(stream); } } private  XmlConfigurationStrategy(InputStream input); @Override Class<? extends NotificationStrategy> getNotificationStrategy(); @Override @SuppressWarnings("rawtypes") Map<Class<? extends TaskParameters>, Class<? extends Task>> getTasksMap(); @Override boolean isValidation(); @Override boolean isIgnoreXmlConfiguration();  }
@Test public void testNegativeConstuctorWrongTask() throws ConfigurationException { InputStream stream = getClass().getClassLoader().getResourceAsStream("failing-task-sejda-config.xml"); expected.expectMessage( "The configured class java.lang.String is not a subtype of interface org.sejda.model.task.Task"); when(provider.getConfigurationStream()).thenReturn(stream); XmlConfigurationStrategy.newInstance(provider); }
@Test public void testNegativeConstuctorWrongParam() throws ConfigurationException { InputStream stream = getClass().getClassLoader().getResourceAsStream("failing-param-sejda-config.xml"); expected.expectMessage( "The configured class java.lang.String is not a subtype of interface org.sejda.model.parameter.base.TaskParameters"); when(provider.getConfigurationStream()).thenReturn(stream); XmlConfigurationStrategy.newInstance(provider); }
@Test public void testNegativeNotFoundClassParam() throws ConfigurationException { InputStream stream = getClass().getClassLoader().getResourceAsStream("failing-no-param-class-sejda-config.xml"); expected.expectMessage("Unable to find the configured bla.bla.not.existing.Class"); when(provider.getConfigurationStream()).thenReturn(stream); XmlConfigurationStrategy.newInstance(provider); }