MCPcopy Create free account
hub / github.com/MenoData/Time4J / DurationBasicsTest

Class DurationBasicsTest

base/src/test/java/net/time4j/DurationBasicsTest.java:29–1523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28
29@RunWith(JUnit4.class)
30public class DurationBasicsTest {
31
32 @Test
33 public void getPartialAmountYears() {
34 assertThat(
35 Duration.ofCalendarUnits(4, 3, 2).getPartialAmount(YEARS),
36 is(4L));
37 }
38
39 @Test
40 public void getPartialAmountMonths() {
41 assertThat(
42 Duration.ofCalendarUnits(4, 3, 2).getPartialAmount(MONTHS),
43 is(3L));
44 }
45
46 @Test
47 public void getPartialAmountWeeks() {
48 assertThat(
49 Duration.of(5, WEEKS).getPartialAmount(WEEKS),
50 is(5L));
51 assertThat(
52 Duration.ofCalendarUnits(4, 3, 7).getPartialAmount(WEEKS),
53 is(0L));
54 }
55
56 @Test
57 public void getPartialAmountDays() {
58 assertThat(
59 Duration.of(5, WEEKS).getPartialAmount(DAYS),
60 is(0L));
61 assertThat(
62 Duration.ofCalendarUnits(4, 3, 2).getPartialAmount(DAYS),
63 is(2L));
64 }
65
66 @Test
67 public void getPartialAmountHours() {
68 assertThat(
69 Duration.ofClockUnits(4, 3, 2).getPartialAmount(HOURS),
70 is(4L));
71 }
72
73 @Test
74 public void getPartialAmountMinutes() {
75 assertThat(
76 Duration.ofClockUnits(4, 3, 2).getPartialAmount(MINUTES),
77 is(3L));
78 }
79
80 @Test
81 public void getPartialAmountSeconds() {
82 assertThat(
83 Duration.ofClockUnits(4, 3, 2).getPartialAmount(SECONDS),
84 is(2L));
85 }
86

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected