1 | package com.reallifedeveloper.common.domain; | |
2 | ||
3 | import java.time.Clock; | |
4 | import java.time.ZonedDateTime; | |
5 | ||
6 | /** | |
7 | * An implementation of the {@link TimeService} interface that uses a {@code java.time.Clock}. The clock is by default | |
8 | * {@code Clock.systemUTC()} but can be changed using the {@link #setClock(clock)} method. | |
9 | * | |
10 | * @author RealLifeDeveloper | |
11 | */ | |
12 | public class ClockTimeService implements TimeService { | |
13 | ||
14 | private Clock clock = Clock.systemUTC(); | |
15 | ||
16 | @Override | |
17 | public ZonedDateTime now() { | |
18 |
1
1. now : replaced return value with null for com/reallifedeveloper/common/domain/ClockTimeService::now → KILLED |
return ZonedDateTime.now(clock); |
19 | } | |
20 | ||
21 | /** | |
22 | * Sets the {@code java.time.Clock} used by this {@code ClockTimeService}. | |
23 | * | |
24 | * @param clock the new {@code Clock} to use | |
25 | */ | |
26 | public void setClock(Clock clock) { | |
27 | this.clock = clock; | |
28 | } | |
29 | } | |
Mutations | ||
18 |
1.1 |