fix tests problems with date formats and java versions

This commit is contained in:
Grahame Grieve 2022-01-29 09:16:48 +11:00
parent dd65f5a975
commit 3559bd6638
3 changed files with 11 additions and 2 deletions

View File

@ -492,6 +492,10 @@ public class RenderingContext {
this.dateTimeFormat = dateTimeFormat; this.dateTimeFormat = dateTimeFormat;
} }
public void setDateTimeFormatString(String dateTimeFormat) {
this.dateTimeFormat = DateTimeFormatter.ofPattern(dateTimeFormat);
}
/** /**
* In the absence of a specified format, the renderers will default to * In the absence of a specified format, the renderers will default to
* the FormatStyle.MEDIUM for the current locale. * the FormatStyle.MEDIUM for the current locale.
@ -506,6 +510,10 @@ public class RenderingContext {
this.dateFormat = dateFormat; this.dateFormat = dateFormat;
} }
public void setDateFormatString(String dateFormat) {
this.dateFormat = DateTimeFormatter.ofPattern(dateFormat);
}
public ResourceRendererMode getMode() { public ResourceRendererMode getMode() {
return mode; return mode;
} }

View File

@ -143,8 +143,8 @@ public class NarrativeGenerationTests {
// getting timezones correct (well, at least consistent, so tests pass on any computer) // getting timezones correct (well, at least consistent, so tests pass on any computer)
rc.setLocale(new java.util.Locale("en", "AU")); rc.setLocale(new java.util.Locale("en", "AU"));
rc.setTimeZoneId(ZoneId.of("Australia/Sydney")); rc.setTimeZoneId(ZoneId.of("Australia/Sydney"));
rc.setDateTimeFormat(null); rc.setDateTimeFormatString("yyyy-MM-dd'T'HH:mm:ssZZZZZ");
rc.setDateFormat(null); rc.setDateFormatString("yyyy-MM-dd");
rc.setMode(test.technical ? ResourceRendererMode.TECHNICAL : ResourceRendererMode.END_USER); rc.setMode(test.technical ? ResourceRendererMode.TECHNICAL : ResourceRendererMode.END_USER);

View File

@ -373,6 +373,7 @@ public class I18nConstants {
public static final String SD_ED_BIND_UNKNOWN_VS = "SD_ED_BIND_UNKNOWN_VS"; public static final String SD_ED_BIND_UNKNOWN_VS = "SD_ED_BIND_UNKNOWN_VS";
public static final String SD_ED_BIND_NOT_VS = "SD_ED_BIND_NOT_VS"; public static final String SD_ED_BIND_NOT_VS = "SD_ED_BIND_NOT_VS";
public static final String SD_ED_BIND_NO_BINDABLE = "SD_ED_BIND_NO_BINDABLE"; public static final String SD_ED_BIND_NO_BINDABLE = "SD_ED_BIND_NO_BINDABLE";
public static final String SD_ED_BIND_MULTIPLE_TYPES = "SD_ED_BIND_MULTIPLE_TYPES";
public static final String SD_VALUE_TYPE_IILEGAL = "SD_VALUE_TYPE_IILEGAL"; public static final String SD_VALUE_TYPE_IILEGAL = "SD_VALUE_TYPE_IILEGAL";
public static final String SD_NO_TYPES_OR_CONTENTREF = "SD_NO_TYPES_OR_CONTENTREF"; public static final String SD_NO_TYPES_OR_CONTENTREF = "SD_NO_TYPES_OR_CONTENTREF";
public static final String SEARCHPARAMETER_BASE_WRONG = "SEARCHPARAMETER_BASE_WRONG"; public static final String SEARCHPARAMETER_BASE_WRONG = "SEARCHPARAMETER_BASE_WRONG";