Skip to content

Commit 3e0bc12

Browse files
committed
Update tests.
1 parent 980872a commit 3e0bc12

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

kilo-client/src/test/java/org/httprpc/kilo/io/TemplateEncoderTest.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,17 +458,19 @@ public void testDateFormatModifiers() throws IOException {
458458

459459
var now = ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
460460

461-
assertEquals(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + ",\n"
462-
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + ",\n"
463-
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + ",\n"
464-
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + ",\n"
465-
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + ",\n"
466-
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + ",\n"
467-
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(LocalDateTime.of(localDate, LocalTime.MIDNIGHT)) + ",\n"
468-
+ DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).format(LocalDateTime.of(LocalDate.now(), localTime)) + ",\n"
469-
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).format(localDateTime) + ",\n"
470-
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).format(zonedLocalDate) + ",\n"
471-
+ DateTimeFormatter.ofLocalizedTime(FormatStyle.LONG).format(zonedLocalTime) + ",\n"
461+
var lineSeparator = System.lineSeparator();
462+
463+
assertEquals(DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + "," + lineSeparator
464+
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + "," + lineSeparator
465+
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + "," + lineSeparator
466+
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + "," + lineSeparator
467+
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(now) + "," + lineSeparator
468+
+ DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(now) + "," + lineSeparator
469+
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(LocalDateTime.of(localDate, LocalTime.MIDNIGHT)) + "," + lineSeparator
470+
+ DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).format(LocalDateTime.of(LocalDate.now(), localTime)) + "," + lineSeparator
471+
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).format(localDateTime) + "," + lineSeparator
472+
+ DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).format(zonedLocalDate) + "," + lineSeparator
473+
+ DateTimeFormatter.ofLocalizedTime(FormatStyle.LONG).format(zonedLocalTime) + "," + lineSeparator
472474
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG).format(zonedLocalDateTime), writer.toString());
473475
}
474476

kilo-test/src/test/java/org/httprpc/kilo/test/WebServiceProxyTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.OutputStream;
2727
import java.net.SocketTimeoutException;
2828
import java.net.URI;
29+
import java.net.URISyntaxException;
2930
import java.net.URL;
3031
import java.nio.file.Paths;
3132
import java.time.DayOfWeek;
@@ -394,7 +395,7 @@ public void testFormDataPost() throws IOException {
394395
}
395396

396397
@Test
397-
public void testFormDataPostProxy() throws IOException {
398+
public void testFormDataPostProxy() throws URISyntaxException, IOException {
398399
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURI);
399400

400401
var now = new Date();
@@ -407,8 +408,8 @@ public void testFormDataPostProxy() throws IOException {
407408
entry("strings", listOf("a", "b", "c")),
408409
entry("number", 123),
409410
entry("date", now),
410-
entry("file", Paths.get(textURL.getPath())),
411-
entry("files", listOf(Paths.get(textURL.getPath()), Paths.get(imageURL.getPath())))
411+
entry("file", Paths.get(textURL.toURI())),
412+
entry("files", listOf(Paths.get(textURL.toURI()), Paths.get(imageURL.toURI())))
412413
), TestServiceProxy.FormData.class);
413414

414415
var result = testServiceProxy.testFormDataPost(formData);

0 commit comments

Comments
 (0)