1 package org.apidesign.openfixed;
3 import java.util.concurrent.CountDownLatch;
5 /** Test the Calculator.createPending() behavior.
7 * @author Jaroslav Tulach <jtulach@netbeans.org>
9 public final class PostTest extends PendingTest {
11 public PostTest(String testName) {
16 protected Calculator create() {
17 return Calculator.createBatch();
20 public void testPostModificationEvents() throws Exception {
21 class PostListener extends BlockingListener implements PostModificationListener {
25 public synchronized void modification(ModificationEvent ev) {
26 // registers for callback when batch processing is over:
28 super.modification(ev);
32 public synchronized void postProcess(PostModificationEvent ev) {
36 public synchronized void assertPostProcess(String msg, int expected) throws InterruptedException {
37 for (int i = 0; i < 10; i++) {
38 if (cnt >= expected) {
43 assertEquals(msg, expected, cnt);
47 PostListener bl = new PostListener();
49 Calculator calc = create();
50 calc.addModificationListener(bl);
60 bl.assertPostProcess("Two postprocessings (one for 10), then for the rest", 2);