Java Code Examples for java.time.Period#getUnits()
The following examples show how to use
java.time.Period#getUnits() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PeriodFormats.java From PGM with GNU Affero General Public License v3.0 | 5 votes |
/** * Return the key for the localized description of the given time period, which must contain * exactly one field. */ private static String periodKey(Period period) { List<TemporalUnit> units = period.getUnits(); if (units.size() != 1) { throw new IllegalArgumentException("Periods with multiple units are not supported"); } TemporalUnit unit = units.get(0); return periodKey(unit, period.get(unit)); }
Example 2
Source File: TCKPeriod.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 3
Source File: TCKPeriod.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 4
Source File: TCKPeriod.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 5
Source File: TCKPeriod.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 6
Source File: TCKPeriod.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 7
Source File: TCKPeriod.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 8
Source File: TCKPeriod.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 9
Source File: TCKPeriod.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 10
Source File: TCKPeriod.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 11
Source File: TCKPeriod.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 12
Source File: TCKPeriod.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 13
Source File: TCKPeriod.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 14
Source File: TCKPeriod.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals(units.size(), 3, "Period.getUnits should return 3 units"); assertEquals(units.get(0), ChronoUnit.YEARS, "Period.getUnits contains ChronoUnit.YEARS"); assertEquals(units.get(1), ChronoUnit.MONTHS, "Period.getUnits contains ChronoUnit.MONTHS"); assertEquals(units.get(2), ChronoUnit.DAYS, "Period.getUnits contains ChronoUnit.DAYS"); }
Example 15
Source File: TCKPeriod.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_Period_getUnits() { Period period = Period.of(2012, 1, 1); List<TemporalUnit> units = period.getUnits(); assertEquals("Period.getUnits should return 3 units", units.size(), 3); assertEquals("Period.getUnits contains ChronoUnit.YEARS", units.get(0), ChronoUnit.YEARS); assertEquals("Period.getUnits contains ChronoUnit.MONTHS", units.get(1), ChronoUnit.MONTHS); assertEquals("Period.getUnits contains ChronoUnit.DAYS", units.get(2), ChronoUnit.DAYS); }