@Test public void testLhsOrder() { // DROOLS-3080 final SpreadsheetCompiler converter = new SpreadsheetCompiler(); String drl = converter.compile("/data/LhsOrder.xls", InputType.XLS); Assertions.assertThat(Stream.of(drl.split("\n")).map(String::trim).toArray()) .as("Lhs order is wrong") .containsSequence("accumulate(Person(name == \"John\", $a : age); $max:max($a))", "$p:Person(name == \"John\", age == $max)"); } }
public GenericRestExceptionAssert matches(String i18nMessageKey, String... i18nProperties) { assertEquals("The message key of the exception did not match up", i18nMessageKey, actual.getI18nKey()); assertThat(actual.getI18nParameters()).as("I18n properties").containsExactly(i18nProperties); return this; }
@Test public void init_method_should_log_when_created() throws Exception { //given assertThat(platformSetup.isPlatformAlreadyCreated()).isFalse(); //when systemOutRule.clearLog(); platformSetup.init(); //then assertThat(platformSetup.isPlatformAlreadyCreated()).isTrue(); final String log = systemOutRule.getLogWithNormalizedLineSeparator(); final String[] split = log.split("\n"); assertThat(log).as("should setup log message").doesNotContain("Platform is already created. Nothing to do."); assertThat(split).as("should setup log message").isNotEmpty(); assertThat(log).as("should create platform and log message").contains("Platform created."); assertThat(split[split.length - 1]).as("should push Initial configuration and log message") .contains("INFO") .endsWith("Initial configuration files successfully pushed to database"); }
@Test public void clean_method_should_delete_and_log() throws Exception { //given final Path path = temporaryFolder.newFolder("afterClean").toPath(); final Path licensePath = temporaryFolder.newFolder("licenses").toPath(); platformSetup.init(); //when systemOutRule.clearLog(); platformSetup.clean(); //then final String log = systemOutRule.getLogWithNormalizedLineSeparator(); final String[] split = log.split("\n"); assertThat(split).as("should log message").isNotEmpty(); assertThat(split[split.length - 1]).as("should log message").contains("DEBUG") .endsWith("Execute DeleteAllConfigurationInTransaction transaction."); platformSetup.pull(path, licensePath); List<FullBonitaConfiguration> configurations = new ArrayList<>(); Files.walkFileTree(path, new AllConfigurationResourceVisitor(configurations)); assertThat(configurations).as("should remove all files").isEmpty(); Files.walkFileTree(licensePath, new AllConfigurationResourceVisitor(configurations)); assertThat(configurations).as("should remove all files").isEmpty(); }
String[] obtained = attribute.getOptions().toArray(new String[] {}); Arrays.sort(obtained); assertThat(obtained).as("Options do not match: ").isEqualTo(expected);