Timeouts { public HashMap<String, Timeout> getAllTimeouts() { HashMap<String, Timeout> map = new HashMap<>(); for (Timeout timeout : timeouts) map.put(timeout.getKey(), timeout); return map; } 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 testConstructor() throws Exception { Timeouts timeouts = new Timeouts(); HashMap<String, Timeout> timeoutHashMap = timeouts.getAllTimeouts(); assertEquals("The number should conform with the number of timeouts in method 'addtimeouts'", 54, timeoutHashMap.size()); assertEquals("The keys should be equal.", "Tomcat.startup", timeoutHashMap.get("Tomcat.startup").getKey()); }
@Test public void testConstructorWithOwnTimeouts() throws Exception { StringBuilder key = new StringBuilder().append(engine).append(".").append(step); Timeout timeout = new Timeout(engine, step, value); ArrayList<Timeout> timeoutList = new ArrayList<>(); timeoutList.add(timeout); Timeouts timeouts = new Timeouts(timeoutList); HashMap<String, Timeout> timeoutHashMap = timeouts.getAllTimeouts(); assertEquals("The sizes should be equal.", timeoutList.size(), timeoutHashMap.size()); assertEquals("The keys should be equal.", key.toString(), timeoutHashMap.get(key.toString()).getKey()); }
@Test public void testGetHashMap() throws Exception { Timeout timeout = new Timeout(engine, step, value); ArrayList<Timeout> timeoutList = new ArrayList<>(); timeoutList.add(timeout); Timeouts timeouts = new Timeouts(timeoutList); HashMap<String, Timeout> timeoutHashMap = timeouts.getAllTimeouts(); assertEquals("The sizes should be equal.", timeoutList.size(), timeoutHashMap.size()); assertEquals("The timeouts should be equal.", timeout, timeoutHashMap.get(engine + "." + step)); }
@Test public void testGetAllTimeouts() throws Exception { Timeout timeout = new Timeout(engine, step, value); ArrayList<Timeout> timeoutList = new ArrayList<>(); timeoutList.add(timeout); Timeouts timeouts = new Timeouts(timeoutList); HashMap<String, Timeout> timeoutHashMap = timeouts.getAllTimeouts(); assertEquals("The sizes should be equal.", timeoutList.size(), timeoutHashMap.size()); }