This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 8924c14a5c Replace call to `LocalDate.parse(String)` by
`LocalDate.of(year, month, day)` in tests.
8924c14a5c is described below
commit 8924c14a5c52de27dfeb4e81845dc27118c47e82
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu May 30 10:18:46 2024 +0200
Replace call to `LocalDate.parse(String)` by `LocalDate.of(year, month,
day)` in tests.
---
.../test/org/apache/sis/xml/bind/gml/TimePeriodTest.java | 8 ++++----
.../test/org/apache/sis/xml/privy/XmlUtilitiesTest.java | 10 +++++-----
.../apache/sis/referencing/AbstractReferenceSystemTest.java | 4 ++--
.../apache/sis/referencing/datum/DefaultGeodeticDatumTest.java | 2 +-
.../test/org/apache/sis/test/integration/MetadataTest.java | 8 ++++----
.../org/apache/sis/test/integration/MetadataVerticalTest.java | 8 ++++----
.../test/org/apache/sis/measure/RangeFormatTest.java | 8 ++++----
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java
index cb8f621956..667ae3cd1a 100644
---
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java
+++
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/bind/gml/TimePeriodTest.java
@@ -178,8 +178,8 @@ public final class TimePeriodTest extends TestCase {
@Test
public void testSimplifiedPeriodGML3() throws JAXBException {
createContext();
- final var begin = new
TimePeriodBound.GML3(LocalDate.parse("1992-01-02"), "before");
- final var end = new
TimePeriodBound.GML3(LocalDate.parse("2007-12-31"), "after");
+ final var begin = new TimePeriodBound.GML3(LocalDate.of(1992, 1, 2),
"before");
+ final var end = new TimePeriodBound.GML3(LocalDate.of(2007, 12, 31),
"after");
testPeriod(begin, end,
"<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" +
" <gml:beginPosition>1992-01-02</gml:beginPosition>\n" +
@@ -197,7 +197,7 @@ public final class TimePeriodTest extends TestCase {
public void testBeforePeriodGML3() throws JAXBException {
createContext();
final var begin = new TimePeriodBound.GML3(null, "before");
- final var end = new
TimePeriodBound.GML3(LocalDate.parse("2007-12-31"), "after");
+ final var end = new TimePeriodBound.GML3(LocalDate.of(2007, 12, 31),
"after");
testPeriod(begin, end,
"<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" +
" <gml:beginPosition indeterminatePosition=\"before\"/>\n" +
@@ -214,7 +214,7 @@ public final class TimePeriodTest extends TestCase {
@Test
public void testAfterPeriodGML3() throws JAXBException {
createContext();
- final var begin = new
TimePeriodBound.GML3(LocalDate.parse("1992-01-02"), "before");
+ final var begin = new TimePeriodBound.GML3(LocalDate.of(1992, 1, 2),
"before");
final var end = new TimePeriodBound.GML3(null, "after");
testPeriod(begin, end,
"<gml:TimePeriod xmlns:gml=\"" + Namespaces.GML + "\">\n" +
diff --git
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/privy/XmlUtilitiesTest.java
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/privy/XmlUtilitiesTest.java
index 34f46dac3e..5666f93d76 100644
---
a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/privy/XmlUtilitiesTest.java
+++
b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/privy/XmlUtilitiesTest.java
@@ -92,27 +92,27 @@ public final class XmlUtilitiesTest extends TestCase {
assertEquals("2009-01-01T06:00:00+01:00", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
- t = LocalDateTime.parse("2009-08-12T06:20:10");
+ t = LocalDateTime.of(2009, 8, 12, 6, 20, 10);
calendar = XmlUtilities.toXML(context, t);
assertEquals("2009-08-12T06:20:10", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
- t = LocalTime.parse("06:10:45");
+ t = LocalTime.of(6, 10, 45);
calendar = XmlUtilities.toXML(context, t);
assertEquals("06:10:45", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
- t = LocalDate.parse("2009-05-08");
+ t = LocalDate.of(2009, 5, 8);
calendar = XmlUtilities.toXML(context, t);
assertEquals("2009-05-08", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
- t = YearMonth.parse("2009-05");
+ t = YearMonth.of(2009, 5);
calendar = XmlUtilities.toXML(context, t);
assertEquals("2009-05", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
- t = Year.parse("2012");
+ t = Year.of(2012);
calendar = XmlUtilities.toXML(context, t);
assertEquals("2012", calendar.toString());
assertEquals(t, XmlUtilities.toTemporal(context, calendar));
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AbstractReferenceSystemTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AbstractReferenceSystemTest.java
index 4468817c73..c6eb2e53d0 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AbstractReferenceSystemTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AbstractReferenceSystemTest.java
@@ -114,8 +114,8 @@ public final class AbstractReferenceSystemTest extends
TestCase {
assertNull(properties.put(DOMAIN_OF_VALIDITY_KEY, new
DefaultExtent("Netherlands offshore.",
new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77),
new DefaultVerticalExtent(10, 1000, VerticalCRSMock.DEPTH),
- new DefaultTemporalExtent(LocalDate.parse("2010-04-05"),
- LocalDate.parse("2010-09-08")))));
+ new DefaultTemporalExtent(LocalDate.of(2010, 4, 5),
+ LocalDate.of(2010, 9, 8)))));
final var object = new AbstractReferenceSystem(properties);
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
index 01a0fa77eb..15c196a909 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
@@ -307,7 +307,7 @@ public final class DefaultGeodeticDatumTest extends
TestCase {
assertEquals("Satellite navigation.", getScope(datum));
assertEquals("Station coordinates changed by a few centimetres in
1994, 1997, 2002 and 2012.",
datum.getAnchorDefinition().orElseThrow().toString());
- assertEquals(LocalDate.parse("1984-01-01"),
datum.getAnchorEpoch().orElseThrow());
+ assertEquals(LocalDate.of(1984, 1, 1),
datum.getAnchorEpoch().orElseThrow());
assertRemarksEquals("Defining parameters cited in EPSG database.",
datum.getEllipsoid(), null);
return datum;
}
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java
index 7d834ee2d3..12a5b5d25c 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataTest.java
@@ -142,8 +142,8 @@ public final class MetadataTest extends TestCase.WithLogs {
final var citation = new DefaultCitation("Some set of points");
citation.setAlternateTitles(Set.of(new
SimpleInternationalString("Code XYZ")));
citation.setDates(List.of(
- new DefaultCitationDate(LocalDate.parse("1990-06-05"),
DateType.REVISION),
- new DefaultCitationDate(LocalDate.parse("1979-08-03"),
DateType.CREATION)));
+ new DefaultCitationDate(LocalDate.of(1990, 6, 5),
DateType.REVISION),
+ new DefaultCitationDate(LocalDate.of(1979, 8, 3),
DateType.CREATION)));
{
@SuppressWarnings("deprecation")
final var originator = new
DefaultResponsibleParty(Role.ORIGINATOR);
@@ -183,7 +183,7 @@ public final class MetadataTest extends TestCase.WithLogs {
keyword.setType(KeywordType.THEME);
final var thesaurus = new DefaultCitation("BODC Parameter
Discovery Vocabulary");
thesaurus.setAlternateTitles(Set.of(new
SimpleInternationalString("P021")));
- thesaurus.setDates(Set.of(new
DefaultCitationDate(LocalDate.parse("2008-11-26"), DateType.REVISION)));
+ thesaurus.setDates(Set.of(new
DefaultCitationDate(LocalDate.of(2008, 11, 26), DateType.REVISION)));
thesaurus.setEdition(new Anchor(URI.create("SDN:C371:1:35"),
"35"));
thesaurus.setIdentifiers(Set.of(new ImmutableIdentifier(null,
null, "http://www.seadatanet.org/urnurl/")));
keyword.setThesaurusName(thesaurus);
@@ -213,7 +213,7 @@ public final class MetadataTest extends TestCase.WithLogs {
final var aggregateInfo = new DefaultAggregateInformation();
final var name = new DefaultCitation("Some oceanographic
campaign");
name.setAlternateTitles(Set.of(new
SimpleInternationalString("Pseudo group of data")));
- name.setDates(Set.of(new
DefaultCitationDate(LocalDate.parse("1990-06-05"), DateType.REVISION)));
+ name.setDates(Set.of(new
DefaultCitationDate(LocalDate.of(1990, 6, 5), DateType.REVISION)));
aggregateInfo.setName(name);
aggregateInfo.setInitiativeType(InitiativeType.CAMPAIGN);
aggregateInfo.setAssociationType(AssociationType.LARGER_WORK_CITATION);
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataVerticalTest.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataVerticalTest.java
index 334a545459..949b1c0a2d 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataVerticalTest.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/test/integration/MetadataVerticalTest.java
@@ -88,10 +88,10 @@ public final class MetadataVerticalTest extends
TestCase.WithLogs {
@Test
public void testMetadataWithVerticalCRS() throws JAXBException {
final Metadata metadata = unmarshalFile(Metadata.class,
openTestFile());
- assertEquals("20090901",
metadata.getMetadataIdentifier().getCode());
- assertEquals(Locale.ENGLISH,
getSingleton(metadata.getLocalesAndCharsets().keySet()));
- assertEquals(StandardCharsets.UTF_8,
getSingleton(metadata.getLocalesAndCharsets().values()));
- assertEquals(LocalDate.parse("2014-01-04"),
TemporalDate.toTemporal(getSingleton(metadata.getDateInfo()).getDate()));
+ assertEquals("20090901",
metadata.getMetadataIdentifier().getCode());
+ assertEquals(Locale.ENGLISH,
getSingleton(metadata.getLocalesAndCharsets().keySet()));
+ assertEquals(StandardCharsets.UTF_8,
getSingleton(metadata.getLocalesAndCharsets().values()));
+ assertEquals(LocalDate.of(2014, 1, 4),
TemporalDate.toTemporal(getSingleton(metadata.getDateInfo()).getDate()));
/*
* <gmd:contact>
* <gmd:CI_ResponsibleParty>
diff --git
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeFormatTest.java
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeFormatTest.java
index 7e2772dab1..19b54ecfd0 100644
---
a/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeFormatTest.java
+++
b/endorsed/src/org.apache.sis.util/test/org/apache/sis/measure/RangeFormatTest.java
@@ -307,8 +307,8 @@ public final class RangeFormatTest extends TestCase {
public void testFormatLocalDate() {
format = new RangeFormat(Locale.CANADA_FRENCH, LocalDate.class);
final Range<LocalDate> range = new Range<>(LocalDate.class,
- LocalDate.parse("2019-12-23"), true,
- LocalDate.parse("2020-05-31"), true);
+ LocalDate.of(2019, 12, 23), true,
+ LocalDate.of(2020, 5, 31), true);
/*
* Expected output is "[2019-12-23 … 2020-05-31]" but be robust
* to small variation in output format (years may be on 2 digits).
@@ -324,8 +324,8 @@ public final class RangeFormatTest extends TestCase {
public void testFormatLocalTime() {
format = new RangeFormat(Locale.FRANCE, LocalTime.class);
final Range<LocalTime> range = new Range<>(LocalTime.class,
- LocalTime.parse("06:00:00"), true,
- LocalTime.parse("18:00:00"), true);
+ LocalTime.of( 6, 0), true,
+ LocalTime.of(18, 0), true);
assertEquals("[06:00 … 18:00]", format.format(range));
}