You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/06/01 19:07:58 UTC

svn commit: r780726 - in /incubator/pivot/trunk: core/test/pivot/collections/ core/test/pivot/core/ core/test/pivot/serialization/ core/test/pivot/util/ core/test/pivot/util/concurrent/ core/test/pivot/util/test/ core/test/resources/ web/test/pivot/web...

Author: gbrown
Date: Mon Jun  1 17:07:57 2009
New Revision: 780726

URL: http://svn.apache.org/viewvc?rev=780726&view=rev
Log: (empty)

Added:
    incubator/pivot/trunk/core/test/pivot/collections/
    incubator/pivot/trunk/core/test/pivot/serialization/
    incubator/pivot/trunk/core/test/pivot/util/
    incubator/pivot/trunk/core/test/pivot/util/concurrent/
    incubator/pivot/trunk/core/test/pivot/util/test/
    incubator/pivot/trunk/core/test/pivot/util/test/ListenerListTest.java
      - copied, changed from r779941, incubator/pivot/trunk/core/test/pivot/core/test/ListenerListTest.java
    incubator/pivot/trunk/core/test/pivot/util/test/MIMETypeTest.java
      - copied, changed from r779941, incubator/pivot/trunk/core/test/pivot/core/test/MIMETypeTest.java
    incubator/pivot/trunk/core/test/pivot/util/test/ResourcesTest.java
      - copied, changed from r779941, incubator/pivot/trunk/core/test/pivot/core/test/ResourcesTest.java
    incubator/pivot/trunk/core/test/pivot/util/test/VersionTest.java
      - copied, changed from r779941, incubator/pivot/trunk/core/test/pivot/core/test/VersionTest.java
    incubator/pivot/trunk/core/test/pivot/util/test/test1.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test1.json
    incubator/pivot/trunk/core/test/pivot/util/test/test2.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test2.json
    incubator/pivot/trunk/core/test/pivot/util/test/test2_en.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test2_en.json
    incubator/pivot/trunk/core/test/pivot/util/test/test3.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test3.json
    incubator/pivot/trunk/core/test/pivot/util/test/test3_en.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test3_en.json
    incubator/pivot/trunk/core/test/pivot/util/test/test3_en_GB.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test3_en_GB.json
    incubator/pivot/trunk/core/test/pivot/util/test/test4.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test4.json
    incubator/pivot/trunk/core/test/pivot/util/test/test6.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test6.json
    incubator/pivot/trunk/core/test/pivot/util/test/test6_en.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test6_en.json
    incubator/pivot/trunk/core/test/pivot/util/test/test6_en_GB.json
      - copied unchanged from r779941, incubator/pivot/trunk/core/test/resources/test6_en_GB.json
Removed:
    incubator/pivot/trunk/core/test/pivot/core/
    incubator/pivot/trunk/core/test/resources/
Modified:
    incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java

Copied: incubator/pivot/trunk/core/test/pivot/util/test/ListenerListTest.java (from r779941, incubator/pivot/trunk/core/test/pivot/core/test/ListenerListTest.java)
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/pivot/util/test/ListenerListTest.java?p2=incubator/pivot/trunk/core/test/pivot/util/test/ListenerListTest.java&p1=incubator/pivot/trunk/core/test/pivot/core/test/ListenerListTest.java&r1=779941&r2=780726&rev=780726&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/pivot/core/test/ListenerListTest.java (original)
+++ incubator/pivot/trunk/core/test/pivot/util/test/ListenerListTest.java Mon Jun  1 17:07:57 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package pivot.core.test;
+package pivot.util.test;
 
 import pivot.util.ListenerList;
 

