diff --git a/tests/factory.cpp b/tests/factory.cpp
index b4fb3765d77cacebe2b1b9c909f073afb2917d75..716964d903dfc921d7cd9217496264521e5cdcdd 100644
--- a/tests/factory.cpp
+++ b/tests/factory.cpp
@@ -105,7 +105,7 @@ BOOST_AUTO_TEST_CASE (newEntity)
       (factory.newEntity ("myEntity", "foo"));
 
     boost::shared_ptr<dynamicgraph::Entity> entity2
-      (factory.newEntity ("myEntity", "foo"));
+      (factory.newEntity ("myEntity", "foo2"));
 
     boost::shared_ptr<dynamicgraph::Entity> entity3
       (factory.newEntity ("myEntity", ""));
@@ -119,7 +119,7 @@ BOOST_AUTO_TEST_CASE (newEntity)
   catch (const dynamicgraph::ExceptionFactory& exception)
     {
       BOOST_CHECK_EQUAL (exception.getCode (),
-			 dynamicgraph::ExceptionFactory::OBJECT_CONFLICT);
+			 dynamicgraph::ExceptionFactory::UNREFERED_OBJECT);
     }
 }