package com.bazaarvoice.zookeeper.dropwizard;

import com.bazaarvoice.zookeeper.ZooKeeperConnection;
import org.junit.Test;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class ManagedZooKeeperConnectionTest {
    @Test(expected = NullPointerException.class)
    public void testNullConnection() {
        new ManagedZooKeeperConnection(null);
    }

    @Test
    public void testClosesOnStop() throws Exception {
        ZooKeeperConnection zookeeper = mock(ZooKeeperConnection.class);

        ManagedZooKeeperConnection managed = new ManagedZooKeeperConnection(zookeeper);
        managed.stop();

        verify(zookeeper).close();
    }
}

package com.bazaarvoice.zookeeper.dropwizard;

import com.bazaarvoice.zookeeper.ZooKeeperConnection;
import org.junit.Test;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class ManagedZooKeeperConnectionTest {
    @Test
    public void testClosesOnStop() throws Exception {
        ZooKeeperConnection zookeeper = mock(ZooKeeperConnection.class);

        ManagedZooKeeperConnection managed = new ManagedZooKeeperConnection(zookeeper);
        managed.stop();

        verify(zookeeper).close();
    }
}

--- 
+++ 
@@ -7,6 +7,11 @@
 import static org.mockito.Mockito.verify;
 
 public class ManagedZooKeeperConnectionTest {
+    @Test(expected = NullPointerException.class)
+    public void testNullConnection() {
+        new ManagedZooKeeperConnection(null);
+    }
+
     @Test
     public void testClosesOnStop() throws Exception {
         ZooKeeperConnection zookeeper = mock(ZooKeeperConnection.class);
Add test for null connection.