Copied: incubator/pivot/trunk/core/test/pivot/util/test/MIMETypeTest.java (from r779941, incubator/pivot/trunk/core/test/pivot/core/test/MIMETypeTest.java)
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/pivot/util/test/MIMETypeTest.java?p2=incubator/pivot/trunk/core/test/pivot/util/test/MIMETypeTest.java&p1=incubator/pivot/trunk/core/test/pivot/core/test/MIMETypeTest.java&r1=779941&r2=780726&rev=780726&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/pivot/core/test/MIMETypeTest.java (original)
+++ incubator/pivot/trunk/core/test/pivot/util/test/MIMETypeTest.java Mon Jun  1 17:07:57 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package pivot.core.test;
+package pivot.util.test;
 
 import pivot.util.MIMEType;
 

Copied: incubator/pivot/trunk/core/test/pivot/util/test/ResourcesTest.java (from r779941, incubator/pivot/trunk/core/test/pivot/core/test/ResourcesTest.java)
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/pivot/util/test/ResourcesTest.java?p2=incubator/pivot/trunk/core/test/pivot/util/test/ResourcesTest.java&p1=incubator/pivot/trunk/core/test/pivot/core/test/ResourcesTest.java&r1=779941&r2=780726&rev=780726&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/pivot/core/test/ResourcesTest.java (original)
+++ incubator/pivot/trunk/core/test/pivot/util/test/ResourcesTest.java Mon Jun  1 17:07:57 2009
@@ -14,39 +14,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package pivot.core.test;
+package pivot.util.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Locale;
 import java.util.MissingResourceException;
 
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
 import pivot.collections.List;
 import pivot.collections.Map;
 import pivot.serialization.SerializationException;
 import pivot.util.Resources;
 
