CalibrationTimeout extends Timeout { public Status getStatus() { return status; } CalibrationTimeout(String engineOrProcess, String stepOrProcess, String description, int value, int timeToRepetition);  CalibrationTimeout(String engineOrProcess, String stepOrProcess, String description, int value, int timeToRepetition, int measuredTime);  CalibrationTimeout(String engineOrProcess, String stepOrProcess, int value, int timeToRepetition);  CalibrationTimeout(String engineOrProcess, String stepOrProcess, String description, int value);  CalibrationTimeout(String engineOrProcess, String stepOrProcess, int value);  CalibrationTimeout(Timeout timeout);  CalibrationTimeout(Timeout timeout, int measuredTime); Status getStatus(); void setStatus(Status status); String getCalibrationTimeoutKey(); long getTimestamp(); int getMeasuredTime(); void setMeasuredTime(int measuredTime);  }
@Test public void testConstructorWithTimeout(){ String description = "maven"; Integer timeToRepetition = 5_000; String key = engine + "." + step + "." + description; Timeout timeout = new Timeout(engine, step, description, value, timeToRepetition); CalibrationTimeout calibrationTimeout = new CalibrationTimeout(timeout); assertEquals("The engines should be equal.", engine, calibrationTimeout.getEngineOrProcessGroup()); assertEquals("The steps should be equal.", step, calibrationTimeout.getStepOrProcess()); assertEquals("The descriptions should be equal.", description, calibrationTimeout.getDescription()); assertEquals("The keys should be equal.", key, calibrationTimeout.getKey()); assertEquals("The values in ms should be equal.", value.intValue() , calibrationTimeout.getTimeoutInMs()); assertEquals("The values in sec should be equal.", new BigDecimal(value.doubleValue() / 1000), calibrationTimeout.getTimeoutInSeconds()); assertEquals("The values in min should be equal.", new BigDecimal(value.doubleValue() / 1000 / 60), calibrationTimeout.getTimeoutInMinutes()); assertEquals("The timeToRepetition in ms should be equal.", timeToRepetition.intValue(), calibrationTimeout.getTimeToRepetitionInMs()); assertEquals("The timeToRepetition in sec should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000), calibrationTimeout.getTimeToRepetitionInSeconds()); assertEquals("The timeToRepetition in min should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000 / 60), calibrationTimeout.getTimeToRepetitionInMinutes()); assertEquals("The statuses should be equal.", CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testConstructor(){ String description = "maven"; Integer timeToRepetition = 5_000; String key = engine + "." + step + "." + description; CalibrationTimeout calibrationTimeout = new CalibrationTimeout(engine, step, description, value, timeToRepetition); assertEquals("The engines should be equal.", engine, calibrationTimeout.getEngineOrProcessGroup()); assertEquals("The steps should be equal.", step, calibrationTimeout.getStepOrProcess()); assertEquals("The descriptions should be equal.", description, calibrationTimeout.getDescription()); assertEquals("The keys should be equal.", key, calibrationTimeout.getKey()); assertEquals("The values in ms should be equal.", value.intValue() , calibrationTimeout.getTimeoutInMs()); assertEquals("The values in sec should be equal.", new BigDecimal(value.doubleValue() / 1000), calibrationTimeout.getTimeoutInSeconds()); assertEquals("The values in min should be equal.", new BigDecimal(value.doubleValue() / 1000 / 60), calibrationTimeout.getTimeoutInMinutes()); assertEquals("The timeToRepetition in ms should be equal.", timeToRepetition.intValue(), calibrationTimeout.getTimeToRepetitionInMs()); assertEquals("The timeToRepetition in sec should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000), calibrationTimeout.getTimeToRepetitionInSeconds()); assertEquals("The timeToRepetition in min should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000 / 60), calibrationTimeout.getTimeToRepetitionInMinutes()); assertEquals("The statuses should be equal.", CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testConstructorWithoutDescription(){ Integer timeToRepetition = 5_000; CalibrationTimeout calibrationTimeout = new CalibrationTimeout(engine, step, value, timeToRepetition); String key = engine + "." + step; assertEquals("The engines should be equal.", engine, calibrationTimeout.getEngineOrProcessGroup()); assertEquals("The steps should be equal.", step, calibrationTimeout.getStepOrProcess()); assertEquals("The descriptions should be equal.", "", calibrationTimeout.getDescription()); assertEquals("The keys should be equal.", key, calibrationTimeout.getKey()); assertEquals("The values in ms should be equal.", value.intValue() , calibrationTimeout.getTimeoutInMs()); assertEquals("The values in sec should be equal.", new BigDecimal(value.doubleValue() / 1000), calibrationTimeout.getTimeoutInSeconds()); assertEquals("The values in min should be equal.", new BigDecimal(value.doubleValue() / 1000 / 60), calibrationTimeout.getTimeoutInMinutes()); assertEquals("The timeToRepetition in ms should be equal.", timeToRepetition.intValue(), calibrationTimeout.getTimeToRepetitionInMs()); assertEquals("The timeToRepetition in sec should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000), calibrationTimeout.getTimeToRepetitionInSeconds()); assertEquals("The timeToRepetitions in min should be equal.", new BigDecimal(timeToRepetition.doubleValue() / 1000 / 60), calibrationTimeout.getTimeToRepetitionInMinutes()); assertEquals("The statuses should be equal.", CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testConstructorWithoutTimeToRepetition(){ String description = "maven"; String key = engine + "." + step + "." + description; CalibrationTimeout calibrationTimeout = new CalibrationTimeout(engine, step, description, value); assertEquals("The engines should be equal.", engine, calibrationTimeout.getEngineOrProcessGroup()); assertEquals("The steps should be equal.", step, calibrationTimeout.getStepOrProcess()); assertEquals("The descriptions should be equal.", description, calibrationTimeout.getDescription()); assertEquals("The keys should be equal.", key, calibrationTimeout.getKey()); assertEquals("The values in ms should be equal.", value.intValue() , calibrationTimeout.getTimeoutInMs()); assertEquals("The values in sec should be equal.", new BigDecimal(value.doubleValue() / 1000), calibrationTimeout.getTimeoutInSeconds()); assertEquals("The values in min should be equal.", new BigDecimal(value.doubleValue() / 1000 / 60), calibrationTimeout.getTimeoutInMinutes()); assertEquals("The timeToRepetitions in ms should be equal.", 0, calibrationTimeout.getTimeToRepetitionInMs()); assertEquals("The timeToRepetitions in sec should be equal.", new BigDecimal(0), calibrationTimeout.getTimeToRepetitionInSeconds()); assertEquals("The timeToRepetitions in min should be equal.", new BigDecimal(0), calibrationTimeout.getTimeToRepetitionInMinutes()); assertEquals("The statuses should be equal.", CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testConstructorWithoutDescriptionTimeToRepetition(){ CalibrationTimeout calibrationTimeout = new CalibrationTimeout(engine, step, value); String key = engine + "." + step; assertEquals("The engines should be equal.", engine, calibrationTimeout.getEngineOrProcessGroup()); assertEquals("The steps should be equal.", step, calibrationTimeout.getStepOrProcess()); assertEquals("The descriptions should be empty.", "", calibrationTimeout.getDescription()); assertEquals("The keys should be equal.", key, calibrationTimeout.getKey()); assertEquals("The values in ms should be equal.", value.intValue() , calibrationTimeout.getTimeoutInMs()); assertEquals("The values in sec should be equal.", new BigDecimal(value.doubleValue() / 1000), calibrationTimeout.getTimeoutInSeconds()); assertEquals("The values in min should be equal.", new BigDecimal(value.doubleValue() / 1000 / 60), calibrationTimeout.getTimeoutInMinutes()); assertEquals("The timeToRepetitions in ms should be equal.", 0, calibrationTimeout.getTimeToRepetitionInMs()); assertEquals("The timeToRepetitions in sec should be equal.", new BigDecimal(0), calibrationTimeout.getTimeToRepetitionInSeconds()); assertEquals("The timeToRepetitions in min should be equal.", new BigDecimal(0), calibrationTimeout.getTimeToRepetitionInMinutes()); assertEquals("The statuses should be equal.", CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testGetStatusAfterCreation() throws Exception { CalibrationTimeout calibrationTimeout = new CalibrationTimeout(new Timeout(engine, step, value)); assertEquals("After creation the status should be 'kept'.",CalibrationTimeout.Status.KEPT, calibrationTimeout.getStatus()); }
@Test public void testGetStatus() throws Exception { CalibrationTimeout calibrationTimeout = new CalibrationTimeout(new Timeout(engine, step, value)); CalibrationTimeout.Status status = CalibrationTimeout.Status.KEPT; calibrationTimeout.setStatus(status); assertEquals("The statuses should be equal.", status, calibrationTimeout.getStatus()); }