Index: code/trunk/test/CMakeLists.txt
===================================================================
--- code/trunk/test/CMakeLists.txt	(revision 9550)
+++ code/trunk/test/CMakeLists.txt	(revision 9667)
@@ -53,2 +53,3 @@
 
 ADD_SUBDIRECTORY(util)
+ADD_SUBDIRECTORY(core)
Index: code/trunk/test/core/CMakeLists.txt
===================================================================
--- code/trunk/test/core/CMakeLists.txt	(revision 9667)
+++ code/trunk/test/core/CMakeLists.txt	(revision 9667)
@@ -0,0 +1,32 @@
+ORXONOX_ADD_EXECUTABLE(
+    core_test
+    EXCLUDE_FROM_ALL
+    NO_INSTALL
+  LINK_LIBRARIES
+    core
+    gmock_orxonox
+  SOURCE_FILES
+    ${GMOCK_MAIN}
+    class/IdentifiableTest.cc
+    class/IdentifierTest.cc
+    class/IdentifierClassHierarchyTest.cc
+    class/IdentifierSimpleClassHierarchyTest.cc
+    class/IdentifierExternalClassHierarchyTest.cc
+    class/OrxonoxClassTest.cc
+    class/OrxonoxInterfaceTest.cc
+    class/SubclassIdentifierTest.cc
+    class/SuperTest.cc
+    command/CommandTest.cc
+    object/ClassFactoryTest.cc
+    object/ContextTest.cc
+    object/DestroyableTest.cc
+    object/IteratorTest.cc
+    object/ListableTest.cc
+    object/ObjectListBaseTest.cc
+    object/ObjectListIteratorTest.cc
+    object/SmartPtrTest.cc
+    object/WeakPtrTest.cc
+)
+ADD_DEPENDENCIES(test core_test)
+
+ADD_TEST(core_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/core_test --gtest_output=xml)
Index: code/trunk/test/core/class/IdentifiableTest.cc
===================================================================
--- code/trunk/test/core/class/IdentifiableTest.cc	(revision 9667)
+++ code/trunk/test/core/class/IdentifiableTest.cc	(revision 9667)
@@ -0,0 +1,34 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class IdentifiableTest : public Identifiable
+        {
+            public:
+                IdentifiableTest() { RegisterObject(IdentifiableTest); }
+        };
+    }
+
+    TEST(IdentifiableTest, CanCreate)
+    {
+        IdentifiableTest* test = new IdentifiableTest();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+
+    TEST(IdentifiableTest, HasIdentifierAssigned)
+    {
+        IdentifiableTest test;
+        EXPECT_TRUE(test.getIdentifier());
+    }
+
+    TEST(IdentifiableTest, CanBeIdentified)
+    {
+        IdentifiableTest test;
+        EXPECT_TRUE(test.isA(Class(IdentifiableTest)));
+    }
+}
Index: code/trunk/test/core/class/IdentifierClassHierarchyTest.cc
===================================================================
--- code/trunk/test/core/class/IdentifierClassHierarchyTest.cc	(revision 9667)
+++ code/trunk/test/core/class/IdentifierClassHierarchyTest.cc	(revision 9667)
@@ -0,0 +1,459 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
+
+namespace orxonox
+{
+    //                 +------ Class0
+    // BaseClass <-----+---------------------+--- Class1
+    //                 +---------------------+-+- Class2a
+    //                 +---------------------+-+- Class2b
+    //                 +-+-+-- Class3        | |
+    //                   | |                 | |
+    // BaseInterface1 <--+---- Interface1 <--´ |
+    //                     |                   |
+    // BaseInterface2 <----+-- Interface2 <----´
+
+    namespace
+    {
+        class BaseInterface1 : public OrxonoxInterface
+        {
+            public:
+                BaseInterface1()
+                {
+                    RegisterObject(BaseInterface1);
+                }
+
+                virtual void test1() = 0;
+        };
+
+        class BaseInterface2 : public OrxonoxInterface
+        {
+            public:
+                BaseInterface2()
+                {
+                    RegisterObject(BaseInterface2);
+                }
+
+                virtual void test2() = 0;
+        };
+
+        class Interface1 : public BaseInterface1
+        {
+            public:
+                Interface1()
+                {
+                    RegisterObject(Interface1);
+                }
+        };
+
+        class Interface2 : public BaseInterface2
+        {
+            public:
+                Interface2()
+                {
+                    RegisterObject(Interface2);
+                }
+        };
+
+        class BaseClass : public OrxonoxClass
+        {
+            public:
+                BaseClass()
+                {
+                    RegisterObject(BaseClass);
+                }
+        };
+
+        class Class0 : public BaseClass
+        {
+            public:
+                Class0()
+                {
+                    RegisterObject(Class0);
+                }
+        };
+
+        class Class1 : public BaseClass, public Interface1
+        {
+            public:
+                Class1()
+                {
+                    RegisterObject(Class1);
+                }
+
+                virtual void test1() {}
+        };
+
+        class Class2a : public BaseClass, public Interface1, Interface2
+        {
+            public:
+                Class2a()
+                {
+                    RegisterObject(Class2a);
+                }
+
+                virtual void test1() {}
+                virtual void test2() {}
+        };
+
+        class Class2b : public BaseClass, public Interface2, Interface1
+        {
+            public:
+                Class2b()
+                {
+                    RegisterObject(Class2b);
+                }
+
+                virtual void test1() {}
+                virtual void test2() {}
+        };
+
+        class Class3 : public BaseClass, public BaseInterface1, BaseInterface2
+        {
+            public:
+                Class3()
+                {
+                    RegisterObject(Class3);
+                }
+
+                virtual void test1() {}
+                virtual void test2() {}
+        };
+
+        // Fixture
+        class IdentifierClassHierarchyTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    registerClass("Context", new ClassFactoryWithContext<Context>());
+                    registerClass("Listable", new ClassFactoryWithContext<Listable>());
+                    registerClass("Configurable", new ClassFactoryNoArgs<Configurable>());
+                    registerClass("OrxonoxInterface", new ClassFactoryNoArgs<OrxonoxInterface>());
+                    registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());
+                    registerClass("BaseInterface1", static_cast<ClassFactory<BaseInterface1>*>(NULL), false).inheritsFrom(Class(OrxonoxInterface));
+                    registerClass("BaseInterface2", static_cast<ClassFactory<BaseInterface2>*>(NULL), false).inheritsFrom(Class(OrxonoxInterface));
+                    registerClass("Interface1", static_cast<ClassFactory<Interface1>*>(NULL), false).inheritsFrom(Class(BaseInterface1));
+                    registerClass("Interface2", static_cast<ClassFactory<Interface2>*>(NULL), false).inheritsFrom(Class(BaseInterface2));
+                    registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());
+                    registerClass("Class0", new ClassFactoryNoArgs<Class0>());
+                    registerClass("Class1", new ClassFactoryNoArgs<Class1>());
+                    registerClass("Class2a", new ClassFactoryNoArgs<Class2a>());
+                    registerClass("Class2b", new ClassFactoryNoArgs<Class2b>());
+                    registerClass("Class3", new ClassFactoryNoArgs<Class3>());
+
+                    IdentifierManager::getInstance().createClassHierarchy();
+                }
+
+                virtual void TearDown()
+                {
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+                }
+        };
+
+        bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier)
+        {
+            return identifiers.find(identifier) != identifiers.end();
+        }
+    }
+
+    TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization)
+    {
+        {
+            Identifier* identifier = Class(BaseInterface1);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(BaseInterface2);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Interface1);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Interface2);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(BaseClass);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Class0);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Class1);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Class2a);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Class2b);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(Class3);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1)
+    {
+        Identifier* identifier = Class(BaseInterface1);
+
+        EXPECT_EQ(2u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3)));
+
+        EXPECT_EQ(5u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface)));
+
+        EXPECT_EQ(4u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestBaseInterface2)
+    {
+        Identifier* identifier = Class(BaseInterface2);
+
+        EXPECT_EQ(2u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface2)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3)));
+
+        EXPECT_EQ(4u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface2)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface)));
+
+        EXPECT_EQ(4u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestInterface1)
+    {
+        Identifier* identifier = Class(Interface1);
+
+        EXPECT_EQ(3u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b)));
+
+        EXPECT_EQ(3u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1)));
+
+        EXPECT_EQ(5u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestInterface2)
+    {
+        Identifier* identifier = Class(Interface2);
+
+        EXPECT_EQ(2u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b)));
+
+        EXPECT_EQ(2u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2)));
+
+        EXPECT_EQ(5u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestBaseClass)
+    {
+        Identifier* identifier = Class(BaseClass);
+
+        EXPECT_EQ(5u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class0)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b)));
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3)));
+
+        EXPECT_EQ(5u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class0)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b)));
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxClass)));
+
+        EXPECT_EQ(4u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestClass0)
+    {
+        Identifier* identifier = Class(Class0);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+
+        EXPECT_EQ(5u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestClass1)
+    {
+        Identifier* identifier = Class(Class1);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(2u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1)));
+
+        EXPECT_EQ(8u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestClass2a)
+    {
+        Identifier* identifier = Class(Class2a);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(3u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2)));
+
+        EXPECT_EQ(10u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestClass2b)
+    {
+        Identifier* identifier = Class(Class2b);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(3u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2)));
+
+        EXPECT_EQ(10u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2)));
+    }
+
+    TEST_F(IdentifierClassHierarchyTest, TestClass3)
+    {
+        Identifier* identifier = Class(Class3);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(3u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2)));
+
+        EXPECT_EQ(8u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2)));
+    }
+}
Index: code/trunk/test/core/class/IdentifierExternalClassHierarchyTest.cc
===================================================================
--- code/trunk/test/core/class/IdentifierExternalClassHierarchyTest.cc	(revision 9667)
+++ code/trunk/test/core/class/IdentifierExternalClassHierarchyTest.cc	(revision 9667)
@@ -0,0 +1,137 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class Interface : virtual public Identifiable
+        {
+            public:
+                Interface()
+                {
+                    RegisterObject(Interface);
+                }
+
+                virtual void test() = 0;
+        };
+
+        class BaseClass : virtual public Identifiable
+        {
+            public:
+                BaseClass()
+                {
+                    RegisterObject(BaseClass);
+                }
+        };
+
+        class RealClass : public BaseClass, public Interface
+        {
+            public:
+                RealClass()
+                {
+                    RegisterObject(RealClass);
+                }
+
+                virtual void test() {}
+        };
+
+        // Fixture
+        class IdentifierExternalClassHierarchyTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    registerClass("Context", new ClassFactoryWithContext<Context>());
+                    registerClass("Listable", new ClassFactoryWithContext<Listable>());
+                    registerClass("Interface", static_cast<ClassFactory<Interface>*>(NULL), false).inheritsFrom(Class(Identifiable));
+                    registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());
+                    registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());
+
+                    IdentifierManager::getInstance().createClassHierarchy();
+                }
+
+                virtual void TearDown()
+                {
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+                }
+        };
+
+        bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier)
+        {
+            return identifiers.find(identifier) != identifiers.end();
+        }
+    }
+
+    TEST(IdentifierExternalClassHierarchyTest_NoFixture, NoInitialization)
+    {
+        {
+            Identifier* identifier = Class(Interface);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(BaseClass);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(RealClass);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+    }
+
+    TEST_F(IdentifierExternalClassHierarchyTest, TestInterface)
+    {
+        Identifier* identifier = Class(Interface);
+
+        EXPECT_EQ(1u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Identifiable)));
+
+        EXPECT_EQ(1u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+    }
+
+    TEST_F(IdentifierExternalClassHierarchyTest, BaseClass)
+    {
+        Identifier* identifier = Class(BaseClass);
+
+        EXPECT_EQ(1u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Identifiable)));
+
+        EXPECT_EQ(1u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+    }
+
+    TEST_F(IdentifierExternalClassHierarchyTest, RealClass)
+    {
+        Identifier* identifier = Class(RealClass);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(2u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+
+        EXPECT_EQ(3u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+    }
+}
Index: code/trunk/test/core/class/IdentifierSimpleClassHierarchyTest.cc
===================================================================
--- code/trunk/test/core/class/IdentifierSimpleClassHierarchyTest.cc	(revision 9667)
+++ code/trunk/test/core/class/IdentifierSimpleClassHierarchyTest.cc	(revision 9667)
@@ -0,0 +1,152 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class Interface : public OrxonoxInterface
+        {
+            public:
+                Interface()
+                {
+                    RegisterObject(Interface);
+                }
+
+                virtual void test() = 0;
+        };
+
+        class BaseClass : public OrxonoxClass
+        {
+            public:
+                BaseClass()
+                {
+                    RegisterObject(BaseClass);
+                }
+        };
+
+        class RealClass : public BaseClass, public Interface
+        {
+            public:
+                RealClass()
+                {
+                    RegisterObject(RealClass);
+                }
+
+                virtual void test() {}
+        };
+
+        // Fixture
+        class IdentifierSimpleClassHierarchyTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    registerClass("Context", new ClassFactoryWithContext<Context>());
+                    registerClass("Listable", new ClassFactoryWithContext<Listable>());
+                    registerClass("Configurable", new ClassFactoryNoArgs<Configurable>());
+                    registerClass("OrxonoxInterface", new ClassFactoryNoArgs<OrxonoxInterface>());
+                    registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());
+                    registerClass("Interface", static_cast<ClassFactory<Interface>*>(NULL), false).inheritsFrom(Class(OrxonoxInterface));
+                    registerClass("BaseClass", new ClassFactoryNoArgs<BaseClass>());
+                    registerClass("RealClass", new ClassFactoryNoArgs<RealClass>());
+
+                    IdentifierManager::getInstance().createClassHierarchy();
+                }
+
+                virtual void TearDown()
+                {
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+                }
+        };
+
+        bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier)
+        {
+            return identifiers.find(identifier) != identifiers.end();
+        }
+    }
+
+    TEST(IdentifierSimpleClassHierarchyTest_NoFixture, NoInitialization)
+    {
+        {
+            Identifier* identifier = Class(Interface);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(BaseClass);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+        {
+            Identifier* identifier = Class(RealClass);
+            EXPECT_EQ(0u, identifier->getChildren().size());
+            EXPECT_EQ(0u, identifier->getParents().size());
+        }
+    }
+
+    TEST_F(IdentifierSimpleClassHierarchyTest, TestInterface)
+    {
+        Identifier* identifier = Class(Interface);
+
+        EXPECT_EQ(1u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface)));
+
+        EXPECT_EQ(4u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+    }
+
+    TEST_F(IdentifierSimpleClassHierarchyTest, BaseClass)
+    {
+        Identifier* identifier = Class(BaseClass);
+
+        EXPECT_EQ(1u, identifier->getDirectChildren().size());
+        EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getChildren().size());
+        EXPECT_TRUE(contains(identifier->getChildren(), Class(RealClass)));
+
+        EXPECT_EQ(1u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxClass)));
+
+        EXPECT_EQ(4u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+    }
+
+    TEST_F(IdentifierSimpleClassHierarchyTest, RealClass)
+    {
+        Identifier* identifier = Class(RealClass);
+
+        EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+        EXPECT_EQ(0u, identifier->getChildren().size());
+
+        EXPECT_EQ(2u, identifier->getDirectParents().size());
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface)));
+        EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass)));
+
+        EXPECT_EQ(7u, identifier->getParents().size());
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Listable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(Interface)));
+        EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass)));
+    }
+}
Index: code/trunk/test/core/class/IdentifierTest.cc
===================================================================
--- code/trunk/test/core/class/IdentifierTest.cc	(revision 9667)
+++ code/trunk/test/core/class/IdentifierTest.cc	(revision 9667)
@@ -0,0 +1,53 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestClass : public Identifiable
+        {
+            public:
+                TestClass() { RegisterObject(TestClass); }
+        };
+
+        class TestSubclass : public TestClass
+        {
+            public:
+                TestSubclass() { RegisterObject(TestSubclass); }
+        };
+    }
+
+    TEST(IdentifierTest, IdentifierExistsOfClass)
+    {
+        TestClass test;
+
+        Identifier* identifier = Class(TestClass);
+        EXPECT_TRUE(identifier != NULL);
+    }
+
+    TEST(IdentifierTest, IdentifierExistsOfSubclass)
+    {
+        TestSubclass test;
+
+        Identifier* identifier = Class(TestSubclass);
+        EXPECT_TRUE(identifier != NULL);
+    }
+
+    TEST(IdentifierTest, HasNameOfClass)
+    {
+        TestClass test;
+
+        Identifier* identifier = Class(TestClass);
+        EXPECT_EQ("TestClass", identifier->getName());
+    }
+
+    TEST(IdentifierTest, HasNameOfSubClass)
+    {
+        TestSubclass test;
+
+        Identifier* identifier = Class(TestSubclass);
+        EXPECT_EQ("TestSubclass", identifier->getName());
+    }
+}
Index: code/trunk/test/core/class/OrxonoxClassTest.cc
===================================================================
--- code/trunk/test/core/class/OrxonoxClassTest.cc	(revision 9667)
+++ code/trunk/test/core/class/OrxonoxClassTest.cc	(revision 9667)
@@ -0,0 +1,35 @@
+#include <gtest/gtest.h>
+#include "core/class/OrxonoxClass.h"
+#include "core/object/Context.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestClass : public OrxonoxClass
+        {
+        };
+
+        // Fixture
+        class OrxonoxClassTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(OrxonoxClassTest, CanCreate)
+    {
+        TestClass* test = new TestClass();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+}
Index: code/trunk/test/core/class/OrxonoxInterfaceTest.cc
===================================================================
--- code/trunk/test/core/class/OrxonoxInterfaceTest.cc	(revision 9667)
+++ code/trunk/test/core/class/OrxonoxInterfaceTest.cc	(revision 9667)
@@ -0,0 +1,57 @@
+#include <gtest/gtest.h>
+#include "core/class/OrxonoxInterface.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/object/Context.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class Interface1 : virtual public OrxonoxInterface
+        {
+        };
+        class Interface2 : virtual public OrxonoxInterface
+        {
+        };
+        class Interface3 : virtual public OrxonoxInterface
+        {
+        };
+
+        class TestClass1 : public Interface1, public Interface2, public Interface3
+        {
+        };
+
+        class TestClass2 : public OrxonoxClass, public Interface1, public Interface2, public Interface3
+        {
+        };
+
+        // Fixture
+        class OrxonoxInterfaceTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(OrxonoxInterfaceTest, CanCreate1)
+    {
+        TestClass1* test = new TestClass1();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+
+    TEST_F(OrxonoxInterfaceTest, CanCreate2)
+    {
+        TestClass2* test = new TestClass2();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+}
Index: code/trunk/test/core/class/SubclassIdentifierTest.cc
===================================================================
--- code/trunk/test/core/class/SubclassIdentifierTest.cc	(revision 9667)
+++ code/trunk/test/core/class/SubclassIdentifierTest.cc	(revision 9667)
@@ -0,0 +1,81 @@
+#include <gtest/gtest.h>
+#include "core/CoreIncludes.h"
+#include "core/class/Identifiable.h"
+#include "core/class/SubclassIdentifier.h"
+#include "core/class/OrxonoxClass.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestClass : public OrxonoxClass
+        {
+            public:
+                TestClass(Context* context = NULL) { RegisterObject(TestClass); }
+        };
+
+        class TestSubclass : public TestClass
+        {
+            public:
+                TestSubclass(Context* context = NULL) { RegisterObject(TestSubclass); }
+        };
+
+        // Fixture
+        class SubclassIdentifierTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());
+                    registerClass("TestClass", new ClassFactoryWithContext<TestClass>());
+                    registerClass("TestSubclass", new ClassFactoryWithContext<TestSubclass>());
+
+                    IdentifierManager::getInstance().createClassHierarchy();
+
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+                }
+        };
+    }
+
+    TEST_F(SubclassIdentifierTest, CanCreateIdentifier)
+    {
+        TestSubclass test;
+
+        SubclassIdentifier<TestClass> subclassIdentifier;
+    }
+
+    TEST_F(SubclassIdentifierTest, DefaultsToNormalIdentifier)
+    {
+        TestSubclass test;
+
+        SubclassIdentifier<TestClass> subclassIdentifier;
+        EXPECT_EQ(Class(TestClass), subclassIdentifier.getIdentifier());
+    }
+
+    TEST_F(SubclassIdentifierTest, CanAssignIdentifierOfSubclass)
+    {
+        TestSubclass test;
+        SubclassIdentifier<TestClass> subclassIdentifier;
+        subclassIdentifier = Class(TestSubclass);
+        EXPECT_EQ(Class(TestSubclass), subclassIdentifier.getIdentifier());
+    }
+
+    TEST_F(SubclassIdentifierTest, CanCreateSubclass)
+    {
+        TestSubclass test;
+        SubclassIdentifier<TestClass> subclassIdentifier;
+        subclassIdentifier = Class(TestSubclass);
+
+        TestClass* instance = subclassIdentifier.fabricate(NULL);
+        ASSERT_TRUE(instance != NULL);
+        EXPECT_EQ(Class(TestSubclass), instance->getIdentifier());
+        delete instance;
+    }
+}
Index: code/trunk/test/core/class/SuperTest.cc
===================================================================
--- code/trunk/test/core/class/SuperTest.cc	(revision 9667)
+++ code/trunk/test/core/class/SuperTest.cc	(revision 9667)
@@ -0,0 +1,142 @@
+#include <gtest/gtest.h>
+#include <tinyxml/tinyxml.h>
+
+#include "core/CoreIncludes.h"
+#include "core/BaseObject.h"
+#include "core/class/Super.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestClass : public BaseObject
+        {
+            public:
+                TestClass(Context* context = NULL) : BaseObject(context), changedNameBase_(false), xmlPortBase_(false), modeBase_(XMLPort::NOP)
+                {
+                    RegisterObject(TestClass);
+                }
+
+                virtual void changedName()
+                {
+                    this->changedNameBase_ = true;
+                }
+
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode)
+                {
+                    this->xmlPortBase_ = true;
+                    this->modeBase_ = mode;
+                }
+
+                bool changedNameBase_;
+                bool xmlPortBase_;
+                XMLPort::Mode modeBase_;
+        };
+
+        class TestSubclass : public TestClass
+        {
+            public:
+                TestSubclass(Context* context = NULL) : TestClass(context), changedNameSubclass_(false), xmlPortSubclass_(false), modeSubclass_(XMLPort::NOP)
+                {
+                    RegisterObject(TestSubclass);
+                }
+
+                virtual void changedName()
+                {
+                    this->changedNameSubclass_ = true;
+
+                    SUPER(TestSubclass, changedName);
+                }
+
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode)
+                {
+                    this->xmlPortSubclass_ = true;
+                    this->modeSubclass_ = mode;
+
+                    SUPER(TestSubclass, XMLPort, xmlelement, mode);
+                }
+
+                bool changedNameSubclass_;
+                bool xmlPortSubclass_;
+                XMLPort::Mode modeSubclass_;
+        };
+
+       // Fixture
+        class SuperTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+
+                    registerClass("OrxonoxClass", new ClassFactoryNoArgs<OrxonoxClass>());
+                    registerClass("BaseObject", new ClassFactoryWithContext<BaseObject>());
+                    registerClass("TestClass", new ClassFactoryWithContext<TestClass>());
+                    registerClass("TestSubclass", new ClassFactoryWithContext<TestSubclass>());
+
+                    IdentifierManager::getInstance().createClassHierarchy();
+
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+
+                    IdentifierManager::getInstance().destroyAllIdentifiers();
+                }
+        };
+    }
+
+    TEST_F(SuperTest, ClassHierarchyIsCorrect)
+    {
+        {
+            Identifier* identifier = Class(TestSubclass);
+
+            EXPECT_EQ(0u, identifier->getDirectChildren().size());
+
+            EXPECT_EQ(1u, identifier->getDirectParents().size());
+            EXPECT_TRUE(identifier->getDirectParents().find(Class(TestClass)) != identifier->getDirectParents().end());
+        }
+        {
+            Identifier* identifier = Class(TestClass);
+
+            EXPECT_EQ(1u, identifier->getDirectChildren().size());
+            EXPECT_TRUE(identifier->getDirectChildren().find(Class(TestSubclass)) != identifier->getDirectChildren().end());
+
+            EXPECT_EQ(1u, identifier->getDirectParents().size());
+            EXPECT_TRUE(identifier->getDirectParents().find(Class(BaseObject)) != identifier->getDirectParents().end());
+        }
+    }
+
+    TEST_F(SuperTest, SuperCallWithoutArguments)
+    {
+        TestSubclass test;
+
+        EXPECT_FALSE(test.changedNameBase_);
+        EXPECT_FALSE(test.changedNameSubclass_);
+
+        test.changedName();
+
+        EXPECT_TRUE(test.changedNameBase_);
+        EXPECT_TRUE(test.changedNameSubclass_);
+    }
+
+    TEST_F(SuperTest, SuperCallWithArguments)
+    {
+        TestSubclass test;
+
+        EXPECT_FALSE(test.xmlPortBase_);
+        EXPECT_FALSE(test.xmlPortSubclass_);
+        EXPECT_EQ(XMLPort::NOP, test.modeBase_);
+        EXPECT_EQ(XMLPort::NOP, test.modeSubclass_);
+
+        Element* element = NULL;
+        test.XMLPort(*element, XMLPort::SaveObject);
+
+        EXPECT_TRUE(test.xmlPortBase_);
+        EXPECT_TRUE(test.xmlPortSubclass_);
+        EXPECT_EQ(XMLPort::SaveObject, test.modeBase_);
+        EXPECT_EQ(XMLPort::SaveObject, test.modeSubclass_);
+    }
+}
Index: code/trunk/test/core/command/CommandTest.cc
===================================================================
--- code/trunk/test/core/command/CommandTest.cc	(revision 9667)
+++ code/trunk/test/core/command/CommandTest.cc	(revision 9667)
@@ -0,0 +1,175 @@
+#include <gtest/gtest.h>
+#include "core/command/ConsoleCommand.h"
+#include "core/command/CommandExecutor.h"
+#include "core/object/Destroyable.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        int functionNr = 0;
+        int valueA = 0;
+        int valueB = 0;
+        int valueC = 0;
+
+        void testfunction1(int a);
+        void testfunction2(int a, int b);
+        void testfunction3(int a, int b);
+        void testfunction4(int a, int b, int c);
+
+        class Testclass : public Destroyable
+        {
+            public:
+                void testfunction5(int a);
+                void testfunction6(int a);
+
+                Testclass* other_;
+                int b_;
+        };
+
+        SetConsoleCommand("test", &testfunction1);
+
+        Testclass* class1 = new Testclass();
+        Testclass* class2 = new Testclass();
+
+        void testfunction1(int a)
+        {
+            functionNr = 1;
+            valueA = a;
+            valueB = 0;
+            valueC = 0;
+
+            if (a == 1)
+                ModifyConsoleCommand("test").pushFunction().defaultValue(1, 10).setFunction(&testfunction2);
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+
+        void testfunction2(int a, int b)
+        {
+            functionNr = 2;
+            valueA = a;
+            valueB = b;
+            valueC = 0;
+
+            if (a == 1)
+                ModifyConsoleCommand("test").pushFunction().defaultValue(1, 20).setFunction(&testfunction3);
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+
+        void testfunction3(int a, int b)
+        {
+            functionNr = 3;
+            valueA = a;
+            valueB = b;
+            valueC = 0;
+
+            if (a == 1)
+                ModifyConsoleCommand("test").pushFunction().defaultValue(1, 30).defaultValue(2, 40).setFunction(&testfunction4);
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+
+        void testfunction4(int a, int b, int c)
+        {
+            functionNr = 4;
+            valueA = a;
+            valueB = b;
+            valueC = c;
+
+            if (a == 1)
+                ModifyConsoleCommand("test").pushFunction().setFunction(&Testclass::testfunction5).setObject(class1);
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+
+        void Testclass::testfunction5(int a)
+        {
+            class1->b_ = 11;
+            class2->b_ = 22;
+
+            class1->other_ = class2;
+            class2->other_ = class1;
+
+            functionNr = 5;
+            valueA = a;
+            valueB = b_;
+            valueC = 0;
+
+            if (a == 2)
+                ModifyConsoleCommand("test").pushObject(this->other_);
+            else if (a == -2)
+                ModifyConsoleCommand("test").popObject();
+            else if (a == 1)
+                ModifyConsoleCommand("test").pushFunction(&Testclass::testfunction6, this);
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+
+        void Testclass::testfunction6(int a)
+        {
+            class1->b_ = 11;
+            class2->b_ = 22;
+
+            class1->other_ = class2;
+            class2->other_ = class1;
+
+            functionNr = 6;
+            valueA = a;
+            valueB = b_;
+            valueC = 0;
+
+            if (a == 2)
+                ModifyConsoleCommand("test").pushObject(this->other_);
+            else if (a == -2)
+                ModifyConsoleCommand("test").popObject();
+            else if (a == 1)
+                ModifyConsoleCommand("test").setFunction(FunctorPtr(0));
+            else if (a == -1)
+                ModifyConsoleCommand("test").popFunction();
+        }
+    }
+
+    void test(int function, int b, int c)
+    {
+        EXPECT_EQ(function, functionNr);
+        EXPECT_EQ(b, valueB);
+        EXPECT_EQ(c, valueC);
+    }
+
+    TEST(CommandTest, ModuleTest)
+    {
+        test(0, 0, 0);
+        CommandExecutor::execute("test 0", false);
+        test(1, 0, 0);
+        CommandExecutor::execute("test 1", false);
+        test(1, 0, 0);
+        CommandExecutor::execute("test 0", false);
+        test(2, 10, 0);
+        CommandExecutor::execute("test 0 123", false);
+        test(2, 123, 0);
+        CommandExecutor::execute("test 1 1234", false);
+        test(2, 1234, 0);
+        CommandExecutor::execute("test 1", false);
+        test(3, 20, 0);
+        CommandExecutor::execute("test 0", false);
+        test(4, 30, 40);
+        CommandExecutor::execute("test 1 100 200", false);
+        test(4, 100, 200);
+        CommandExecutor::execute("test 0", false);
+        test(5, 11, 0);
+        CommandExecutor::execute("test 1", false);
+        test(5, 11, 0);
+        CommandExecutor::execute("test 2", false);
+        test(6, 11, 0);
+        CommandExecutor::execute("test 0", false);
+        test(6, 22, 0);
+        CommandExecutor::execute("test -1", false);
+        test(6, 22, 0);
+        CommandExecutor::execute("test -1", false);
+        test(5, 11, 0);
+        CommandExecutor::execute("test 0", false);
+        test(4, 30, 40);
+    }
+}
Index: code/trunk/test/core/object/ClassFactoryTest.cc
===================================================================
--- code/trunk/test/core/object/ClassFactoryTest.cc	(revision 9667)
+++ code/trunk/test/core/object/ClassFactoryTest.cc	(revision 9667)
@@ -0,0 +1,36 @@
+#include <gtest/gtest.h>
+#include "core/object/ClassFactory.h"
+#include "core/BaseObject.h"
+#include "core/object/Context.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        // Fixture
+        class ClassFactoryTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(ClassFactoryTest, CanFabricateObject)
+    {
+        Factory* factory = new ClassFactoryWithContext<BaseObject>();
+        Identifiable* object = factory->fabricate(NULL);
+        ASSERT_TRUE(object != NULL);
+        BaseObject* baseObject = dynamic_cast<BaseObject*>(object);
+        EXPECT_TRUE(baseObject != NULL);
+        delete object;
+        // don't delete factory - it remains in the identifier
+    }
+}
Index: code/trunk/test/core/object/ContextTest.cc
===================================================================
--- code/trunk/test/core/object/ContextTest.cc	(revision 9667)
+++ code/trunk/test/core/object/ContextTest.cc	(revision 9667)
@@ -0,0 +1,80 @@
+#include <gtest/gtest.h>
+#include "core/object/Context.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class SubclassContext : public OrxonoxClass, public Context
+        {
+            public:
+                SubclassContext() : Context(NULL) { RegisterObject(SubclassContext); }
+        };
+
+        // Fixture
+        class ContextTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(ContextTest, CanCreateContext)
+    {
+        Context context(NULL);
+    }
+
+    TEST_F(ContextTest, CanCreateSubclassContext)
+    {
+        SubclassContext context;
+    }
+
+    TEST_F(ContextTest, ContextIsItsOwnContext)
+    {
+        Context context(NULL);
+        EXPECT_EQ(&context, context.getContext());
+    }
+
+    TEST_F(ContextTest, SubclassContextIsItsOwnContext)
+    {
+        SubclassContext context;
+        EXPECT_EQ(&context, context.getContext());
+    }
+
+    TEST_F(ContextTest, SubclassAddsToItsOwnObjectList)
+    {
+        SubclassContext context;
+        EXPECT_EQ(&context, context.getContext());
+        EXPECT_EQ(1u, context.getObjectList<SubclassContext>()->size());
+    }
+
+    TEST_F(ContextTest, ContextIsAddedToItsOwnObjectList)
+    {
+        Context context(NULL);
+        ASSERT_EQ(1u, context.getObjectList<Context>()->size());
+        EXPECT_TRUE(context.getObjectList<Context>()->begin()->objectBase_ == static_cast<Listable*>(&context));
+    }
+
+    TEST_F(ContextTest, ContextIsAddedToObjectListOfBaseContext)
+    {
+        Context baseContext(NULL);
+        Context subContext(&baseContext);
+
+        ASSERT_EQ(1u, subContext.getObjectList<Context>()->size());
+        EXPECT_TRUE(subContext.getObjectList<Context>()->begin()->objectBase_ == static_cast<Listable*>(&subContext));
+
+        ASSERT_EQ(2u, baseContext.getObjectList<Context>()->size());
+        EXPECT_TRUE(baseContext.getObjectList<Context>()->begin()->objectBase_ == static_cast<Listable*>(&baseContext));
+        EXPECT_TRUE(baseContext.getObjectList<Context>()->begin()->next_->objectBase_ == static_cast<Listable*>(&subContext));
+    }
+}
Index: code/trunk/test/core/object/DestroyableTest.cc
===================================================================
--- code/trunk/test/core/object/DestroyableTest.cc	(revision 9667)
+++ code/trunk/test/core/object/DestroyableTest.cc	(revision 9667)
@@ -0,0 +1,64 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "core/object/Destroyable.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class DestroyableTest : public Destroyable
+        {
+            public:
+                DestroyableTest(bool& destroyed) : destroyed_(destroyed) { destroyed_ = false; }
+                virtual ~DestroyableTest() { destroyed_ = true; }
+                MOCK_METHOD0(preDestroy, void());
+
+            private:
+                bool& destroyed_;
+        };
+
+        class DestructionListenerMock : public DestructionListener
+        {
+            public:
+                MOCK_METHOD0(objectDeleted, void());
+                inline void registerAsDestructionListener(Destroyable* object)
+                    { this->DestructionListener::registerAsDestructionListener(object); }
+        };
+    }
+
+    TEST(DestroyableTest, DestroyDeletesInstance)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        EXPECT_TRUE(test != NULL);
+        test->destroy();
+        EXPECT_TRUE(destroyed);
+    }
+
+    TEST(DestroyableTest, DestroyCallsPreDestroy)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        EXPECT_CALL(*test, preDestroy());
+        test->destroy();
+    }
+
+    TEST(DestroyableTest, DestroyCallsListener)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        DestructionListenerMock listener;
+        listener.registerAsDestructionListener(test);
+        EXPECT_CALL(listener, objectDeleted());
+        test->destroy();
+    }
+
+    TEST(DestroyableTest, ReferenceCounterIsZero)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        EXPECT_EQ(0u, test->getReferenceCount());
+        test->destroy();
+    }
+}
Index: code/trunk/test/core/object/IteratorTest.cc
===================================================================
--- code/trunk/test/core/object/IteratorTest.cc	(revision 9667)
+++ code/trunk/test/core/object/IteratorTest.cc	(revision 9667)
@@ -0,0 +1,74 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "core/object/Iterator.h"
+#include "core/class/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestInterface : virtual public OrxonoxInterface
+        {
+            public:
+            TestInterface() { RegisterObject(TestInterface); }
+        };
+
+        class TestClass : public OrxonoxClass, public TestInterface
+        {
+            public:
+                TestClass() { RegisterObject(TestClass); }
+                MOCK_METHOD0(test, void());
+        };
+
+        // Fixture
+        class IteratorTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(IteratorTest, CanCreateIterator)
+    {
+        Iterator<TestInterface> it;
+    }
+
+    TEST_F(IteratorTest, CanAssignIterator)
+    {
+        Iterator<TestInterface> it = ObjectList<TestInterface>::begin();
+    }
+
+    TEST_F(IteratorTest, CanIterateOverEmptyList)
+    {
+        size_t i = 0;
+        for (Iterator<TestInterface> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
+            ++i;
+        EXPECT_EQ(0u, i);
+    }
+
+    TEST_F(IteratorTest, CanCallObjects)
+    {
+        TestClass test1;
+        TestClass test2;
+        TestClass test3;
+
+        EXPECT_CALL(test1, test());
+        EXPECT_CALL(test2, test());
+        EXPECT_CALL(test3, test());
+
+        // iterate over interfaces but use a TestClass iterator - now we can call TestClass::test()
+        for (Iterator<TestClass> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
+            it->test();
+    }
+}
Index: code/trunk/test/core/object/ListableTest.cc
===================================================================
--- code/trunk/test/core/object/ListableTest.cc	(revision 9667)
+++ code/trunk/test/core/object/ListableTest.cc	(revision 9667)
@@ -0,0 +1,243 @@
+#include <gtest/gtest.h>
+#include "core/object/Listable.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class ListableClassTest : public Listable
+        {
+            public:
+            ListableClassTest() { RegisterObject(ListableClassTest); }
+        };
+
+        class ListableSubclassTest : public ListableClassTest
+        {
+            public:
+                ListableSubclassTest() { RegisterObject(ListableSubclassTest); }
+        };
+
+        template <class T>
+        bool objectListContains(T* element, Context* context = Context::getRootContext())
+        {
+            for (typename ObjectList<T>::iterator it = static_cast<ObjectListElement<T>*>(context->getObjectList<T>()->begin());
+                    it != static_cast<ObjectListElement<T>*>(context->getObjectList<T>()->end()); ++it)
+                if (*it == element)
+                    return true;
+            return false;
+        }
+
+        // Fixture
+        class ListableTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(ListableTest, CanCreate)
+    {
+        ListableClassTest* test = new ListableClassTest();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+
+    TEST_F(ListableTest, AddsToObjectList)
+    {
+        ListableClassTest test;
+        EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
+    }
+
+    TEST_F(ListableTest, AddsToAllObjectLists)
+    {
+        ListableSubclassTest test;
+        EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
+        EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
+    }
+
+    TEST_F(ListableTest, RemovesFromObjectList)
+    {
+        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
+        {
+            ListableClassTest test;
+            EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
+            EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
+        }
+        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
+    }
+
+    TEST_F(ListableTest, RemovesFromAllObjectLists)
+    {
+        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
+        EXPECT_EQ(0u, ObjectList<ListableSubclassTest>::size());
+        {
+            ListableSubclassTest test;
+            EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
+            EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
+            EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
+            EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
+        }
+        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
+        EXPECT_EQ(0u, ObjectList<ListableSubclassTest>::size());
+    }
+
+    TEST_F(ListableTest, CanAddObjectToContext)
+    {
+        Context context(NULL);
+        ListableSubclassTest test;
+
+        test.setContext(&context);
+
+        // object is in new context
+        EXPECT_EQ(1u, context.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &context));
+        EXPECT_EQ(1u, context.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &context));
+    }
+
+    TEST_F(ListableTest, CanAddObjectToSubContext)
+    {
+        Context baseContext(NULL);
+        Context subContext(&baseContext);
+        ListableSubclassTest test;
+
+        test.setContext(&subContext);
+
+        // object is in both contexts
+        EXPECT_EQ(1u, baseContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &baseContext));
+        EXPECT_EQ(1u, baseContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &baseContext));
+
+        EXPECT_EQ(1u, subContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext));
+        EXPECT_EQ(1u, subContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext));
+    }
+
+    TEST_F(ListableTest, CanChangeContext)
+    {
+        Context* rootContext = Context::getRootContext();
+        Context newContext(NULL);
+        ListableSubclassTest test;
+
+        // object is in root context
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object is NOT in new context
+        EXPECT_EQ(0u, newContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &newContext));
+        EXPECT_EQ(0u, newContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &newContext));
+
+        test.setContext(&newContext);
+
+        // object was removed from root context
+        EXPECT_EQ(0u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(0u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object is now in new context
+        EXPECT_EQ(1u, newContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &newContext));
+        EXPECT_EQ(1u, newContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &newContext));
+    }
+
+    TEST_F(ListableTest, CanChangeToSubContext)
+    {
+        Context* rootContext = Context::getRootContext();
+        Context subContext(rootContext);
+        ListableSubclassTest test;
+
+        // object is in root context
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object is NOT in sub context
+        EXPECT_EQ(0u, subContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext));
+        EXPECT_EQ(0u, subContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext));
+
+        test.setContext(&subContext);
+
+        // object is still in root context
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object is now also in sub context
+        EXPECT_EQ(1u, subContext.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext));
+        EXPECT_EQ(1u, subContext.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext));
+    }
+
+    TEST_F(ListableTest, CanChangeFromSubcontextToSubContext)
+    {
+        Context* rootContext = Context::getRootContext();
+        Context subContext1(rootContext);
+        Context subContext2(rootContext);
+        ListableSubclassTest test;
+
+        test.setContext(&subContext1);
+
+        // object is in root context
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object is also in sub context 1
+        EXPECT_EQ(1u, subContext1.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext1));
+        EXPECT_EQ(1u, subContext1.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext1));
+
+        // object is NOT in sub context 2
+        EXPECT_EQ(0u, subContext2.getObjectList<ListableClassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext2));
+        EXPECT_EQ(0u, subContext2.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext2));
+
+        test.setContext(&subContext2);
+
+        // object is still in root context
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
+        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
+
+        // object was removed from sub context 1
+        EXPECT_EQ(0u, subContext1.getObjectList<ListableClassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext1));
+        EXPECT_EQ(0u, subContext1.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext1));
+
+        // object is now in sub context 2
+        EXPECT_EQ(1u, subContext2.getObjectList<ListableClassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext2));
+        EXPECT_EQ(1u, subContext2.getObjectList<ListableSubclassTest>()->size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext2));
+    }
+}
Index: code/trunk/test/core/object/ObjectListBaseTest.cc
===================================================================
--- code/trunk/test/core/object/ObjectListBaseTest.cc	(revision 9667)
+++ code/trunk/test/core/object/ObjectListBaseTest.cc	(revision 9667)
@@ -0,0 +1,84 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "core/object/ObjectListBase.h"
+#include "core/class/Identifier.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class ObjectListElementRemovalListenerMock : public ObjectListElementRemovalListener
+        {
+            public:
+                MOCK_METHOD1(removedElement, void(ObjectListBaseElement*));
+        };
+    }
+
+    TEST(ObjectListBaseTest, EmptyListHasSizeZero)
+    {
+        ObjectListBase list;
+        EXPECT_EQ(0u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, CanAddElement)
+    {
+        ObjectListBase list;
+        ObjectListBaseElement* element = new ObjectListElement<Listable>(NULL);
+        list.addElement(element);
+        EXPECT_EQ(1u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, CanRemoveElement)
+    {
+        ObjectListBase list;
+        ObjectListBaseElement* element = new ObjectListElement<Listable>(NULL);
+        list.addElement(element);
+        EXPECT_EQ(1u, list.size());
+        list.removeElement(element);
+        EXPECT_EQ(0u, list.size());
+        delete element;
+    }
+
+    TEST(ObjectListBaseTest, CanAddObject)
+    {
+        ObjectListBase list;
+        list.addElement(new ObjectListElement<Listable>(NULL));
+        EXPECT_EQ(1u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, HasCorrectSize)
+    {
+        ObjectListBase list;
+        EXPECT_EQ(0u, list.size());
+        {
+            ObjectListElement<Listable> element1(NULL);
+            list.addElement(&element1);
+            EXPECT_EQ(1u, list.size());
+            {
+                ObjectListElement<Listable> element1(NULL);
+                list.addElement(&element1);
+                EXPECT_EQ(2u, list.size());
+                {
+                    ObjectListElement<Listable> element1(NULL);
+                    list.addElement(&element1);
+                    EXPECT_EQ(3u, list.size());
+                }
+                EXPECT_EQ(2u, list.size());
+            }
+            EXPECT_EQ(1u, list.size());
+        }
+        EXPECT_EQ(0u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, CallsListenerOnRemoval)
+    {
+        ObjectListBase list;
+        ObjectListElementRemovalListenerMock listener;
+        list.registerRemovalListener(&listener);
+        ObjectListBaseElement* element = new ObjectListElement<Listable>(NULL);
+        list.addElement(element);
+        EXPECT_CALL(listener, removedElement(element));
+        list.removeElement(element);
+        delete element;
+    }
+}
Index: code/trunk/test/core/object/ObjectListIteratorTest.cc
===================================================================
--- code/trunk/test/core/object/ObjectListIteratorTest.cc	(revision 9667)
+++ code/trunk/test/core/object/ObjectListIteratorTest.cc	(revision 9667)
@@ -0,0 +1,100 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "core/object/ObjectListIterator.h"
+#include "core/object/Listable.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class ListableTest : public Listable
+        {
+            public:
+                ListableTest() { RegisterObject(ListableTest); }
+                MOCK_METHOD0(test, void());
+        };
+
+        // Fixture
+        class ObjectListIteratorTest : public ::testing::Test
+        {
+            public:
+                virtual void SetUp()
+                {
+                    Context::setRootContext(new Context(NULL));
+                }
+
+                virtual void TearDown()
+                {
+                    Context::setRootContext(NULL);
+                }
+        };
+    }
+
+    TEST_F(ObjectListIteratorTest, CanCreateIterator)
+    {
+        ObjectListIterator<ListableTest> it;
+    }
+
+    TEST_F(ObjectListIteratorTest, CanAssignIterator)
+    {
+        ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin();
+    }
+
+    TEST_F(ObjectListIteratorTest, CanIterateOverEmptyList)
+    {
+        size_t i = 0;
+        for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it)
+            ++i;
+        EXPECT_EQ(0u, i);
+    }
+
+    TEST_F(ObjectListIteratorTest, CanIterateOverFullList)
+    {
+        ListableTest test1;
+        ListableTest test2;
+        ListableTest test3;
+
+        size_t i = 0;
+        for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it)
+        {
+            ++i;
+            if (i == 1u) EXPECT_EQ(&test1, *it);
+            if (i == 2u) EXPECT_EQ(&test2, *it);
+            if (i == 3u) EXPECT_EQ(&test3, *it);
+        }
+        EXPECT_EQ(3u, i);
+    }
+
+    TEST_F(ObjectListIteratorTest, CanIterateReverseOverFullList)
+    {
+        ListableTest test1;
+        ListableTest test2;
+        ListableTest test3;
+
+        size_t i = 0;
+        for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::rbegin(); it != ObjectList<ListableTest>::rend(); --it)
+        {
+            ++i;
+            if (i == 1u) EXPECT_EQ(&test3, *it);
+            if (i == 2u) EXPECT_EQ(&test2, *it);
+            if (i == 3u) EXPECT_EQ(&test1, *it);
+        }
+        EXPECT_EQ(3u, i);
+    }
+
+    TEST_F(ObjectListIteratorTest, CanCallObjects)
+    {
+        ListableTest test1;
+        ListableTest test2;
+        ListableTest test3;
+
+        EXPECT_CALL(test1, test());
+        EXPECT_CALL(test2, test());
+        EXPECT_CALL(test3, test());
+
+        for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it)
+            it->test();
+    }
+}
Index: code/trunk/test/core/object/SmartPtrTest.cc
===================================================================
--- code/trunk/test/core/object/SmartPtrTest.cc	(revision 9667)
+++ code/trunk/test/core/object/SmartPtrTest.cc	(revision 9667)
@@ -0,0 +1,93 @@
+#include <gtest/gtest.h>
+#include "core/object/SmartPtr.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class DestroyableTest : public Destroyable
+        {
+            public:
+                DestroyableTest(bool& destroyed) : destroyed_(destroyed) { destroyed_ = false; }
+                virtual ~DestroyableTest() { destroyed_ = true; }
+
+            private:
+                bool& destroyed_;
+        };
+    }
+
+    TEST(SmartPtrTest, CanReferenceObject)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        SmartPtr<DestroyableTest> smartPtr = test;
+        EXPECT_EQ(test, smartPtr.get());
+        test->destroy();
+    }
+
+    TEST(SmartPtrTest, IncreasesReferenceCount)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        EXPECT_EQ(0u, test->getReferenceCount());
+        {
+            SmartPtr<DestroyableTest> smartPtr = test;
+            EXPECT_EQ(1u, test->getReferenceCount());
+        }
+        EXPECT_EQ(0u, test->getReferenceCount());
+        test->destroy();
+    }
+
+    TEST(SmartPtrTest, DestroyDeletesInstance)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        test->destroy();
+        EXPECT_TRUE(destroyed);
+    }
+
+    TEST(SmartPtrTest, PreventsDestruction)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        SmartPtr<DestroyableTest> smartPtr = test;
+        test->destroy();
+        EXPECT_FALSE(destroyed);
+    }
+
+    TEST(SmartPtrTest, DestroysIfSmartPtrRemoved)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        {
+            SmartPtr<DestroyableTest> smartPtr = test;
+            test->destroy();
+            EXPECT_FALSE(destroyed);
+        }
+        EXPECT_TRUE(destroyed);
+    }
+
+    TEST(SmartPtrTest, DestroysIfAllSmartPtrsRemoved)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        {
+            SmartPtr<DestroyableTest> smartPtr1 = test;
+            {
+                SmartPtr<DestroyableTest> smartPtr2 = test;
+                {
+                    SmartPtr<DestroyableTest> smartPtr3 = test;
+                    test->destroy();
+                    EXPECT_FALSE(destroyed);
+                }
+                EXPECT_FALSE(destroyed);
+            }
+            EXPECT_FALSE(destroyed);
+        }
+        EXPECT_TRUE(destroyed);
+    }
+}
Index: code/trunk/test/core/object/WeakPtrTest.cc
===================================================================
--- code/trunk/test/core/object/WeakPtrTest.cc	(revision 9667)
+++ code/trunk/test/core/object/WeakPtrTest.cc	(revision 9667)
@@ -0,0 +1,47 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "core/object/WeakPtr.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class DestroyableTest : public Destroyable
+        {
+        };
+
+        class Callback
+        {
+            public:
+                virtual ~Callback() {}
+                MOCK_METHOD0(callback, void());
+        };
+    }
+
+    TEST(WeakPtrTest, CanReferenceObject)
+    {
+        DestroyableTest* test = new DestroyableTest();
+        WeakPtr<DestroyableTest> weakPtr = test;
+        EXPECT_EQ(test, weakPtr.get());
+        test->destroy();
+    }
+
+    TEST(WeakPtrTest, DestroyRemovesReference)
+    {
+        DestroyableTest* test = new DestroyableTest();
+        WeakPtr<DestroyableTest> weakPtr = test;
+        EXPECT_EQ(test, weakPtr.get());
+        test->destroy();
+        EXPECT_EQ(NULL, weakPtr.get());
+    }
+
+    TEST(WeakPtrTest, DestroyCallsCallback)
+    {
+        DestroyableTest* test = new DestroyableTest();
+        WeakPtr<DestroyableTest> weakPtr = test;
+        Callback callback;
+        weakPtr.setCallback(createFunctor(&Callback::callback, &callback));
+        EXPECT_CALL(callback, callback());
+        test->destroy();
+    }
+}
