EMMA Coverage Report (generated Wed Jan 06 12:31:26 CET 2010)
[all classes][org.amicofragile.time]

COVERAGE SUMMARY FOR SOURCE FILE [SystemTime.java]

nameclass, %method, %block, %line, %
SystemTime.java100% (1/1)100% (5/5)100% (22/22)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SystemTime100% (1/1)100% (5/5)100% (22/22)100% (9/9)
<static initializer> 100% (1/1)100% (7/7)100% (2/2)
SystemTime (): void 100% (1/1)100% (6/6)100% (2/2)
currentTimeInMillis (): long 100% (1/1)100% (3/3)100% (1/1)
reset (): void 100% (1/1)100% (3/3)100% (2/2)
setTimeSource (TimeSource): void 100% (1/1)100% (3/3)100% (2/2)

1package org.amicofragile.time;
2/**
3 * System time access abstraction class.
4 * @author Pietro Martinelli
5 *
6 */
7public final class SystemTime {
8        /**
9         * Default {@link TimeSource}: this {@link TimeSource} delegates to {@link System#currentTimeMillis()}.
10         */
11        private static final TimeSource DEFAULT_TIME_SOURCE = new SystemTimeSource();
12        /**
13         * Current {@link TimeSource} in use.
14         */
15        private static TimeSource timeSource = DEFAULT_TIME_SOURCE;
16        /**
17         * Gets current time in milliseconds.
18         * @return current time in milliseconds
19         */
20        public static long currentTimeInMillis() {
21                return timeSource.currentTimeInMillis();
22        }
23        /**
24         * Sets {@linkplain TimeSource} provider to use.
25         * @param timeSource {@link TimeSource} provider to use
26         */
27        public static void setTimeSource(final TimeSource timeSource) {
28                SystemTime.timeSource = timeSource;
29        }
30        /**
31         * Resets {@link TimeSource} provider to default.
32         */
33        public static void reset() {
34                SystemTime.timeSource = DEFAULT_TIME_SOURCE;
35        }
36        /**
37         * This constructor throws InstantiationException at every invocation: this class is designed for static use only.
38         * @throws InstantiationException The class is designed for static use only
39         */
40        protected SystemTime() throws InstantiationException {
41                throw new InstantiationException();
42        }
43}

[all classes][org.amicofragile.time]
EMMA 2.0.5312 (C) Vladimir Roubtsov