Index: /code/branches/core6/test/core/CMakeLists.txt
===================================================================
--- /code/branches/core6/test/core/CMakeLists.txt	(revision 9604)
+++ /code/branches/core6/test/core/CMakeLists.txt	(revision 9605)
@@ -17,4 +17,8 @@
     object/ClassFactoryTest.cc
     object/DestroyableTest.cc
+    object/IteratorTest.cc
+    object/ListableTest.cc
+    object/ObjectListBaseTest.cc
+    object/ObjectListIteratorTest.cc
     object/SmartPtrTest.cc
     object/WeakPtrTest.cc
Index: /code/branches/core6/test/core/object/IteratorTest.cc
===================================================================
--- /code/branches/core6/test/core/object/IteratorTest.cc	(revision 9605)
+++ /code/branches/core6/test/core/object/IteratorTest.cc	(revision 9605)
@@ -0,0 +1,59 @@
+#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 : public OrxonoxInterface
+        {
+            public:
+            TestInterface() { RegisterRootObject(TestInterface); }
+        };
+
+        class TestClass : public OrxonoxClass, public TestInterface
+        {
+            public:
+                TestClass() { RegisterRootObject(TestClass); }
+                MOCK_METHOD0(test, void());
+        };
+    }
+
+    TEST(IteratorTest, CanCreateIterator)
+    {
+        Iterator<TestInterface> it;
+    }
+
+    TEST(IteratorTest, CanAssignIterator)
+    {
+        Iterator<TestInterface> it = ObjectList<TestInterface>::begin();
+    }
+
+    TEST(IteratorTest, CanIterateOverEmptyList)
+    {
+        size_t i = 0;
+        for (Iterator<TestInterface> it = ObjectList<TestInterface>::begin(); it != ObjectList<TestInterface>::end(); ++it)
+            ++i;
+        EXPECT_EQ(0u, i);
+    }
+
+    TEST(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/branches/core6/test/core/object/ListableTest.cc
===================================================================
--- /code/branches/core6/test/core/object/ListableTest.cc	(revision 9605)
+++ /code/branches/core6/test/core/object/ListableTest.cc	(revision 9605)
@@ -0,0 +1,76 @@
+#include <gtest/gtest.h>
+#include "core/object/Listable.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class ListableTest : public Listable
+        {
+            public:
+                ListableTest() { RegisterRootObject(ListableTest); }
+        };
+
+        class ListableSubclassTest : public ListableTest
+        {
+            public:
+                ListableSubclassTest() { RegisterObject(ListableSubclassTest); }
+        };
+
+        template <class T>
+        bool objectListContains(T* element)
+        {
+            for (typename ObjectList<T>::iterator it = ObjectList<T>::begin(); it != ObjectList<T>::end(); ++it)
+                if (*it == element)
+                    return true;
+            return false;
+        }
+    }
+
+    TEST(ListableTest, CanCreate)
+    {
+        ListableTest* test = new ListableTest();
+        ASSERT_TRUE(test != NULL);
+        delete test;
+    }
+
+    TEST(ListableTest, AddsToObjectList)
+    {
+        ListableTest test;
+        EXPECT_EQ(1u, ObjectList<ListableTest>::size());
+        EXPECT_TRUE(objectListContains<ListableTest>(&test));
+    }
+
+    TEST(ListableTest, AddsToAllObjectLists)
+    {
+        ListableSubclassTest test;
+        EXPECT_EQ(1u, ObjectList<ListableTest>::size());
+        EXPECT_TRUE(objectListContains<ListableTest>(&test));
+        EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
+        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
+    }
+
+    TEST(ListableTest, RemovesFromObjectList)
+    {
+        {
+            ListableTest test;
+            EXPECT_EQ(1u, ObjectList<ListableTest>::size());
+            EXPECT_TRUE(objectListContains<ListableTest>(&test));
+        }
+        EXPECT_EQ(0u, ObjectList<ListableTest>::size());
+    }
+
+    TEST(ListableTest, RemovesFromAllObjectLists)
+    {
+        {
+            ListableSubclassTest test;
+            EXPECT_EQ(1u, ObjectList<ListableTest>::size());
+            EXPECT_TRUE(objectListContains<ListableTest>(&test));
+            EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
+            EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
+        }
+        EXPECT_EQ(0u, ObjectList<ListableTest>::size());
+        EXPECT_EQ(0u, ObjectList<ListableSubclassTest>::size());
+    }
+}
Index: /code/branches/core6/test/core/object/ObjectListBaseTest.cc
===================================================================
--- /code/branches/core6/test/core/object/ObjectListBaseTest.cc	(revision 9605)
+++ /code/branches/core6/test/core/object/ObjectListBaseTest.cc	(revision 9605)
@@ -0,0 +1,83 @@
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include "core/object/ObjectListBase.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 ObjectListBaseElement(NULL);
+        list.addElement(element);
+        EXPECT_EQ(1u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, CanRemoveElement)
+    {
+        ObjectListBase list;
+        ObjectListBaseElement* element = new ObjectListBaseElement(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.add(static_cast<Listable*>(NULL));
+        EXPECT_EQ(1u, list.size());
+    }
+
+    TEST(ObjectListBaseTest, HasCorrectSize)
+    {
+        ObjectListBase list;
+        EXPECT_EQ(0u, list.size());
+        {
+            ObjectListBaseElement element1(NULL);
+            list.addElement(&element1);
+            EXPECT_EQ(1u, list.size());
+            {
+                ObjectListBaseElement element1(NULL);
+                list.addElement(&element1);
+                EXPECT_EQ(2u, list.size());
+                {
+                    ObjectListBaseElement 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 ObjectListBaseElement(NULL);
+        list.addElement(element);
+        EXPECT_CALL(listener, removedElement(element));
+        list.removeElement(element);
+        delete element;
+    }
+}
Index: /code/branches/core6/test/core/object/ObjectListIteratorTest.cc
===================================================================
--- /code/branches/core6/test/core/object/ObjectListIteratorTest.cc	(revision 9605)
+++ /code/branches/core6/test/core/object/ObjectListIteratorTest.cc	(revision 9605)
@@ -0,0 +1,85 @@
+#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() { RegisterRootObject(ListableTest); }
+                MOCK_METHOD0(test, void());
+        };
+    }
+
+    TEST(ObjectListIteratorTest, CanCreateIterator)
+    {
+        ObjectListIterator<ListableTest> it;
+    }
+
+    TEST(ObjectListIteratorTest, CanAssignIterator)
+    {
+        ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin();
+    }
+
+    TEST(ObjectListIteratorTest, CanIterateOverEmptyList)
+    {
+        size_t i = 0;
+        for (ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin(); it != ObjectList<ListableTest>::end(); ++it)
+            ++i;
+        EXPECT_EQ(0u, i);
+    }
+
+    TEST(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(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(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();
+    }
+}
