java.time: running threeten tests

This commit is contained in:
Alexey Andreev 2020-05-05 13:25:05 +03:00 committed by Alexey Andreev
parent 91c00da57b
commit 81878548b4
52 changed files with 294 additions and 68 deletions

View File

@ -70,7 +70,7 @@ final class SimpleDateTimeTextProvider extends DateTimeTextProvider {
};
/** Cache. */
private final Map<Entry<TemporalField, Locale>, Object> cache = new HashMap<>();
private final Map<Entry<TemporalField, Locale>, Object> cache = new HashMap<>();
//-----------------------------------------------------------------------
@Override

View File

@ -40,7 +40,6 @@ import static org.threeten.bp.temporal.ChronoUnit.DAYS;
import static org.threeten.bp.temporal.ChronoUnit.MONTHS;
import static org.threeten.bp.temporal.ChronoUnit.WEEKS;
import static org.threeten.bp.temporal.ChronoUnit.YEARS;
import java.io.InvalidObjectException;
import java.io.Serializable;
import java.util.GregorianCalendar;

View File

@ -51,12 +51,17 @@ import static org.testng.Assert.assertEquals;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test Clock.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestClock {
static class MockInstantClock extends Clock {

View File

@ -54,12 +54,17 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test fixed clock.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestClockFixed extends AbstractTest {
private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");

View File

@ -55,12 +55,17 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test offset clock.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestClockOffset extends AbstractTest {
private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");

View File

@ -54,12 +54,17 @@ import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test system clock.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestClockSystem extends AbstractTest {
private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");

View File

@ -56,12 +56,17 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test tick clock.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestClockTick extends AbstractTest {
private static final ZoneId MOSCOW = ZoneId.of("Europe/Moscow");

View File

@ -48,6 +48,9 @@ package org.teavm.classlib.java.time;
import static org.testng.Assert.assertEquals;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.threeten.bp.jdk8.Jdk8Methods;
@ -56,6 +59,8 @@ import org.threeten.bp.jdk8.Jdk8Methods;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimesImplementation {
//-----------------------------------------------------------------------

View File

@ -70,6 +70,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -78,6 +81,8 @@ import org.testng.annotations.Test;
* Test DayOfWeek.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDayOfWeek extends AbstractDateTimeTest {
@BeforeMethod

View File

@ -65,6 +65,9 @@ import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalUnit;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -72,6 +75,8 @@ import org.testng.annotations.Test;
* Test Duration.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDuration extends AbstractTest {
//-----------------------------------------------------------------------

View File

@ -72,6 +72,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -79,6 +82,8 @@ import org.testng.annotations.Test;
* Test Instant.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestInstant extends AbstractDateTimeTest {
private static final long MIN_SECOND = Instant.MIN.getEpochSecond();

View File

@ -97,7 +97,10 @@ import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.temporal.MockFieldNoValue;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -106,6 +109,8 @@ import org.testng.annotations.Test;
* Test LocalDate.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestLocalDate extends AbstractDateTimeTest {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);

View File

@ -113,7 +113,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.temporal.MockFieldNoValue;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -122,6 +125,8 @@ import org.testng.annotations.Test;
* Test LocalDateTime.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestLocalDateTime extends AbstractDateTimeTest {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);

View File

@ -105,7 +105,10 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.temporal.MockFieldNoValue;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -114,6 +117,8 @@ import org.testng.annotations.Test;
* Test LocalTime.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestLocalTime extends AbstractDateTimeTest {
private LocalTime test12x30x40x987654321;

View File

@ -67,6 +67,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -74,6 +77,8 @@ import org.testng.annotations.Test;
* Test Month.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestMonth extends AbstractDateTimeTest {
private static final int MAX_LENGTH = 12;

View File

@ -109,6 +109,9 @@ import java.time.temporal.TemporalQueries;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -117,6 +120,8 @@ import org.testng.annotations.Test;
* Test OffsetDateTime.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestOffsetDateTime extends AbstractDateTimeTest {
private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");

View File

@ -56,12 +56,17 @@ import java.time.Month;
import java.time.OffsetDateTime;
import java.time.Year;
import java.time.ZoneOffset;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test OffsetDateTime creation.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestOffsetDateTimeInstants {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);

View File

@ -94,6 +94,9 @@ import java.time.temporal.TemporalQueries;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -102,6 +105,8 @@ import org.testng.annotations.Test;
* Test OffsetTime.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestOffsetTime extends AbstractDateTimeTest {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);

View File

@ -51,6 +51,9 @@ import static org.testng.Assert.assertSame;
import java.time.LocalDate;
import java.time.Period;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -58,6 +61,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestPeriod extends AbstractTest {
//-----------------------------------------------------------------------
// factories

View File

@ -65,6 +65,9 @@ import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.time.format.TextStyle;
@ -77,6 +80,8 @@ import java.time.zone.ZoneRulesException;
* Test ZoneId.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneId extends AbstractTest {
private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");

View File

@ -68,12 +68,17 @@ import java.time.temporal.TemporalQueries;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test ZoneOffset.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneOffset extends AbstractDateTimeTest {
//-----------------------------------------------------------------------

View File

@ -110,7 +110,10 @@ import java.time.temporal.TemporalQuery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.temporal.MockFieldNoValue;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -119,6 +122,8 @@ import org.testng.annotations.Test;
* Test ZonedDateTime.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZonedDateTime extends AbstractDateTimeTest {
private static final ZoneOffset OFFSET_0100 = ZoneOffset.ofHours(1);

View File

@ -70,6 +70,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -78,6 +81,8 @@ import org.testng.annotations.Test;
* Test assertions that must be true for all built-in chronologies.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronoLocalDate {
//-----------------------------------------------------------------------
// regular data factory for names and descriptions of available calendars

View File

@ -71,6 +71,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -78,8 +81,9 @@ import org.testng.annotations.Test;
/**
* Test assertions that must be true for all built-in chronologies.
*/
@SuppressWarnings("rawtypes")
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronoLocalDateTime {
//-----------------------------------------------------------------------
// regular data factory for names and descriptions of available calendars
@ -98,7 +102,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badWithAdjusterChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);
@ -122,7 +126,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badPlusAdjusterChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);
@ -146,7 +150,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badMinusAdjusterChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);
@ -170,7 +174,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badPlusPeriodUnitChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);
@ -194,7 +198,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badMinusPeriodUnitChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);
@ -218,7 +222,7 @@ public class TestChronoLocalDateTime {
@Test(dataProvider = "calendars")
public void test_badDateTimeFieldChrono(Chronology chrono) {
LocalDate refDate = LocalDate.of(1900, 1, 1);
ChronoLocalDateTime cdt = chrono.date(refDate).atTime(LocalTime.NOON);
ChronoLocalDateTime<?> cdt = chrono.date(refDate).atTime(LocalTime.NOON);
for (Object[] clist : data_of_calendars()) {
Chronology chrono2 = (Chronology) clist[0];
ChronoLocalDateTime<?> cdt2 = chrono2.date(refDate).atTime(LocalTime.NOON);

View File

@ -72,6 +72,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -80,6 +83,8 @@ import org.testng.annotations.Test;
* Test assertions that must be true for all built-in chronologies.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronoZonedDateTime {
//-----------------------------------------------------------------------
// regular data factory for names and descriptions of available calendars

View File

@ -59,6 +59,9 @@ import java.time.chrono.ThaiBuddhistChronology;
import java.time.temporal.ChronoField;
import java.util.Locale;
import java.util.Set;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@ -68,6 +71,8 @@ import org.testng.annotations.Test;
* Test Chrono class.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronology {
@BeforeMethod

View File

@ -62,6 +62,9 @@ import java.time.chrono.HijrahChronology;
import java.time.chrono.HijrahDate;
import java.time.chrono.IsoChronology;
import java.time.temporal.TemporalAdjusters;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -70,6 +73,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestHijrahChronology {
//-----------------------------------------------------------------------

View File

@ -66,6 +66,9 @@ import java.time.chrono.IsoChronology;
import java.time.chrono.IsoEra;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAdjusters;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -74,6 +77,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestIsoChronology {
//-----------------------------------------------------------------------

View File

@ -62,6 +62,9 @@ import java.time.chrono.JapaneseChronology;
import java.time.chrono.JapaneseEra;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -70,6 +73,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestJapaneseChronology {
//-----------------------------------------------------------------------

View File

@ -64,6 +64,9 @@ import java.time.chrono.MinguoChronology;
import java.time.chrono.MinguoEra;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -72,6 +75,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestMinguoChronology {
//-----------------------------------------------------------------------

View File

@ -66,6 +66,9 @@ import java.time.chrono.ThaiBuddhistEra;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.ValueRange;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -74,6 +77,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestThaiBuddhistChronology {
private static final int YDIFF = 543;

View File

@ -68,6 +68,9 @@ import java.time.format.SignStyle;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQuery;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@ -75,6 +78,8 @@ import org.testng.annotations.Test;
* Test DateTimeFormatter.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimeFormatter {
private static final DateTimeFormatter BASIC_FORMATTER = DateTimeFormatter.ofPattern("'ONE'd");

View File

@ -60,6 +60,9 @@ import java.time.format.TextStyle;
import java.time.temporal.TemporalAccessor;
import java.util.HashMap;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -68,6 +71,8 @@ import org.testng.annotations.Test;
* Test DateTimeFormatterBuilder.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimeFormatterBuilder {
private DateTimeFormatterBuilder builder;

View File

@ -80,6 +80,9 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -88,6 +91,8 @@ import org.testng.annotations.Test;
* Test DateTimeFormatters.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimeFormatters {
@BeforeMethod

View File

@ -65,6 +65,9 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.TemporalAccessor;
import java.util.Locale;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -72,6 +75,8 @@ import org.testng.annotations.Test;
* Test parsing of edge cases.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimeParsing {
private static final ZoneId PARIS = ZoneId.of("Europe/Paris");

View File

@ -59,6 +59,9 @@ import java.time.temporal.TemporalField;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -67,6 +70,8 @@ import org.testng.annotations.Test;
* Test text printing.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDateTimeTextPrinting {
private DateTimeFormatterBuilder builder;

View File

@ -52,12 +52,17 @@ import java.time.format.DecimalStyle;
import java.util.Locale;
import java.util.Set;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test DecimalStyle.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestDecimalStyle {
@Test

View File

@ -44,16 +44,22 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.threeten.bp.temporal;
package org.teavm.classlib.java.time.temporal;
import static org.testng.Assert.assertEquals;
import java.time.temporal.ChronoField;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronoField {
//-------------------------------------------------------------------------

View File

@ -63,6 +63,9 @@ import java.time.LocalDate;
import java.time.Month;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -70,6 +73,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestChronoUnit {
//-----------------------------------------------------------------------

View File

@ -62,6 +62,9 @@ import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.IsoFields;
import java.time.temporal.ValueRange;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -69,6 +72,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestIsoFields {
public void test_enum() {

View File

@ -52,6 +52,9 @@ import java.time.LocalDate;
import java.time.temporal.ChronoField;
import java.time.temporal.JulianFields;
import java.time.temporal.TemporalField;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -60,6 +63,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestJulianFields {
private static final LocalDate JAN01_1970 = LocalDate.of(1970, 1, 1);

View File

@ -75,7 +75,10 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractDateTimeTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -84,6 +87,8 @@ import org.testng.annotations.Test;
* Test MonthDay.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestMonthDay extends AbstractDateTimeTest {
private MonthDay test07x15;

View File

@ -59,6 +59,9 @@ import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.TemporalAdjusters;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -66,6 +69,8 @@ import org.testng.annotations.Test;
* Test DateTimeAdjusters.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestTemporalAdjusters {
//-----------------------------------------------------------------------

View File

@ -49,7 +49,10 @@ package org.teavm.classlib.java.time.temporal;
import static org.testng.Assert.assertEquals;
import java.time.temporal.ValueRange;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -57,6 +60,8 @@ import org.testng.annotations.Test;
* Test.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestValueRange extends AbstractTest {
//-----------------------------------------------------------------------

View File

@ -76,7 +76,10 @@ import java.time.temporal.TemporalQueries;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractDateTimeTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -85,6 +88,8 @@ import org.testng.annotations.Test;
* Test Year.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestYear extends AbstractDateTimeTest {
private static final Year TEST_2008 = Year.of(2008);

View File

@ -79,7 +79,10 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractDateTimeTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -88,6 +91,8 @@ import org.testng.annotations.Test;
* Test YearMonth.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestYearMonth extends AbstractDateTimeTest {
private YearMonth test2008x06;

View File

@ -62,6 +62,9 @@ import java.time.ZoneOffset;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneOffsetTransitionRule;
import java.time.zone.ZoneRules;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@ -69,6 +72,8 @@ import org.testng.annotations.Test;
* Test ZoneRules for fixed offset time-zones.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestFixedZoneRules {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);

View File

@ -44,42 +44,44 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.threeten.bp.zone;
package org.teavm.classlib.java.time.zone;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.time.Year;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.TextStyle;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneOffsetTransitionRule;
import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
import java.time.zone.ZoneRules;
import java.util.Iterator;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
import org.threeten.bp.DayOfWeek;
import org.threeten.bp.Duration;
import org.threeten.bp.Instant;
import org.threeten.bp.LocalDate;
import org.threeten.bp.LocalDateTime;
import org.threeten.bp.LocalTime;
import org.threeten.bp.Month;
import org.threeten.bp.Year;
import org.threeten.bp.ZoneId;
import org.threeten.bp.ZoneOffset;
import org.threeten.bp.ZonedDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import org.threeten.bp.format.DateTimeFormatterBuilder;
import org.threeten.bp.format.TextStyle;
import org.threeten.bp.zone.ZoneOffsetTransitionRule.TimeDefinition;
/**
* Test ZoneRules.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestStandardZoneRules {
private static final ZoneOffset OFFSET_ZERO = ZoneOffset.ofHours(0);
@ -88,29 +90,6 @@ public class TestStandardZoneRules {
public static final String LATEST_TZDB = "2009b";
private static final int OVERLAP = 2;
private static final int GAP = 0;
//-----------------------------------------------------------------------
// Basics
//-----------------------------------------------------------------------
public void test_serialization_loaded() throws Exception {
assertSerialization(europeLondon());
assertSerialization(europeParis());
assertSerialization(americaNewYork());
}
private void assertSerialization(ZoneRules test) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(test);
baos.close();
byte[] bytes = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream in = new ObjectInputStream(bais);
ZoneRules result = (ZoneRules) in.readObject();
assertEquals(result, test);
}
//-----------------------------------------------------------------------
// Etc/GMT
@ -663,7 +642,8 @@ public class TestStandardZoneRules {
assertEquals(test.getOffset(instant), OFFSET_PONE, zdt.toString());
} else {
assertEquals(test.getStandardOffset(instant), OFFSET_ZERO, zdt.toString());
assertEquals(test.getOffset(instant), zdt.getMonth() == Month.JANUARY ? OFFSET_ZERO : OFFSET_PONE, zdt.toString());
assertEquals(test.getOffset(instant), zdt.getMonth() == Month.JANUARY ? OFFSET_ZERO : OFFSET_PONE,
zdt.toString());
}
zdt = zdt.plusMonths(6);
}
@ -1106,13 +1086,13 @@ public class TestStandardZoneRules {
}
//-------------------------------------------------------------------------
@Test(expectedExceptions=UnsupportedOperationException.class)
@Test(expectedExceptions = UnsupportedOperationException.class)
public void test_getTransitions_immutable() {
ZoneRules test = europeParis();
test.getTransitions().clear();
}
@Test(expectedExceptions=UnsupportedOperationException.class)
@Test(expectedExceptions = UnsupportedOperationException.class)
public void test_getTransitionRules_immutable() {
ZoneRules test = europeParis();
test.getTransitionRules().clear();
@ -1160,7 +1140,8 @@ public class TestStandardZoneRules {
return LocalDateTime.of(year, month, day, hour, min).toInstant(offset);
}
private Instant createInstant(int year, int month, int day, int hour, int min, int sec, int nano, ZoneOffset offset) {
private Instant createInstant(int year, int month, int day, int hour, int min, int sec, int nano,
ZoneOffset offset) {
return LocalDateTime.of(year, month, day, hour, min, sec, nano).toInstant(offset);
}

View File

@ -54,13 +54,18 @@ import java.time.LocalDateTime;
import java.time.Year;
import java.time.ZoneOffset;
import java.time.zone.ZoneOffsetTransition;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test ZoneOffsetTransition.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneOffsetTransition extends AbstractTest {
private static final ZoneOffset OFFSET_0100 = ZoneOffset.ofHours(1);

View File

@ -56,13 +56,18 @@ import java.time.ZoneOffset;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneOffsetTransitionRule;
import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
import org.junit.runner.RunWith;
import org.teavm.classlib.java.time.AbstractTest;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
/**
* Test ZoneOffsetTransitionRule.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneOffsetTransitionRule extends AbstractTest {
private static final LocalTime TIME_0100 = LocalTime.of(1, 0);

View File

@ -68,6 +68,9 @@ import static org.threeten.bp.zone.ZoneOffsetTransitionRule.TimeDefinition.WALL;
import java.util.List;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.LocalDateTime;
@ -81,6 +84,8 @@ import org.threeten.bp.zone.ZoneOffsetTransitionRule.TimeDefinition;
* Test ZoneRulesBuilder.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneRulesBuilder {
private static final ZoneOffset OFFSET_1 = ZoneOffset.ofHours(1);

View File

@ -44,26 +44,32 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.threeten.bp.zone;
package org.teavm.classlib.java.time.zone;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.time.ZoneOffset;
import java.time.zone.ZoneRules;
import java.time.zone.ZoneRulesException;
import java.time.zone.ZoneRulesProvider;
import java.util.Collections;
import java.util.HashSet;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.junit.WholeClassCompilation;
import org.testng.annotations.Test;
import org.threeten.bp.ZoneOffset;
/**
* Test ZoneRulesProvider.
*/
@Test
@RunWith(TeaVMTestRunner.class)
@WholeClassCompilation
public class TestZoneRulesProvider {
//-----------------------------------------------------------------------
@ -94,12 +100,12 @@ public class TestZoneRulesProvider {
assertEquals(rules2, rules);
}
@Test(expectedExceptions=ZoneRulesException.class)
@Test(expectedExceptions = ZoneRulesException.class)
public void test_getRules_String_unknownId() {
ZoneRulesProvider.getRules("Europe/Lon", false);
}
@Test(expectedExceptions=NullPointerException.class)
@Test(expectedExceptions = NullPointerException.class)
public void test_getRules_String_null() {
ZoneRulesProvider.getRules(null, false);
}
@ -114,19 +120,19 @@ public class TestZoneRulesProvider {
ZoneRules rules = ZoneRulesProvider.getRules("Europe/London", false);
assertEquals(versions.lastEntry().getValue(), rules);
NavigableMap<String, ZoneRules> copy = new TreeMap<String, ZoneRules>(versions);
NavigableMap<String, ZoneRules> copy = new TreeMap<>(versions);
versions.clear();
assertEquals(versions.size(), 0);
NavigableMap<String, ZoneRules> versions2 = ZoneRulesProvider.getVersions("Europe/London");
assertEquals(versions2, copy);
}
@Test(expectedExceptions=ZoneRulesException.class)
@Test(expectedExceptions = ZoneRulesException.class)
public void test_getVersions_String_unknownId() {
ZoneRulesProvider.getVersions("Europe/Lon");
}
@Test(expectedExceptions=NullPointerException.class)
@Test(expectedExceptions = NullPointerException.class)
public void test_getVersions_String_null() {
ZoneRulesProvider.getVersions(null);
}