-public class ResourcesTest extends TestCase {
-
+public class ResourcesTest {
     private Locale old;
 
-    @Override
-    protected void setUp() throws Exception {
-
+    @Before
+    public void setUp() throws Exception {
         old = Locale.getDefault();
         Locale.setDefault(Locale.UK);
-
-        super.setUp();
     }
 
-    @Override
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         Locale.setDefault(old);
-        super.tearDown();
     };
 
+    @Test
     public void testReadDefaultLocale() throws Exception {
-
-        Resources res = new Resources("resources.test1");
+        Resources res = new Resources("pivot.util.test.test1");
         assertResources(res, "SGML", "Standard Generalized Markup Language");
     }
 
@@ -55,11 +57,11 @@
      *
      * @throws Exception
      */
+    @Test
     public void testRead_GB_Locale() throws Exception {
-        Resources res = new Resources("resources.test2");
+        Resources res = new Resources("pivot.util.test.test2");
         assertResources(res, "SGML",
                 "How Do, Youth, Standard Generalized Markup Language");
-
     }
 
     /**
@@ -68,13 +70,13 @@
      *
      * @throws Exception
      */
+    @Test
     public void testRead_GB_en_Locale() throws Exception {
         assertEquals("Default locale should be en_GB", "en_GB", Locale
                 .getDefault().toString());
-        Resources res = new Resources("resources.test3");
+        Resources res = new Resources("pivot.util.test.test3");
         assertResources(res, "XSGML",
                 "How Do, Youth, Standard Generalized Markup Language");
-
     }
 
     /**
@@ -82,57 +84,39 @@
      *
      * @throws Exception
      */
+    @Test
     public void testRead_GB_en_LocaleExtraOverride() throws Exception {
         assertEquals("Default locale should be en_GB", "en_GB", Locale
                 .getDefault().toString());
-        Resources res = new Resources("resources.test6");
+        Resources res = new Resources("pivot.util.test.test6");
         assertResources(res, "XSGML",
                 "eXtra Standard Generalized Markup Language");
-
     }
 
+    @Test(expected=SerializationException.class)
     public void testSerialisationException() throws Exception {
-
-        try {
-            new Resources("resources.test4");
-            fail("Expected SerialisationException");
-        } catch (SerializationException e) {
-        }
-
+        new Resources("pivot.util.test.test4");
     }
 
+    @Test(expected=MissingResourceException.class)
     public void testMissingResource() throws Exception {
-
         // resource doesn't exist...
-        try {
-            new Resources("resources.test5");
-            fail("Expected IllegalArgumentException");
-        } catch (MissingResourceException e) {
-        }
-
+        new Resources("pivot.util.test.test5");
     }
 
+    @Test(expected=IllegalArgumentException.class)
     public void testNullLocale() throws Exception {
         // resource exists, but locale is null
-        try {
-            new Resources("resources.test1", (Locale) null);
-            fail("Expected IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-
-        }
+        new Resources("pivot.util.test.test1", (Locale) null);
     }
 
+    @Test(expected=NullPointerException.class)
     public void testNullBaseName() throws Exception {
-        try {
-            new Resources(null);
-            fail("Expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
+        new Resources(null);
     }
 
     @SuppressWarnings("unchecked")
-    private static void assertResources(Resources res, String acronym,
-            String term) {
+    private static void assertResources(Resources res, String acronym, String term) {
         assertTrue(res.containsKey("glossary"));
 
         Map<String, Object> glossary = (Map<String, Object>) res
@@ -169,5 +153,4 @@
         assertNotNull(list);
         assertEquals(2, list.getLength());
     }
-
 }

Copied: incubator/pivot/trunk/core/test/pivot/util/test/VersionTest.java (from r779941, incubator/pivot/trunk/core/test/pivot/core/test/VersionTest.java)
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/test/pivot/util/test/VersionTest.java?p2=incubator/pivot/trunk/core/test/pivot/util/test/VersionTest.java&p1=incubator/pivot/trunk/core/test/pivot/core/test/VersionTest.java&r1=779941&r2=780726&rev=780726&view=diff
==============================================================================
--- incubator/pivot/trunk/core/test/pivot/core/test/VersionTest.java (original)
+++ incubator/pivot/trunk/core/test/pivot/util/test/VersionTest.java Mon Jun  1 17:07:57 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package pivot.core.test;
+package pivot.util.test;
 
 import pivot.util.Version;
 

Modified: incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java?rev=780726&r1=780725&r2=780726&view=diff
==============================================================================
--- incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java (original)
+++ incubator/pivot/trunk/web/test/pivot/web/test/QueryDictionaryTest.java Mon Jun  1 17:07:57 2009
@@ -16,14 +16,21 @@
  */
 package pivot.web.test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.HashSet;
 import java.util.Set;
 
-import junit.framework.TestCase;
-import pivot.web.QueryDictionary;
+import org.junit.Test;
 
-public class QueryDictionaryTest extends TestCase {
+import pivot.web.QueryDictionary;
 
+public class QueryDictionaryTest {
+    @Test(expected=IndexOutOfBoundsException.class)
     public void testQueryDictionary() {
         QueryDictionary dict = new QueryDictionary();
 
@@ -36,11 +43,7 @@
 
         assertEquals(1, dict.getLength("key"));
 
-        try {
-            dict.get("key", 1);
-            fail("Expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
-        }
+        dict.get("key", 1);
 
         assertEquals("value", dict.put("key", "value2"));
         assertEquals("value2", dict.get("key"));
@@ -57,12 +60,7 @@
 
         assertEquals(3, dict.getLength("key"));
 
-        try {
-            dict.insert("key", "bad value", 10);
-            fail("Expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
-
-        }
+        dict.insert("key", "bad value", 10);
 
         assertEquals("yet another value", dict.remove("key"));
         assertNull(dict.remove("key"));
@@ -70,12 +68,7 @@
         dict.add("key2", "2nd value");
         assertEquals("new value", dict.remove("key2", 0));
 
-        try {
-            dict.remove("key2", 10);
-            fail("Expected IndexOutOfBoundsException");
-        } catch (IndexOutOfBoundsException ex) {
-
-        }
+        dict.remove("key2", 10);
 
         dict.add("key3", "something");