Setting result prior to counting down latch.

This commit is contained in:
Mark Fisher
2008-01-16 04:38:24 +00:00
parent 74217bccec
commit b5335e71cc
2 changed files with 3 additions and 7 deletions

View File

@@ -42,11 +42,9 @@ public class AdapterTests {
sink.setLatch(latch);
assertNull(sink.get());
context.start();
String result = null;
latch.await(3000, TimeUnit.MILLISECONDS);
assertEquals("latch should have counted down within allotted time", 0, latch.getCount());
result = sink.get();
assertNotNull(result);
assertNotNull(sink.get());
context.close();
}
@@ -58,11 +56,9 @@ public class AdapterTests {
sink.setLatch(latch);
assertNull(sink.get());
context.start();
String result = null;
latch.await(3000, TimeUnit.MILLISECONDS);
assertEquals("latch should have counted down within allotted time", 0, latch.getCount());
result = sink.get();
assertNotNull(result);
assertNotNull(sink.get());
context.close();
}

View File

@@ -43,10 +43,10 @@ public class TestSink {
}
public void store(String s) {
this.result = s;
if (this.latch != null) {
this.latch.countDown();
}
this.result = s;
}
public String get() {