Try to fix test failing do to timezones.

This commit is contained in:
Mark Nellemann 2020-09-23 07:30:15 +02:00
parent 8d832e93f2
commit 688cbf12a3
2 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
Basic syslog server written in Java. All received messages are written to *stdout*.
The syslog server is able to listen on UDP and/or TCP and parses syslog messages in either RFC5424 or RFC3164 (BSD) format.
The syslog server is able to listen on UDP and/or TCP and parses syslog messages in either RFC5424 or RFC3164 (BSD) format. The default syslog port (514) requires you to run syslogd as root / administrator. If you do not with to do so, you can choose a port number (with the -p flag) above 1024.
*This project is in no way associated with, supported or endorsed by, International Business Machines Corporation (IBM).*

View File

@ -2,21 +2,21 @@ package biz.nellemann.syslogd
import spock.lang.Specification
import java.time.Instant
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
class SyslogParserTest extends Specification {
void "test parseRfc3164Timestamp"() {
setup:
LocalDateTime dt = LocalDateTime.now()
OffsetDateTime odt = OffsetDateTime.now()
String dateString = "Sep 12 22:50:13"
when:
Instant inst = SyslogParser.parseRfc3164Timestamp(dateString)
then:
inst.toString() == "${dt.getYear()}-09-12T20:50:13Z"
inst.toString() == "${odt.getYear()}-09-12T20:50:13Z"
}
void "test parseRfc5424Timestamp"() {