Timeouts { public void setTimeout(Timeout timeout) { Objects.requireNonNull(timeout, "The timeout can't be null."); getTimeout(timeout.getKey()).setValue(timeout.getTimeoutInMs()); getTimeout(timeout.getKey()).setTimeToRepetition(timeout.getTimeToRepetitionInMs()); } Timeouts(ArrayList<Timeout> timeouts, String nameOfProperties);  Timeouts(String nameOfProperties);  Timeouts(ArrayList<Timeout> timeouts);  Timeouts(); Timeout getTimeout(String key); HashMap<String, Timeout> getAllTimeouts(); void setTimeout(Timeout timeout); void readTimeoutProperties();  }
@Test public void testSetTimeout() throws Exception { Integer timeToRepetition = 500; Timeout timeout = new Timeout(engine, step, value, timeToRepetition); ArrayList<Timeout> timeoutList = new ArrayList<>(); timeoutList.add(timeout); value = 30_000; timeToRepetition = 5_000; timeout.setValue(value); timeout.setTimeToRepetition(timeToRepetition); Timeouts timeouts = new Timeouts(timeoutList); timeouts.setTimeout(timeout); Timeout testTimeout = timeouts.getTimeout(timeout.getKey()); assertEquals("The values in ms should be equal.", value, testTimeout.getTimeoutInMs(), 0); assertEquals("The timeToRepetitions should be equal.", timeToRepetition, testTimeout.getTimeToRepetitionInMs(), 0); }
@Test(expected = NoSuchElementException.class) public void testSetTimeoutNotExists() throws Exception { Timeout timeout = new Timeout(engine, step, value); ArrayList<Timeout> timeoutList = new ArrayList<>(); timeoutList.add(timeout); Timeouts timeouts = new Timeouts(timeoutList); Timeout timeoutTest = new Timeout("glassfish", "deploy", 20_000, 3_000); timeouts.setTimeout(timeoutTest); }