You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/04/03 01:05:14 UTC

svn commit: r1088171 - /commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Author: simonetripodi
Date: Sat Apr  2 23:05:14 2011
New Revision: 1088171

URL: http://svn.apache.org/viewvc?rev=1088171&view=rev
Log:
reorganized test methods

Modified:
    commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java

Modified: commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java
URL: http://svn.apache.org/viewvc/commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java?rev=1088171&r1=1088170&r2=1088171&view=diff
==============================================================================
--- commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java (original)
+++ commons/proper/discovery/trunk/src/test/org/apache/commons/discovery/test/TestAll.java Sat Apr  2 23:05:14 2011
@@ -221,14 +221,6 @@ public class TestAll {
     }
 
     @Test
-    public void findServiceClassAndInstantiate() throws Exception {
-        DiscoverClass discoverClass = new DiscoverClass();
-        TestInterface2 serviceImpl = discoverClass.newInstance(TestInterface2.class);
-
-        assertNotNull(serviceImpl);
-    }
-
-    @Test
     public void lowLevelFind() {
         org.apache.commons.discovery.log.SimpleLog.setLevel(logLevel);
 
@@ -311,6 +303,17 @@ public class TestAll {
 
     }
 
+    @Test
+    public void instantiateViaDiscoverClass() throws Exception {
+        ClassLoaders loaders = ClassLoaders.getAppLoaders(TestInterface2.class, getClass(), false);
+
+        DiscoverClass discoverClass = new DiscoverClass(loaders);
+        TestInterface2 serviceImpl = discoverClass.newInstance(TestInterface2.class);
+
+        assertNotNull(serviceImpl);
+        assertEquals(TestImpl2_1.class, serviceImpl.getClass());
+    }
+
     /**
      * This allows the tests to run as a standalone application.
      */