Minor cleanups

This commit is contained in:
Erik C. Thauvin 2025-05-12 21:53:24 -07:00
parent d288fd6fce
commit d201e2fef1
Signed by: erik
GPG key ID: 776702A6A2DA330E
3 changed files with 9 additions and 0 deletions

View file

@ -81,6 +81,7 @@ public final class RenderUtils {
*/
public static final DateTimeFormatter RFC_2822_FORMATTER =
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
private static final String DEFAULT_USER_AGENT =
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
private static final Logger LOGGER = Logger.getLogger(RenderUtils.class.getName());

View file

@ -31,24 +31,28 @@ class TestDateTime {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
void dateIso() {
var t = TemplateFactory.HTML.get("dateIso");
assertThatCode(() -> RenderUtils.ISO_8601_DATE_FORMATTER.parse(t.getContent())).doesNotThrowAnyException();
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
void dateTimeIso() {
var t = TemplateFactory.HTML.get("dateTimeIso");
assertThatCode(() -> RenderUtils.ISO_8601_FORMATTER.parse(t.getContent())).doesNotThrowAnyException();
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
void dateTimeRfc2822() {
var t = TemplateFactory.HTML.get("dateTimeRfc2822");
assertThatCode(() -> RenderUtils.RFC_2822_FORMATTER.parse(t.getContent())).doesNotThrowAnyException();
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
void dateTimeUtc() {
var t = TemplateFactory.HTML.get("dateTimeUtc");
var content = t.getContent();
@ -58,6 +62,7 @@ class TestDateTime {
}
@Test
@SuppressWarnings("ResultOfMethodCallIgnored")
void timeIso() {
var t = TemplateFactory.HTML.get("timeIso");
assertThatCode(() -> RenderUtils.ISO_8601_TIME_FORMATTER.parse(t.getContent())).doesNotThrowAnyException();

View file

@ -19,6 +19,7 @@ package rife.render;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import rife.template.TemplateFactory;
@ -66,6 +67,7 @@ class TestFormat {
@Test
@DisabledOnCi
@Tag("no-ci")
void qrCode() {
var t = TemplateFactory.SVG.get("qrCode");
var foo = "https://example.com/";
@ -75,6 +77,7 @@ class TestFormat {
@Test
@DisabledOnCi
@Tag("no-ci")
void shortenUrl() {
var t = TemplateFactory.HTML.get("shortenUrl");
var url = "https://example.com/";