Skip to content

Commit

Permalink
Correct test after #168
Browse files Browse the repository at this point in the history
  • Loading branch information
hdsdi3g committed Jun 15, 2024
1 parent 477c0c4 commit 4497ad0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.function.Predicate;
Expand Down Expand Up @@ -114,7 +115,13 @@ private static Optional<String> getMavenVersion() {
log.debug("Run {}", mvnCmdLine);
Process r;
if (System.getProperty("os.name", "").toLowerCase().contains("windows")) {
r = Runtime.getRuntime().exec("cmd /c " + mvnCmdLine);
final var cmd = Stream.concat(
Stream.of("cmd", "/c"),
Arrays.asList(mvnCmdLine.split(" ")).stream())
.toList()
.toArray(new String[] {});

r = Runtime.getRuntime().exec(cmd);
} else {
r = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", mvnCmdLine });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package tv.hd3g.mailkit.notification.implmail;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -94,6 +95,8 @@ public boolean isSendAsSimpleNotificationThisContextEntry(final String contextKe
.thenReturn(faker.numerify("translate###"));
when(translate.i18n(eq(lang), eq(event.typeName()), any(), any(), any()))
.thenReturn(faker.numerify("translate###"));
when(translate.i18n(eq(lang), eq(event), any(), any(), any(), any()))
.thenReturn(faker.numerify("translate###"));
}

String checkStr(final String result) {
Expand Down Expand Up @@ -131,19 +134,19 @@ void testSpanWrapp() {
@Test
void testFormatLongDate() {
final var result = t.formatLongDate(new Date(2_000_000_000_000l), Locale.ENGLISH);
assertTrue(result.startsWith("Wednesday, May 18, 2033, ") && result.endsWith(":33:20 AM"), result);
assertThat(result).isEqualTo("Wednesday, May 18, 2033, 5:33:20AM");
}

@Test
void testFormatShortDate() {
final var result = t.formatShortDate(new Date(2_000_000_000_000l), Locale.ENGLISH);
assertTrue(result.startsWith("5/18/33, ") && result.endsWith(":33:20 AM"), result);
assertThat(result).isEqualTo("5/18/33, 5:33:20AM");
}

@Test
void testFormatShortTime() {
final var result = t.formatShortTime(new Date(2_000_000_000_000l), Locale.ENGLISH);
assertTrue(result.endsWith(":33:20 AM"), result);
assertThat(result).isEqualTo("5:33:20AM");
}

@Test
Expand Down

0 comments on commit 4497ad0

Please sign in to comment.