Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.agilecoders.wicket.logging.util;
 
 import org.junit.After;
 import org.junit.Test;
 
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;

Tests the ILoggingBarrier.AllowAllBarrier

Author(s):
miha
    private ClientSideLogObject logObject;
    private ExecutorService pool;
    @Before
    public void setUp() throws Exception {
         = Mocks.createClientSideLogObject();
         = Executors.newFixedThreadPool(2);
    }
    @After
    public void tearDown() throws Throwable {
         = null;
    }
    @Test
    @Ignore
    }
    @Test
    @Ignore
        Thread.sleep(1000);
    }
    private void checkTenAndCheckForBlockedEleventh() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(2);
        for (int i = 0; i < 2; ++i) {
            .execute(newRunnable(ilatch));
        }
        if (latch.await(100, .)) {
            assertThat("number: 11".isAllowed(), is(false));
        } else {
            fail("there was an assertion error. check lines before.");
        }
    }
    private Runnable newRunnable(final int idfinal CountDownLatch latch) {
        return new Runnable() {
            @Override
            public void run() {
                for (int i = 5; i > 0; --i) {
                    assertThat("number[" + id + "]: " + i.isAllowed(), is(true));
                }
                // count down only if no assertion error was thrown before.
                latch.countDown();
            }
        };
    }
New to GrepCode? Check out our FAQ X