Index: src/Fragmentation/Automation/unittests/Makefile.am
===================================================================
--- src/Fragmentation/Automation/unittests/Makefile.am	(revision edbf88b839d69b6e01bba6c317710295d1c45d26)
+++ src/Fragmentation/Automation/unittests/Makefile.am	(revision 5d8c0f3e6cd2a623237358cf3c11d644a2aaf86c)
@@ -9,6 +9,7 @@
   unittests/MPQCDataUnitTest.cpp \
   unittests/SystemCommandJobUnitTest.cpp \
-  unittests/WorkerAddressUnitTest.cpp
-
+  unittests/WorkerAddressUnitTest.cpp \
+  unittests/WorkerPoolUnitTest.cpp
+  
 FRAGMENTATIONAUTOMATIONTESTSHEADERS = \
   unittests/FragmentJobUnitTest.hpp \
@@ -18,5 +19,6 @@
   unittests/MPQCDataUnitTest.hpp \
   unittests/SystemCommandJobUnitTest.hpp \
-  unittests/WorkerAddressUnitTest.hpp
+  unittests/WorkerAddressUnitTest.hpp \
+  unittests/WorkerPoolUnitTest.hpp
 
 FRAGMENTATIONAUTOMATIONTESTS = \
@@ -27,5 +29,6 @@
   MPQCDataUnitTest \
   SystemCommandJobUnitTest \
-  WorkerAddressUnitTest
+  WorkerAddressUnitTest \
+  WorkerPoolUnitTest
 
 
@@ -137,3 +140,17 @@
   ${CodePatterns_LIBS}
 
+WorkerPoolUnitTest_LDFLAGS = ${CodePatterns_LIBS} $(CPPUNIT_LIBS) -ldl
+WorkerPoolUnitTest_CPPFLAGS = ${BOOST_CPPFLAGS} $(CPPUNIT_CFLAGS) ${CodePatterns_CFLAGS}
+WorkerPoolUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+  unittests/WorkerPoolUnitTest.cpp \
+  unittests/WorkerPoolUnitTest.hpp \
+  Pool/WorkerPool.cpp \
+  Pool/WorkerPool.hpp \
+  WorkerAddress.cpp \
+  WorkerAddress.hpp
+WorkerPoolUnitTest_LDADD = \
+  $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \
+  $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) \
+  ${CodePatterns_LIBS}
+
 #AUTOMAKE_OPTIONS = parallel-tests
Index: src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.cpp
===================================================================
--- src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.cpp	(revision 5d8c0f3e6cd2a623237358cf3c11d644a2aaf86c)
+++ src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.cpp	(revision 5d8c0f3e6cd2a623237358cf3c11d644a2aaf86c)
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+/*
+ * WorkerPoolUnitTest.cpp
+ *
+ *  Created on: Feb 28, 2012
+ *      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 "WorkerPoolUnitTest.hpp"
+
+#include <vector>
+
+#include "CodePatterns/Assert.hpp"
+#include "Pool/WorkerPool.hpp"
+#include "WorkerAddress.hpp"
+
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+/********************************************** Test classes **************************************/
+
+#include "stubs/FragmentJobStub.hpp"
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( WorkerPoolTest );
+
+
+void WorkerPoolTest::setUp()
+{
+  // Throw assertions
+  ASSERT_DO(Assert::Throw);
+
+  pool = new WorkerPool();
+}
+
+void WorkerPoolTest::tearDown()
+{
+  delete pool;
+}
+
+/** UnitTest for working add/removeWorker
+ */
+void WorkerPoolTest::WorkerTest()
+{
+  WorkerAddress address("service", "port");
+  WorkerAddress otheraddress("otherservice", "otherport");
+
+  // add worker
+  CPPUNIT_ASSERT( pool->addWorker(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->pool.size() );
+
+  // remove non-present worker
+  std::cout << "The following error message is intended and does not indicate a failure." << std::endl;
+  CPPUNIT_ASSERT( !pool->removeWorker(otheraddress) );
+
+  // check for presence
+  CPPUNIT_ASSERT( pool->presentInPool(address) );
+  CPPUNIT_ASSERT( !pool->presentInPool(otheraddress) );
+
+  // remove worker
+  CPPUNIT_ASSERT( pool->removeWorker(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->pool.size() );
+}
+
+/** UnitTest for working (un)markWorkerBusy
+ */
+void WorkerPoolTest::markBusyTest()
+{
+  WorkerAddress address("service", "port");
+  CPPUNIT_ASSERT( pool->addWorker(address) );
+
+  // check that not busy
+  CPPUNIT_ASSERT( !pool->isWorkerBusy(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->pool.size() );
+
+  // unmark and check
+  pool->unmarkWorkerBusy(address);
+  CPPUNIT_ASSERT( !pool->isWorkerBusy(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() );
+
+  // mark as busy and check
+  const WorkerAddress otheraddress = pool->getNextIdleWorker();
+  CPPUNIT_ASSERT( pool->isWorkerBusy(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->busy_queue.size() );
+
+  // get one more
+  CPPUNIT_ASSERT( !pool->presentIdleWorkers() );
+#ifndef NDEBUG
+  std::cout << "The following assertion is intended and does not indicate a failure." << std::endl;
+  CPPUNIT_ASSERT_THROW( pool->getNextIdleWorker(), Assert::AssertionFailure );
+#else
+  const WorkerAddress emptyAddress = pool->getNextIdleWorker();
+#endif
+  CPPUNIT_ASSERT( pool->isWorkerBusy(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->busy_queue.size() );
+
+  // unmark and check
+  pool->unmarkWorkerBusy(address);
+  CPPUNIT_ASSERT( !pool->isWorkerBusy(address) );
+  CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->idle_queue.size() );
+  CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() );
+}
Index: src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.hpp
===================================================================
--- src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.hpp	(revision 5d8c0f3e6cd2a623237358cf3c11d644a2aaf86c)
+++ src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.hpp	(revision 5d8c0f3e6cd2a623237358cf3c11d644a2aaf86c)
@@ -0,0 +1,40 @@
+/*
+ * WorkerPoolUnitTest.hpp
+ *
+ *  Created on: Feb 28, 2012
+ *      Author: heber
+ */
+
+#ifndef WORKERPOOLUNITTEST_HPP_
+#define WORKERPOOLUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+class WorkerPool;
+
+/********************************************** Test classes **************************************/
+
+class WorkerPoolTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( WorkerPoolTest) ;
+    CPPUNIT_TEST ( WorkerTest );
+    CPPUNIT_TEST ( markBusyTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void WorkerTest();
+      void markBusyTest();
+
+private:
+      WorkerPool *pool;
+};
+
+#endif /* WORKERPOOLUNITTEST_HPP_ */
