InternalIsoDuration implements IsoDuration { @Override public long get( TemporalUnit unit ) { if ( unit == MONTHS ) { return months; } else if ( unit == DAYS ) { return days; } else if ( unit == SECONDS ) { return seconds; } else if ( unit == NANOS ) { return nanoseconds; } else { throw new UnsupportedTemporalTypeException( "Unsupported unit: " + unit ); } } InternalIsoDuration( Period period );  InternalIsoDuration( Duration duration );  InternalIsoDuration( long months, long days, long seconds, int nanoseconds );   InternalIsoDuration( long months, long days, Duration duration ); @Override long months(); @Override long days(); @Override long seconds(); @Override int nanoseconds(); @Override long get( TemporalUnit unit ); @Override List<TemporalUnit> getUnits(); @Override Temporal addTo( Temporal temporal ); @Override Temporal subtractFrom( Temporal temporal ); @Override boolean equals( Object o ); @Override int hashCode(); @Override String toString();  }
@Test void shouldFailToGetUnsupportedTemporalUnit() { IsoDuration duration = newDuration( 1, 2, 3, 4 ); assertThrows( UnsupportedTemporalTypeException.class, () -> duration.get( YEARS ) ); }