X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=support%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Ftest%2FAssertionUtils.java;h=bd55115b66a9778b6e5b0d6262f53bf6a733a9c0;hb=26805fc0810098c4bd8009a35c8719478e74153e;hp=9487f22a1d267f56402c011cbf1093f0873506ee;hpb=539c6d91b7a34e32c6669445d00e9275c337530a;p=utils diff --git a/support/general/src/test/java/org/wamblee/test/AssertionUtils.java b/support/general/src/test/java/org/wamblee/test/AssertionUtils.java index 9487f22a..bd55115b 100644 --- a/support/general/src/test/java/org/wamblee/test/AssertionUtils.java +++ b/support/general/src/test/java/org/wamblee/test/AssertionUtils.java @@ -1,12 +1,12 @@ /* - * Copyright 2006 the original author or authors. - * + * Copyright 2005-2010 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,15 +15,13 @@ */ package org.wamblee.test; -import junit.framework.TestCase; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.util.Arrays; -import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.Map.Entry; +import java.util.logging.Logger; + +import junit.framework.TestCase; /** * Useful assertions for use in test cases. @@ -31,7 +29,8 @@ import java.util.Set; * @author Erik Brakkee */ public final class AssertionUtils { - private static final Log LOG = LogFactory.getLog(AssertionUtils.class); + private static final Logger LOG = Logger.getLogger(AssertionUtils.class + .getName()); /** * Disabled constructor. @@ -112,14 +111,14 @@ public final class AssertionUtils { TestCase.assertEquals("Map sizes differ", aExpectedMap.size(), aActual .size()); - Set keys = aExpectedMap.keySet(); + Set> expectedEntries = aExpectedMap.entrySet(); - for (Iterator i = keys.iterator(); i.hasNext();) { - String key = (String) i.next(); + for (Entry entry : expectedEntries) { + Key key = entry.getKey(); TestCase.assertTrue("Map does not containg entry for key:" + key, aActual.containsKey(key)); AssertionUtils.assertEquals("Value of key " + key + " of map", - aExpectedMap.get(key), aActual.get(key)); + entry.getValue(), aActual.get(key)); } } @@ -141,9 +140,8 @@ public final class AssertionUtils { LOG.info("Expected exception occured " + t.getMessage()); return; // ok - } else { - throw new RuntimeException(t); } + throw new RuntimeException(t); } }