mirror of https://github.com/apache/cloudstack.git
Fixed changes to match code conventions
This commit is contained in:
parent
8d6370b21f
commit
c2afa584ae
|
|
@ -24,7 +24,6 @@ public class Profiler {
|
|||
private static final long MILLIS_FACTOR = 1000l;
|
||||
private static final double EXPONENT = 2d;
|
||||
|
||||
|
||||
private Long startTickNanoSeconds;
|
||||
private Long stopTickNanoSeconds;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,19 +35,19 @@ public class TestProfiler extends Log4jEnabledTestCase {
|
|||
|
||||
private static final long SLEEP_TIME_NANO = 1000000000L;
|
||||
private static Profiler pf;
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp(){
|
||||
pf = new Profiler();
|
||||
PowerMockito.mockStatic(System.class);
|
||||
PowerMockito.when(System.nanoTime()).thenReturn(0L, SLEEP_TIME_NANO);
|
||||
public void setUp() {
|
||||
pf = new Profiler();
|
||||
PowerMockito.mockStatic(System.class);
|
||||
PowerMockito.when(System.nanoTime()).thenReturn(0L, SLEEP_TIME_NANO);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testProfilerInMillis() {
|
||||
//Given
|
||||
final long sleepTimeMillis = SLEEP_TIME_NANO / 1000000L;
|
||||
|
||||
|
||||
//When
|
||||
pf.start();
|
||||
pf.stop();
|
||||
|
|
@ -58,11 +58,11 @@ public class TestProfiler extends Log4jEnabledTestCase {
|
|||
|
||||
@Test
|
||||
public void testProfilerInNano() {
|
||||
//Given
|
||||
final long sleepTimeNano = SLEEP_TIME_NANO;
|
||||
|
||||
//When
|
||||
pf.start();
|
||||
//Given
|
||||
final long sleepTimeNano = SLEEP_TIME_NANO;
|
||||
|
||||
//When
|
||||
pf.start();
|
||||
pf.stop();
|
||||
|
||||
//Then
|
||||
|
|
@ -71,26 +71,26 @@ public class TestProfiler extends Log4jEnabledTestCase {
|
|||
|
||||
@Test
|
||||
public void testProfilerNoStart() {
|
||||
//Given
|
||||
final long expectedAnswer = -1;
|
||||
//Given
|
||||
final long expectedAnswer = -1;
|
||||
|
||||
//When
|
||||
pf.stop();
|
||||
//When
|
||||
pf.stop();
|
||||
|
||||
//Then
|
||||
//Then
|
||||
Assert.assertTrue(pf.getDurationInMillis() == expectedAnswer);
|
||||
Assert.assertFalse(pf.isStarted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProfilerNoStop() {
|
||||
//Given
|
||||
final long expectedAnswer = -1;
|
||||
//Given
|
||||
final long expectedAnswer = -1;
|
||||
|
||||
//When
|
||||
pf.start();
|
||||
//When
|
||||
pf.start();
|
||||
|
||||
//Then
|
||||
//Then
|
||||
Assert.assertTrue(pf.getDurationInMillis() == expectedAnswer);
|
||||
Assert.assertFalse(pf.isStopped());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue