Buggy code:
public class ZkCloudnameTest { private static Logger log = Logger . getLogger ( ZkCloudnameTest . class . getName ( ) ) ; private EmbeddedZooKeeper ezk ; private ZooKeeper zk ; private int zkport ; private PortForwarder forwarder ; private int forwarderPort ; private ZkCloudname cn = null ; private ServiceHandle serviceHandle ; @ Rule public TemporaryFolder temp = new TemporaryFolder ( ) ; @ Before public void setup ( ) throws Exception { } @ After public void tearDown ( ) throws Exception { } @ Test public void testTimeout ( ) throws IOException , InterruptedException { } @ Test public void testSimple ( ) throws Exception { } @ Test public void testDoubleClaim ( ) throws InterruptedException , CloudnameException { } @ Test public void testCoordinateNotFound ( ) throws InterruptedException , CloudnameException { } class UnitTestCoordinateListener implements CoordinateListener { public final List < Event > events = new ArrayList < Event > ( ) ; private final CountDownLatch latch1 ; private final CountDownLatch latch2 ; UnitTestCoordinateListener ( CountDownLatch latch1 , CountDownLatch latch2 ) { } @ Override public void onCoordinateEvent ( Event event , String message ) { } } private ZkCloudnameTest . UnitTestCoordinateListener setUpListenerEnvironment ( CountDownLatch connectedLatch1 , CountDownLatch connectedLatch2 ) throws Exception { } @ Test public void testCoordinateListenerInitialEvent ( ) throws Exception { } @ Test public void testCoordinateListenerConnectionDies ( ) throws Exception { } @ Test public void testZookeeperRestarts ( ) throws Exception { final CountDownLatch connectedLatch1 = new CountDownLatch ( 1 ) ; final CountDownLatch connectedLatch2 = new CountDownLatch ( 3 ) ; ZkCloudnameTest . UnitTestCoordinateListener listener = setUpListenerEnvironment ( connectedLatch1 , connectedLatch2 ) ; assertTrue ( connectedLatch1 . await ( 20 , TimeUnit . SECONDS ) ) ; ZkCloudnameTest . log . info ( "Killing<seq2seq4repair_space>zookeeper" ) ; forwarder . terminate ( ) ; ezk . shutdown ( ) ; ezk . del ( ) ; ezk . init ( ) ; Thread . sleep ( 2000 ) ; forwarder = new PortForwarder ( forwarderPort , "127.0.0.1" , zkport ) ; <START_BUG> int timeoutSecs = 50 ; <END_BUG> while ( ( -- timeoutSecs ) > 0 ) { Thread . sleep ( 1000 ) ; } Coordinate c = Coordinate . parse ( "1.service.user.cell" ) ; cn . createCoordinate ( c ) ; Thread . sleep ( 9000 ) ; assertEquals ( listener . events . get ( ( ( listener . events . size ( ) ) - 1 ) ) , COORDINATE_OK ) ; } @ Test public void testCoordinateListenerCoordinateCorrupted ( ) throws Exception { } @ Test public void testCoordinateListenerCoordinateOutOfSync ( ) throws Exception { } @ Test public void testCoordinateListenerCoordinateLost ( ) throws Exception { } @ Test public void testCoordinateListenerStolenCoordinate ( ) throws Exception { } @ Test public void testCoordinateListenerConnectionDiesReconnect ( ) throws Exception { } @ Test public void testCoordinateListenerConnectionDiesReconnectAfterTimeout ( ) throws Exception { } @ Test public void testDestroyBasic ( ) throws Exception { } @ Test public void testDestroyTwoInstances ( ) throws Exception { } @ Test public void testDestroyClaimed ( ) throws Exception { } private boolean pathExists ( String path ) throws Exception { } private String fetchNodeData ( String path ) throws Exception { } }

Fix:
int timeoutSecs = 30 ;