Index: ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,174 @@
+/*
+ * Project: CodePatterns
+ * Copyright (C)  2013 Frederik Heber. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * GraveyardUnitTest.cpp
+ *
+ *  Created on: Sep 05, 2013
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <set>
+
+#include "CodePatterns/Assert.hpp"
+
+#include <iostream>
+
+#include "stubs/ObserverStub.hpp"
+#include "CodePatterns/Observer/Graveyard.hpp"
+#include "CodePatterns/Observer/Notification.hpp"
+#include "CodePatterns/Observer/ObserverLog.hpp"
+
+#include "GraveyardUnitTest.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( GraveyardUnitTest );
+
+/******************* Test stubs ************************/
+
+
+/******************* actuall tests ***************/
+
+void GraveyardUnitTest::setUp() {
+  ASSERT_DO(Assert::Throw);
+#ifdef LOG_OBSERVER
+  ObserverLog::getInstance().enableLogging();
+#endif
+
+  graveyard = new Graveyard;
+  observer1 = new UpdateCountObserver();
+  observer2 = new UpdateCountObserver();
+  observer3 = new UpdateCountObserver();
+  observer4 = new UpdateCountObserver();
+}
+
+void GraveyardUnitTest::tearDown() {
+  delete observer1;
+  delete observer2;
+  delete observer3;
+  delete observer4;
+#ifdef LOG_OBSERVER
+  ObserverLog::getInstance().disableLogging();
+#endif
+  delete graveyard;
+}
+
+void GraveyardUnitTest::Zombie_soloTest()
+{
+  observerLog().enableLogging();
+
+  // test with unobserved Observable
+  Observable *simpleObservable1 = new SimpleObservable();
+
+  graveyard->turnZombie( simpleObservable1);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 0);
+
+  observerLog().disableLogging();
+}
+
+void GraveyardUnitTest::Zombie_oneTest()
+{
+  observerLog().enableLogging();
+
+  // test with one Observer
+  SimpleObservable *simpleObservable1 = new SimpleObservable();
+  Observable *_observable = simpleObservable1;
+
+  simpleObservable1->signOn(observer1);
+  graveyard->turnZombie(_observable);
+  simpleObservable1->signOff(observer1);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 0);
+
+  observerLog().disableLogging();
+}
+
+void GraveyardUnitTest::Zombie_manyTest()
+{
+  observerLog().enableLogging();
+
+  // test with some more Observers
+  SimpleObservable *simpleObservable1 = new SimpleObservable();
+  Observable *_observable = simpleObservable1;
+
+  // create some observer noise
+  simpleObservable1->signOn(observer1);
+  simpleObservable1->signOn(observer2);
+  simpleObservable1->signOn(observer3);
+  simpleObservable1->signOn(observer4);
+
+  // turn zombie
+  graveyard->turnZombie(_observable);
+
+  // remove the noise again (in mixed order)
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)4, simpleObservable1->getNumberOfObservers());
+  simpleObservable1->signOff(observer3);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)3, simpleObservable1->getNumberOfObservers());
+  simpleObservable1->signOff(observer2);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)2, simpleObservable1->getNumberOfObservers());
+  simpleObservable1->signOff(observer4);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, simpleObservable1->getNumberOfObservers());
+  simpleObservable1->signOff(observer1);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 0);
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, simpleObservable1->getNumberOfObservers());
+
+  observerLog().disableLogging();
+}
+
+void GraveyardUnitTest::Zombie_notificationsTest()
+{
+  observerLog().enableLogging();
+
+  // test with an observable with notifications
+  NotificationObservable *notificationObservable = new NotificationObservable();
+  Observable *_observable = notificationObservable;
+
+  // create some observer noise
+  notificationObservable->signOn(observer1);
+  notificationObservable->signOn(observer2);
+  notificationObservable->signOn(observer2, NotificationObservable::Operation1Notify);
+  notificationObservable->signOn(observer3, NotificationObservable::Operation1Notify);
+  notificationObservable->signOn(observer4, NotificationObservable::Operation2Notify);
+
+  // turn zombie
+  graveyard->turnZombie(_observable);
+
+  // remove the noise again (in mixed order)
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)5, notificationObservable->getNumberOfObservers());
+  notificationObservable->signOff(observer3, NotificationObservable::Operation1Notify);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)4, notificationObservable->getNumberOfObservers());
+  notificationObservable->signOff(observer2, NotificationObservable::Operation1Notify);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)3, notificationObservable->getNumberOfObservers());
+  notificationObservable->signOff(observer2);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)2, notificationObservable->getNumberOfObservers());
+  notificationObservable->signOff(observer4, NotificationObservable::Operation2Notify);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 1);
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, notificationObservable->getNumberOfObservers());
+  notificationObservable->signOff(observer1);
+  CPPUNIT_ASSERT( graveyard->graveyard.size() == 0);
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, notificationObservable->getNumberOfObservers());
+
+  observerLog().disableLogging();
+}
Index: ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.hpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/GraveyardUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,49 @@
+/*
+ * GraveyardUnitTest.hpp
+ *
+ *  Created on: Sep 05, 2013
+ *      Author: heber
+ */
+
+#ifndef OBSERVERTEST_HPP_
+#define OBSERVERTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+// forward declaration for test stubs
+class Graveyard;
+class UpdateCountObserver;
+
+class GraveyardUnitTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( GraveyardUnitTest ) ;
+  CPPUNIT_TEST ( Zombie_soloTest );
+  CPPUNIT_TEST ( Zombie_oneTest );
+  CPPUNIT_TEST ( Zombie_manyTest );
+  CPPUNIT_TEST ( Zombie_notificationsTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void Zombie_soloTest();
+  void Zombie_oneTest();
+  void Zombie_manyTest();
+  void Zombie_notificationsTest();
+
+private:
+  Graveyard *graveyard;
+
+  UpdateCountObserver *observer1;
+  UpdateCountObserver *observer2;
+  UpdateCountObserver *observer3;
+  UpdateCountObserver *observer4;
+};
+
+#endif /* OBSERVERTEST_HPP_ */
Index: ThirdParty/CodePatterns/src/Observer/unittests/Makefile.am
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/Makefile.am	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/Makefile.am	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,73 @@
+# PLEASE adhere to the alphabetical ordering in this Makefile!
+# Also indentation by a single tab
+
+# NOTE that all paths are relative to ./src (because we get included there!)
+
+TESTS += \
+	GraveyardUnitTest \
+	ObservedContainerUnitTest \
+	ObserverUnitTest
+
+TESTSOURCES += \
+	../Observer/unittests/GraveyardUnitTest.cpp \
+	../Observer/unittests/ObserverUnitTest.cpp \
+	../Observer/unittests/ObservedContainerUnitTest.cpp \
+	../Observer/unittests/stubs/ObserverStub.cpp
+
+TESTHEADERS += \
+	../Observer/unittests/GraveyardUnitTest.hpp \
+	../Observer/unittests/ObserverUnitTest.hpp \
+	../Observer/unittests/ObservedContainerUnitTest.hpp
+
+check_PROGRAMS += $(TESTS) 
+noinst_PROGRAMS += $(TESTS)
+
+ObserverUnitTest_SOURCES = UnitTestMain.cpp \
+	../Observer/unittests/ObserverUnitTest.cpp \
+	../Observer/unittests/ObserverUnitTest.hpp \
+	../Observer/unittests/stubs/ObserverStub.cpp \
+	../Observer/unittests/stubs/ObserverStub.hpp
+nodist_ObserverUnitTest_SOURCES = \
+	$(top_srcdir)/src/CodePatterns/Observer/Channels.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/defs.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/Notification.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/Observer.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverLog.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer_impl.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverIterator.hpp
+ObserverUnitTest_LDADD = \
+	../Observer/libcodepatterns-Observer-debug.la \
+	../Helpers/libcodepatterns-Helpers-debug.la
+
+GraveyardUnitTest_SOURCES = UnitTestMain.cpp \
+	../Observer/unittests/GraveyardUnitTest.cpp \
+	../Observer/unittests/GraveyardUnitTest.hpp \
+	../Observer/unittests/stubs/ObserverStub.cpp \
+	../Observer/unittests/stubs/ObserverStub.hpp
+nodist_GraveyardUnitTest_SOURCES = \
+	$(top_srcdir)/src/CodePatterns/Observer/Channels.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/defs.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/Notification.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/Observer.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverLog.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer_impl.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverIterator.hpp
+GraveyardUnitTest_LDADD = \
+	../Observer/libcodepatterns-Observer-debug.la \
+	../Helpers/libcodepatterns-Helpers-debug.la
+
+ObservedContainerUnitTest_SOURCES = UnitTestMain.cpp \
+	../Observer/unittests/ObservedContainerUnitTest.cpp \
+	../Observer/unittests/ObservedContainerUnitTest.hpp \
+	../Observer/unittests/stubs/ObserverStub.cpp \
+	../Observer/unittests/stubs/ObserverStub.hpp
+nodist_ObservedContainerUnitTest_SOURCES = \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer.hpp \
+	$(top_srcdir)/src/CodePatterns/Observer/ObserverContainer_impl.hpp
+ObservedContainerUnitTest_LDADD = \
+	../Observer/libcodepatterns-Observer-debug.la \
+	../Helpers/libcodepatterns-Helpers-debug.la
+
+#AUTOMAKE_OPTIONS = parallel-tests
Index: ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,243 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ObservedContainerTest.cpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <map>
+
+#include "CodePatterns/Assert.hpp"
+
+#include <iostream>
+
+#include "stubs/ObserverStub.hpp"
+#include "CodePatterns/Observer/ObservedContainer.hpp"
+#include "CodePatterns/Observer/ObservedContainer_impl.hpp"
+#include "CodePatterns/Observer/ObservedIterator.hpp"
+#include "CodePatterns/Observer/UnobservedIterator.hpp"
+
+#include "ObservedContainerUnitTest.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( ObservedContainerTest );
+
+/******************* Test stubs ************************/
+
+
+/******************* actuall tests ***************/
+
+void ObservedContainerTest::setUp() {
+  ASSERT_DO(Assert::Throw);
+  simpleObservable1 = new SimpleObservable();
+}
+
+void ObservedContainerTest::tearDown() {
+  delete simpleObservable1;
+}
+
+void ObservedContainerTest::IteratorMapTest()
+{
+  typedef ObservedContainer< std::map<int, int>, ObservedIterator<std::map<int, int> > > OC;
+  OC OContainer(simpleObservable1);
+  int i;
+
+  OContainer.insert( std::pair<int,int> (1,1) );
+  OContainer.insert( std::pair<int,int> (2,2) );
+
+  i=0;
+  for (OC::internal_iterator iter = OContainer.begin_internal(); iter != OContainer.end_internal(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=0;
+  for (OC::iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=0;
+  for (OC::const_iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=3;
+  for (OC::reverse_internal_iterator iter = OContainer.rbegin_internal(); iter != OContainer.rend_internal(); ++iter) {
+    i--;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+
+  /* @todo TODO: Check whether dereferencing ObservedContainer::reverse_iterator
+   *  is working now.
+   * I am quite convinced that the reason for us having to use a
+   * const_reverse_iterator below is in stl_iterator.h, where operator* is
+   * implemented with a temporary _Iterator that is returned, i.e. a
+   * temporary object and we are not allowed to dereference from this
+   * temporary object.
+   */
+  i=3;
+  for (OC::reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+    i--;
+    OC::const_reverse_iterator helper = iter;
+    CPPUNIT_ASSERT_EQUAL(i, helper->first);
+    CPPUNIT_ASSERT_EQUAL(i, helper->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+
+  i=3;
+  for (OC::const_reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+    i--;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+}
+
+void ObservedContainerTest::IteratorMapNotObservedTest()
+{
+  typedef ObservedContainer< std::map<int, int>, UnobservedIterator<std::map<int, int> > > OC;
+  OC OContainer(simpleObservable1);
+  int i;
+
+  OContainer.insert( std::pair<int,int> (1,1) );
+  OContainer.insert( std::pair<int,int> (2,2) );
+
+  i=0;
+  for (OC::internal_iterator iter = OContainer.begin_internal(); iter != OContainer.end_internal(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=0;
+  for (OC::iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=0;
+  for (OC::const_iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+    i++;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,2);
+
+  i=3;
+  for (OC::reverse_internal_iterator iter = OContainer.rbegin_internal(); iter != OContainer.rend_internal(); ++iter) {
+    i--;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+
+  /* @todo TODO: Check whether dereferencing ObservedContainer::reverse_iterator
+   *  is working now.
+   * I am quite convinced that the reason for us having to use a
+   * const_reverse_iterator below is in stl_iterator.h, where operator* is
+   * implemented with a temporary _Iterator that is returned, i.e. a
+   * temporary object and we are not allowed to dereference from this
+   * temporary object.
+   */
+  i=3;
+  for (OC::reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+    i--;
+    OC::const_reverse_iterator helper = iter;
+    CPPUNIT_ASSERT_EQUAL(i, helper->first);
+    CPPUNIT_ASSERT_EQUAL(i, helper->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+
+  i=3;
+  for (OC::const_reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+    i--;
+    CPPUNIT_ASSERT_EQUAL(i, iter->first);
+    CPPUNIT_ASSERT_EQUAL(i, iter->second);
+  }
+  CPPUNIT_ASSERT_EQUAL(i,1);
+}
+
+// @todo TODO: Check whether ObservedContainer with sets not maps is working now
+void ObservedContainerTest::IteratorSetTest()
+{
+//  typedef ObservedContainer< std::set<int>, ObservedIterator<std::set<int> > > OC;
+//  OC OContainer(simpleObservable1);
+//  int i;
+//
+//  OContainer.insert(1);
+//  OContainer.insert(2);
+//
+//  i=0;
+//  for (OC::internal_iterator iter = OContainer.begin_internal(); iter != OContainer.end_internal(); ++iter) {
+//    i++;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,2);
+//
+//  i=0;
+//  for (OC::iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+//    i++;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,2);
+//
+//  i=0;
+//  for (OC::const_iterator iter = OContainer.begin(); iter != OContainer.end(); ++iter) {
+//    i++;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,2);
+//
+//  i=3;
+//  for (OC::reverse_internal_iterator iter = OContainer.rbegin_internal(); iter != OContainer.rend_internal(); ++iter) {
+//    i--;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,1);
+//
+//  i=3;
+//  for (OC::reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+//    i--;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,1);
+//
+//  i=3;
+//  for (OC::const_reverse_iterator iter = OContainer.rbegin(); iter != OContainer.rend(); ++iter) {
+//    i--;
+//    CPPUNIT_ASSERT_EQUAL(i, *iter);
+//  }
+//  CPPUNIT_ASSERT_EQUAL(i,1);
+}
Index: ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.hpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/ObservedContainerUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,49 @@
+/*
+ * ObservedContainerTest.hpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+#ifndef OBSERVEDCONTAINERTEST_HPP_
+#define OBSERVEDCONTAINERTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+// forward declaration for test stubs
+class UpdateCountObservedContainer;
+class NotificationObservedContainer;
+class SimpleObservable;
+class CallObservable;
+class SuperObservable;
+class ObservableSet;
+class ObservableMap;
+class BlockObservable;
+class NotificationObservable;
+
+class ObservedContainerTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( ObservedContainerTest ) ;
+  CPPUNIT_TEST ( IteratorMapTest );
+  CPPUNIT_TEST ( IteratorMapNotObservedTest );
+  CPPUNIT_TEST ( IteratorSetTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void IteratorMapTest();
+  void IteratorMapNotObservedTest();
+  void IteratorSetTest();
+
+private:
+  SimpleObservable *simpleObservable1;
+};
+
+#endif /* OBSERVEDCONTAINERTEST_HPP_ */
Index: ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,358 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ObserverTest.cpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <set>
+
+#include "CodePatterns/Assert.hpp"
+
+#include <iostream>
+
+#include "stubs/ObserverStub.hpp"
+#include "CodePatterns/Observer/Notification.hpp"
+#include "CodePatterns/Observer/ObservedContainer.hpp"
+#include "CodePatterns/Observer/ObservedContainer_impl.hpp"
+#include "CodePatterns/Observer/ObserverLog.hpp"
+
+#include "ObserverUnitTest.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( ObserverTest );
+
+/******************* Test stubs ************************/
+
+
+/******************* actuall tests ***************/
+
+void ObserverTest::setUp() {
+  ASSERT_DO(Assert::Throw);
+
+  simpleObservable1 = new SimpleObservable();
+  simpleObservable2 = new SimpleObservable();
+  callObservable = new CallObservable();
+  superObservable = new SuperObservable();
+  blockObservable = new BlockObservable();
+  notificationObservable = new NotificationObservable();
+  obsset = new ObservableSet(5);
+  obsmap = new ObservableMap(5);
+
+  observer1 = new UpdateCountObserver();
+  observer2 = new UpdateCountObserver();
+  observer3 = new UpdateCountObserver();
+  observer4 = new UpdateCountObserver();
+
+  notificationObserver1 = new NotificationObserver(
+      notificationObservable->getChannel(NotificationObservable::Operation1Notify));
+  notificationObserver2 = new NotificationObserver(
+      notificationObservable->getChannel(NotificationObservable::Operation2Notify));
+
+  RelayObservable = new RelayTest;
+  RelayObserver = new RelayCountObserver(RelayObservable);
+
+  RelayNotifier = new RelayNotification;
+  RelayNotified = new RelayNotificationObserver(RelayObservable);
+}
+
+void ObserverTest::tearDown() {
+  delete simpleObservable1;
+  delete simpleObservable2;
+  delete callObservable;
+  delete superObservable;
+  delete blockObservable;
+  delete notificationObservable;
+  delete obsset;
+  delete obsmap;
+  delete RelayObservable;
+  delete RelayObserver;
+  delete RelayNotifier;
+  delete RelayNotified;
+
+  delete observer1;
+  delete observer2;
+  delete observer3;
+  delete observer4;
+  delete notificationObserver1;
+  delete notificationObserver2;
+#ifdef LOG_OBSERVER
+  ObserverLog::purgeInstance();
+#endif
+}
+
+void ObserverTest::doesUpdateTest()
+{
+  simpleObservable1->signOn(observer1);
+  simpleObservable1->signOn(observer2);
+  simpleObservable1->signOn(observer3);
+
+  simpleObservable2->signOn(observer2);
+  simpleObservable2->signOn(observer4);
+
+  CPPUNIT_ASSERT_EQUAL( 0, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer2->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer3->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer4->updates );
+
+
+  simpleObservable1->changeMethod();
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer2->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer3->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer4->updates );
+
+  simpleObservable1->signOff(observer3);
+
+  simpleObservable1->changeMethod();
+  CPPUNIT_ASSERT_EQUAL( 2, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 2, observer2->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer3->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer4->updates );
+
+  simpleObservable2->changeMethod();
+  CPPUNIT_ASSERT_EQUAL( 2, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 3, observer2->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer3->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer4->updates );
+}
+
+
+void ObserverTest::doesBlockUpdateTest() {
+  callObservable->signOn(observer1);
+  CPPUNIT_ASSERT_EQUAL( 0, observer1->updates );
+
+  callObservable->changeMethod1();
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+
+  callObservable->changeMethod2();
+  CPPUNIT_ASSERT_EQUAL( 2, observer1->updates );
+}
+
+void ObserverTest::doesSubObservableTest() {
+  superObservable->signOn(observer1);
+  superObservable->subObservable->signOn(observer2);
+
+  superObservable->subObservable->changeMethod();
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer2->updates );
+
+  superObservable->changeMethod();
+  CPPUNIT_ASSERT_EQUAL( 2, observer1->updates );
+  CPPUNIT_ASSERT_EQUAL( 2, observer2->updates );
+}
+
+void ObserverTest::outsideLockTest(){
+  callObservable->signOn(observer1);
+  CPPUNIT_ASSERT_EQUAL( 0, observer1->updates );
+
+  {
+    LOCK_OBSERVABLE(*callObservable);
+    CPPUNIT_ASSERT_EQUAL( 0, observer1->updates );
+  }
+  // lock is gone now, observer should have notified
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+}
+
+void ObserverTest::doesNotifyTest(){
+  notificationObservable->signOn(notificationObserver1, NotificationObservable::Operation1Notify);
+  notificationObservable->signOn(notificationObserver2, NotificationObservable::Operation2Notify);
+
+  notificationObservable->operation1();
+  CPPUNIT_ASSERT(notificationObserver1->wasNotified);
+  CPPUNIT_ASSERT(!notificationObserver2->wasNotified);
+
+  notificationObserver1->wasNotified=false;
+
+  notificationObservable->operation2();
+  CPPUNIT_ASSERT(!notificationObserver1->wasNotified);
+  CPPUNIT_ASSERT(notificationObserver2->wasNotified);
+}
+
+void ObserverTest::doesReportTest(){
+  // Actual checks are in the Stub-methods for this
+  blockObservable->changeMethod1();
+  blockObservable->changeMethod2();
+  blockObservable->noChangeMethod();
+}
+
+void ObserverTest::iteratorTest(){
+  int i = 0;
+  // test the general iterator methods
+  for(ObservableSet::iterator iter=obsset->begin(); iter!=obsset->end();++iter){
+    CPPUNIT_ASSERT(i< obsset->num);
+    i++;
+  }
+
+  i=0;
+  for(ObservableSet::const_iterator iter=obsset->begin(); iter!=obsset->end();++iter){
+    CPPUNIT_ASSERT(i<obsset->num);
+    i++;
+  }
+
+  obsset->signOn(observer1);
+  {
+    // we construct this out of the loop, so the iterator dies at the end of
+    // the scope and not the end of the loop (allows more testing)
+    ObservableSet::iterator iter;
+    for(iter=obsset->begin(); iter!=obsset->end(); ++iter){
+      (*iter)->changeMethod();
+    }
+    // At this point no change should have been propagated
+    CPPUNIT_ASSERT_EQUAL( 0, observer1->updates);
+  }
+  // After the Iterator has died the propagation should take place
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
+
+  // when using a const_iterator no changes should be propagated
+  for(ObservableSet::const_iterator iter = obsset->begin(); iter!=obsset->end();++iter);
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
+
+  // we need to test the operator-> as well
+  obsmap->signOn(observer2);
+  {
+    // we construct this out of the loop, so the iterator dies at the end of
+    // the scope and not the end of the loop (allows more testing)
+    ObservableMap::iterator iter;
+    for(iter=obsmap->begin(); iter!=obsmap->end(); ++iter){
+      iter->second->changeMethod();
+    }
+    // At this point no change should have been propagated
+    CPPUNIT_ASSERT_EQUAL( 0, observer2->updates);
+  }
+  // After the Iterator has died the propagation should take place
+  CPPUNIT_ASSERT_EQUAL( 1, observer2->updates);
+
+  obsset->signOff(observer1);
+  obsmap->signOff(observer2);
+}
+
+void ObserverTest::relayTest()
+{
+  // sign on some observables to the relay
+  simpleObservable1->signOn(RelayObservable);
+  simpleObservable2->signOn(RelayObservable);
+
+  // sign on an observer to the relay
+  RelayObservable->signOn(RelayObserver);
+  simpleObservable1->signOn(observer1);
+
+  // check that all is zero
+  CPPUNIT_ASSERT_EQUAL( 0, RelayObserver->updates );
+  CPPUNIT_ASSERT_EQUAL( 0, observer1->updates );
+
+  // signal update
+  simpleObservable1->changeMethod();
+
+  // check that both the change
+  // (and RelayObserver checks being called correctly)
+  CPPUNIT_ASSERT_EQUAL( 1, RelayObserver->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+
+  // signal update through relay only
+  simpleObservable2->changeMethod();
+
+  // check that only one got the change
+  CPPUNIT_ASSERT_EQUAL( 2, RelayObserver->updates );
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates );
+
+  // check on signOff
+  simpleObservable1->signOff(RelayObservable);
+  simpleObservable1->signOff(observer1);
+}
+
+void ObserverTest::relayNotificationTest()
+{
+  observerLog().enableLogging();
+
+  // sign on some observables to the relay
+  notificationObservable->signOn(RelayNotifier, NotificationObservable::Operation1Notify);
+  notificationObservable->signOn(RelayNotifier, NotificationObservable::Operation2Notify);
+  notificationObservable->signOn(notificationObserver1, NotificationObservable::Operation1Notify);
+
+  RelayNotifier->signOn(RelayNotified, NotificationObservable::Operation1Notify);
+
+  // operation1
+  notificationObservable->operation1();
+  CPPUNIT_ASSERT(RelayNotified->wasNotified);
+  CPPUNIT_ASSERT(notificationObserver1->wasNotified);
+
+  RelayNotified->wasNotified=false;
+  notificationObserver1->wasNotified=false;
+
+  // operation2
+  notificationObservable->operation2();
+  CPPUNIT_ASSERT(!RelayNotified->wasNotified);
+  CPPUNIT_ASSERT(!notificationObserver1->wasNotified);
+
+  // signOff relay from 1 and operation1
+  notificationObserver1->wasNotified=false;
+  notificationObservable->signOff(RelayNotifier, NotificationObservable::Operation1Notify);
+
+  notificationObservable->operation1();
+  CPPUNIT_ASSERT(!RelayNotified->wasNotified);
+  CPPUNIT_ASSERT(notificationObserver1->wasNotified);
+
+  // test kill subject
+  RelayNotifier->signOff(RelayNotified, NotificationObservable::Operation1Notify);
+  delete RelayNotified;
+  RelayNotified = NULL; // delete in tearDown is allowed for NULL
+  notificationObservable->operation1();
+  notificationObservable->signOff(RelayNotifier, NotificationObservable::Operation2Notify);
+  delete notificationObservable;
+  notificationObservable = NULL; // delete in tearDown is allowed for NULL
+
+  observerLog().disableLogging();
+}
+
+void ObserverTest::CircleDetectionTest() {
+  std::cout << std::endl << "Warning: the next test involved methods that can produce infinite loops." << std::endl;
+  std::cout << "Errors in this methods can not be checked using the CPPUNIT_ASSERT Macros." << std::endl;
+  std::cout << "Instead tests are run on these methods to see if termination is assured" << std::endl << std::endl;
+  std::cout << "If this test does not complete in a few seconds, kill the test-suite and fix the Error in the circle detection mechanism" << std::endl;
+
+  std::cout << std::endl << std::endl << "The following errors displayed by the observer framework can be ignored" << std::endl;
+
+  // make this Observable its own subject. NEVER DO THIS IN ACTUAL CODE
+  simpleObservable1->signOn(simpleObservable1);
+#ifndef NDEBUG
+  CPPUNIT_ASSERT_THROW(simpleObservable1->changeMethod(),Assert::AssertionFailure);
+#else
+  simpleObservable1->changeMethod();
+#endif
+
+  // more complex test
+  simpleObservable1->signOff(simpleObservable1);
+  simpleObservable1->signOn(simpleObservable2);
+  simpleObservable2->signOn(simpleObservable1);
+#ifndef NDEBUG
+  CPPUNIT_ASSERT_THROW(simpleObservable1->changeMethod(),Assert::AssertionFailure);
+#else
+  simpleObservable1->changeMethod();
+#endif
+
+
+  simpleObservable1->signOff(simpleObservable2);
+  simpleObservable2->signOff(simpleObservable1);
+  // when we reach this line, although we broke the DAG assumption the circle check works fine
+  CPPUNIT_ASSERT(true);
+}
Index: ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.hpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/ObserverUnitTest.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,86 @@
+/*
+ * ObserverTest.hpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+#ifndef OBSERVERTEST_HPP_
+#define OBSERVERTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+// forward declaration for test stubs
+class UpdateCountObserver;
+class NotificationObserver;
+class SimpleObservable;
+class CallObservable;
+class SuperObservable;
+class ObservableSet;
+class ObservableMap;
+class RelayObservable;
+class BlockObservable;
+class NotificationObservable;
+class RelayCountObserver;
+class RelayNotification;
+class RelayNotificationObserver;
+
+class ObserverTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( ObserverTest ) ;
+  CPPUNIT_TEST ( doesUpdateTest );
+  CPPUNIT_TEST ( doesBlockUpdateTest );
+  CPPUNIT_TEST ( doesSubObservableTest );
+  CPPUNIT_TEST ( outsideLockTest );
+  CPPUNIT_TEST ( doesNotifyTest );
+  CPPUNIT_TEST ( doesReportTest );
+  CPPUNIT_TEST ( iteratorTest );
+  CPPUNIT_TEST ( relayTest );
+  CPPUNIT_TEST ( relayNotificationTest );
+  CPPUNIT_TEST ( CircleDetectionTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void doesUpdateTest();
+  void doesBlockUpdateTest();
+  void doesSubObservableTest();
+  void outsideLockTest();
+  void doesNotifyTest();
+  void doesReportTest();
+  void iteratorTest();
+  void relayTest();
+  void relayNotificationTest();
+  void CircleDetectionTest();
+
+private:
+  UpdateCountObserver *observer1;
+  UpdateCountObserver *observer2;
+  UpdateCountObserver *observer3;
+  UpdateCountObserver *observer4;
+
+  NotificationObserver *notificationObserver1;
+  NotificationObserver *notificationObserver2;
+
+  SimpleObservable *simpleObservable1;
+  SimpleObservable *simpleObservable2;
+  CallObservable *callObservable;
+  BlockObservable *blockObservable;
+  SuperObservable *superObservable;
+  NotificationObservable *notificationObservable;
+  ObservableSet *obsset;
+  ObservableMap *obsmap;
+  RelayTest *RelayObservable;
+  RelayCountObserver *RelayObserver;
+  RelayNotification *RelayNotifier;
+  RelayNotificationObserver *RelayNotified;
+};
+
+#endif /* OBSERVERTEST_HPP_ */
Index: ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,293 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ObserverStub.cpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "ObserverStub.hpp"
+
+#include "CodePatterns/Observer/Channels.hpp"
+#include "CodePatterns/Observer/Notification.hpp"
+
+/************ UpdateCountObserver **************/
+
+UpdateCountObserver::UpdateCountObserver() :
+  Observer("UpdateCountObserver"),
+  updates(0)
+{};
+
+UpdateCountObserver::~UpdateCountObserver()
+{}
+
+void UpdateCountObserver::update(Observable *publisher){
+  updates++;
+}
+
+void UpdateCountObserver::subjectKilled(Observable *publisher) {
+}
+
+/*************** SimpleObservable **************/
+
+SimpleObservable::SimpleObservable() :
+  Observable("SimpleObservable")
+{}
+
+void SimpleObservable::changeMethod() {
+  OBSERVE;
+  int i = 0;
+  i++;
+}
+
+/************** CallObservable *****************/
+
+CallObservable::CallObservable() :
+  Observable("CallObservable")
+{}
+
+void CallObservable::changeMethod1() {
+  OBSERVE;
+  int i = 0;
+  i++;
+}
+
+void CallObservable::changeMethod2() {
+  OBSERVE;
+  int i = 0;
+  i++;
+  changeMethod1();
+}
+
+/************* BlockObservable *****************/
+
+BlockObservable::BlockObservable() :
+  Observable("BlockObservable")
+{}
+
+void BlockObservable::changeMethod1(){
+  OBSERVE;
+  // test if we report correctly as blocked
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::changeMethod2(){
+  OBSERVE;
+  internalMethod1();
+  internalMethod2();
+}
+
+void BlockObservable::internalMethod1(){
+  // we did not block, but our caller did...
+  // see if this is found
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::internalMethod2(){
+  OBSERVE;
+  // Both this method and the caller do block
+  // Does the reporting still work as expected?
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::noChangeMethod(){
+  // No Block introduced here
+  // reported correctely?
+  CPPUNIT_ASSERT(!isBlocked());
+}
+
+/*************** SuperObservable ***************/
+
+SuperObservable::SuperObservable():
+  Observable("SuperObservable")
+{
+  subObservable = new SimpleObservable();
+  subObservable->signOn(this);
+}
+SuperObservable::~SuperObservable(){
+  delete subObservable;
+}
+void SuperObservable::changeMethod() {
+  OBSERVE;
+  int i = 0;
+  i++;
+  subObservable->changeMethod();
+}
+
+/************* NotificationObservable **********/
+
+NotificationObservable::NotificationObservable() :
+  Observable("NotificationObservable")
+{
+  Channels *OurChannel = new Channels();
+  Observable::insertNotificationChannel( std::make_pair(this, OurChannel) );
+  OurChannel->addChannel(Operation1Notify);
+  OurChannel->addChannel(Operation2Notify);
+}
+
+NotificationObservable::~NotificationObservable()
+{
+  Observable::eraseNotificationChannel(this);
+}
+
+void NotificationObservable::operation1(){
+  OBSERVE;
+  NOTIFY(Operation1Notify);
+}
+
+void NotificationObservable::operation2(){
+  OBSERVE;
+  NOTIFY(Operation2Notify);
+}
+
+/*********** NotificationObserver **************/
+
+NotificationObserver::NotificationObserver(Notification_ptr notification) :
+  Observer("NotificationObserver"),
+  requestedNotification(notification),
+  wasNotified(false)
+{}
+
+NotificationObserver::~NotificationObserver()
+{}
+
+void NotificationObserver::update(Observable*){}
+void NotificationObserver::subjectKilled(Observable*){}
+void NotificationObserver::recieveNotification(Observable *publisher, Notification_ptr notification){
+  CPPUNIT_ASSERT(requestedNotification==notification);
+  wasNotified = true;
+}
+
+/**************** ObservableSet ****************/
+
+ObservableSet::ObservableSet(int _num) :
+  Observable("ObservableCollection"),
+  num(_num)
+{
+  for(int i=0; i<num; ++i){
+    SimpleObservable *content = new SimpleObservable();
+    content->signOn(this);
+    theSet.insert(content);
+  }
+}
+
+ObservableSet::~ObservableSet(){
+  set::iterator iter;
+  for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+    delete (*iter);
+  }
+}
+
+ObservableSet::iterator ObservableSet::begin(){
+  return iterator(theSet.begin(),this);
+}
+
+ObservableSet::iterator ObservableSet::end(){
+  return iterator(theSet.end(),this);
+}
+
+/************** ObservableMap ******************/
+
+ObservableMap::ObservableMap(int _num) :
+  Observable("ObservableCollection"),
+  num(_num)
+{
+  for(int i=0; i<num; ++i){
+    SimpleObservable *content = new SimpleObservable();
+    content->signOn(this);
+    theSet.insert(std::make_pair(i,content));
+  }
+}
+
+ObservableMap::~ObservableMap(){
+  set::iterator iter;
+  for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+    delete iter->second;
+  }
+}
+
+ObservableMap::iterator ObservableMap::begin(){
+  return iterator(theSet.begin(),this);
+}
+
+ObservableMap::iterator ObservableMap::end(){
+  return iterator(theSet.end(),this);
+}
+
+/****************** Relay *********************/
+
+RelayTest::RelayTest() :
+    Relay(std::string("RelayTest"))
+{}
+
+RelayTest::~RelayTest()
+{}
+
+/************ RelayNotification ***************/
+
+RelayNotification::RelayNotification() :
+    Relay(std::string("RelayTest"))
+{
+  Channels *OurChannel = new Channels();
+  Observable::insertNotificationChannel( std::make_pair(this, OurChannel) );
+  OurChannel->addChannel(NotificationObservable::Operation1Notify);
+  OurChannel->addChannel(NotificationObservable::Operation2Notify);
+}
+
+RelayNotification::~RelayNotification()
+{}
+
+/************ RelayCountObserver ***************/
+
+RelayCountObserver::RelayCountObserver(const Observable * const _relay) :
+    Observer("RelayCountObserver"),
+    updates(0),
+    relay(_relay)
+{}
+
+RelayCountObserver::~RelayCountObserver()
+{}
+
+void RelayCountObserver::update(Observable *publisher){
+  // check that we are not called by the relay itself
+  CPPUNIT_ASSERT(publisher != relay);
+  updates++;
+}
+
+void RelayCountObserver::subjectKilled(Observable *publisher) {
+}
+
+/********* RelayNotificationObserver ***********/
+
+RelayNotificationObserver::RelayNotificationObserver(const Observable * const _relay) :
+  Observer("RelayNotificationObserver"),
+  wasNotified(false),
+  relay(_relay)
+{}
+
+RelayNotificationObserver::~RelayNotificationObserver()
+{}
+
+void RelayNotificationObserver::update(Observable*){}
+void RelayNotificationObserver::subjectKilled(Observable*){}
+void RelayNotificationObserver::recieveNotification(Observable *publisher, Notification_ptr notification){
+  // check that we are not called by the relay itself
+  CPPUNIT_ASSERT(publisher != relay);
+  wasNotified = true;
+}
+
Index: ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,172 @@
+/*
+ * ObserverStub.hpp
+ *
+ *  Created on: Jan 16, 2011
+ *      Author: heber
+ */
+
+#ifndef OBSERVERSTUB_HPP_
+#define OBSERVERSTUB_HPP_
+
+#include "CodePatterns/Observer/Observer.hpp"
+#include "CodePatterns/Observer/Observable.hpp"
+#include "CodePatterns/Observer/ObservedIterator.hpp"
+#include "CodePatterns/Observer/Relay.hpp"
+
+class UpdateCountObserver : public Observer {
+public:
+  UpdateCountObserver();
+  virtual ~UpdateCountObserver();
+
+  void update(Observable *publisher);
+  void subjectKilled(Observable *publisher);
+
+  int updates;
+};
+
+class SimpleObservable : public Observable {
+public:
+  SimpleObservable();
+
+  void changeMethod();
+};
+
+class CallObservable : public Observable {
+public:
+  CallObservable();
+
+  void changeMethod1();
+  void changeMethod2();
+};
+
+class BlockObservable : public Observable {
+public:
+  BlockObservable();
+
+  void changeMethod1();
+  void changeMethod2();
+
+  void internalMethod1();
+  void internalMethod2();
+
+  void noChangeMethod();
+};
+
+class SuperObservable : public Observable {
+public:
+  SuperObservable();
+  virtual ~SuperObservable();
+
+  void changeMethod();
+
+  SimpleObservable *subObservable;
+};
+
+class NotificationObservable : public Observable {
+public:
+  NotificationObservable();
+  virtual ~NotificationObservable();
+
+  enum NotificationType {
+    Operation1Notify = 0,
+    Operation2Notify = 1
+  };
+
+  void operation1();
+  void operation2();
+};
+
+class NotificationObserver : public Observer {
+public:
+  NotificationObserver(Notification_ptr notification);
+  virtual ~NotificationObserver();
+
+  void update(Observable*);
+  void subjectKilled(Observable*);
+  void recieveNotification(Observable *publisher, Notification_ptr notification);
+
+  Notification_ptr requestedNotification;
+
+  bool wasNotified;
+};
+
+class ObservableSet : public Observable {
+public:
+  typedef std::set<SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+  typedef set::const_iterator const_iterator;
+
+  ObservableSet(int _num);
+  virtual ~ObservableSet();
+
+  iterator begin();
+  iterator end();
+
+  const int num;
+
+private:
+  set theSet;
+};
+
+class ObservableMap : public Observable {
+public:
+  typedef std::map<int,SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+  typedef set::const_iterator const_iterator;
+
+  ObservableMap(int _num);
+  virtual ~ObservableMap();
+
+  iterator begin();
+  iterator end();
+
+  const int num;
+
+private:
+  set theSet;
+};
+
+class RelayTest : public Relay
+{
+public:
+  RelayTest();
+  ~RelayTest();
+private:
+};
+
+class RelayCountObserver : public Observer {
+public:
+  RelayCountObserver(const Observable * const relay);
+  virtual ~RelayCountObserver();
+
+  void update(Observable *publisher);
+  void subjectKilled(Observable *publisher);
+
+  int updates;
+private:
+  const Observable * const relay;
+};
+
+class RelayNotification : public Relay
+{
+public:
+  RelayNotification();
+  ~RelayNotification();
+private:
+};
+
+class RelayNotificationObserver : public Observer {
+public:
+  RelayNotificationObserver(const Observable * const _relay);
+  virtual ~RelayNotificationObserver();
+
+  void update(Observable*);
+  void subjectKilled(Observable*);
+  void recieveNotification(Observable *publisher, Notification_ptr notification);
+
+  bool wasNotified;
+private:
+  const Observable * const relay;
+};
+
+#endif /* OBSERVERSTUB_HPP_ */
