felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1548799 - /felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java
Date Sat, 07 Dec 2013 07:10:07 GMT
Author: clement
Date: Sat Dec  7 07:10:06 2013
New Revision: 1548799

URL: http://svn.apache.org/r1548799
Log:
Improve failure management in test

Modified:
    felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java

Modified: felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java?rev=1548799&r1=1548798&r2=1548799&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java
(original)
+++ felix/trunk/ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java
Sat Dec  7 07:10:06 2013
@@ -21,6 +21,7 @@ package org.apache.felix.ipojo.runtime.c
 
 import org.apache.felix.ipojo.ComponentInstance;
 import org.apache.felix.ipojo.ErrorHandler;
+import org.apache.felix.ipojo.Factory;
 import org.apache.felix.ipojo.runtime.core.components.MyComponent;
 import org.apache.felix.ipojo.runtime.core.components.MyErroneousComponent;
 import org.apache.felix.ipojo.runtime.core.services.MyService;
@@ -41,6 +42,8 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.fail;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.streamBundle;
 import static org.ops4j.pax.exam.MavenUtils.asInProject;
@@ -95,13 +98,15 @@ public class TestErrorHandler extends Co
         MyErrorHandler handler = new MyErrorHandler();
         bc.registerService(ErrorHandler.class.getName(), handler, null);
 
+        Factory factory = ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.MyErroneousComponent");
+        assertNotNull(factory);
         try {
-            ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.MyErroneousComponent");
+            factory.createComponentInstance(null);
+            fail("Error expected");
         } catch (Exception e) {
-            System.out.println(e);
+            // Error expected.
         }
 
-
         System.out.println(handler.m_errors);
 
         Assert.assertFalse(handler.m_errors.isEmpty());



Mime
View raw message