Java Code Examples for java.time.temporal.ChronoUnit#values()
The following examples show how to use
java.time.temporal.ChronoUnit#values() .
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: TimeUnit8Test.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * tests for TimeUnit.of(ChronoUnit). */ public void testTimeUnitOf() throws Exception { assertSame(NANOSECONDS, TimeUnit.of(ChronoUnit.NANOS)); assertSame(MICROSECONDS, TimeUnit.of(ChronoUnit.MICROS)); assertSame(MILLISECONDS, TimeUnit.of(ChronoUnit.MILLIS)); assertSame(SECONDS, TimeUnit.of(ChronoUnit.SECONDS)); assertSame(MINUTES, TimeUnit.of(ChronoUnit.MINUTES)); assertSame(HOURS, TimeUnit.of(ChronoUnit.HOURS)); assertSame(DAYS, TimeUnit.of(ChronoUnit.DAYS)); assertThrows(NullPointerException.class, () -> TimeUnit.of((ChronoUnit)null)); // ChronoUnits either round trip to their TimeUnit // equivalents, or throw IllegalArgumentException. for (ChronoUnit cu : ChronoUnit.values()) { final TimeUnit tu; try { tu = TimeUnit.of(cu); } catch (IllegalArgumentException acceptable) { continue; } assertSame(cu, tu.toChronoUnit()); } }
Example 2
Source File: IntervalShardingAlgorithm.java From shardingsphere with Apache License 2.0 | 5 votes |
private ChronoUnit getStepUnit(final String stepUnit) { for (ChronoUnit each : ChronoUnit.values()) { if (each.toString().equalsIgnoreCase(stepUnit)) { return each; } } throw new UnsupportedOperationException(String.format("Cannot find step unit for specified %s property: `%s`", INTERVAL_UNIT_KEY, stepUnit)); }
Example 3
Source File: TCKChronoUnit.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 4
Source File: TCKChronoUnit.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 5
Source File: TCKChronoUnit.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 6
Source File: TCKChronoUnit.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 7
Source File: TCKChronoUnit.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 8
Source File: TCKChronoUnit.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 9
Source File: TCKChronoUnit.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 10
Source File: TCKChronoUnit.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 11
Source File: TCKChronoUnit.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 12
Source File: TCKChronoUnit.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 13
Source File: TCKChronoUnit.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 14
Source File: TCKChronoUnit.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 15
Source File: TCKChronoUnit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }
Example 16
Source File: TCKChronoUnit.java From j2objc with Apache License 2.0 | 4 votes |
@Test public void test_valueOf() { for (ChronoUnit unit : ChronoUnit.values()) { assertEquals(ChronoUnit.valueOf(unit.name()), unit); } }