Skip to content

Commit

Permalink
Add aliases for Month and DayOfWeek.
Browse files Browse the repository at this point in the history
  • Loading branch information
joehni committed Feb 19, 2017
1 parent fd8b27f commit fc718d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xstream/src/java/com/thoughtworks/xstream/XStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,13 @@ protected void setupAliases() {
alias("offset-clock", JVM.loadClassForName("java.time.Clock$OffsetClock"));
alias("system-clock", JVM.loadClassForName("java.time.Clock$SystemClock"));
alias("tick-clock", JVM.loadClassForName("java.time.Clock$TickClock"));
alias("day-of-week", JVM.loadClassForName("java.time.DayOfWeek"));
alias("duration", JVM.loadClassForName("java.time.Duration"));
alias("instant", JVM.loadClassForName("java.time.Instant"));
alias("local-date", JVM.loadClassForName("java.time.LocalDate"));
alias("local-date-time", JVM.loadClassForName("java.time.LocalDateTime"));
alias("local-time", JVM.loadClassForName("java.time.LocalTime"));
alias("month", JVM.loadClassForName("java.time.Month"));
alias("month-day", JVM.loadClassForName("java.time.MonthDay"));
alias("offset-date-time", JVM.loadClassForName("java.time.OffsetDateTime"));
alias("offset-time", JVM.loadClassForName("java.time.OffsetTime"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package com.thoughtworks.acceptance;

import java.time.Clock;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
Expand Down Expand Up @@ -325,6 +326,14 @@ public void testLocalTimeIsImmutable() {
+ "</local-time-array>");
}

public void testDayOfWeek() {
assertBothWays(DayOfWeek.MONDAY, "<day-of-week>MONDAY</day-of-week>");
}

public void testMonth() {
assertBothWays(Month.FEBRUARY, "<month>FEBRUARY</month>");
}

public void testMonthDay() {
assertBothWays(MonthDay.of(1, 13), "<month-day>--01-13</month-day>");
assertBothWays(MonthDay.of(2, 29), "<month-day>--02-29</month-day>");
Expand Down

0 comments on commit fc718d0

Please sign in to comment.