Java Code Examples for java.time.Duration#get()

The following examples show how to use java.time.Duration#get() . These examples are extracted from open source projects. 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
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 2
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 3
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 4
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 5
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 6
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 7
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 8
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 9
@Test()
public void test_getUnit() {
    Duration test = Duration.ofSeconds(2000, 1000);
    long seconds = test.get(ChronoUnit.SECONDS);
    assertEquals(seconds, 2000, "duration.get(SECONDS)");
    long nanos = test.get(ChronoUnit.NANOS);
    assertEquals(nanos, 1000, "duration.get(NANOS)");
}
 
Example 10
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 11
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 12
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 13
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 14
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 15
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 16
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 17
Source Project: j2objc   File: TCKDuration.java    License: Apache License 2.0 4 votes vote down vote up
@Test(expected=DateTimeException.class)
@UseDataProvider("provider_factory_of_badTemporalUnit")
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 18
Source Project: hottub   File: TCKDuration.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 19
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}
 
Example 20
@Test(dataProvider="BadTemporalUnit", expectedExceptions=DateTimeException.class)
public void test_bad_getUnit(long amount, TemporalUnit unit) {
    Duration t = Duration.of(amount, unit);
    t.get(unit);
}