Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.agilecoders.wicket.logging;
 
 import org.junit.After;
 import org.junit.Test;
 
 import java.util.Map;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;

Tests the ClientSideLoggingBehavior

Author(s):
miha
    private WicketTester tester;
    @Before
    public void setUp() throws Exception {
         = new WicketTester(new ClientSideLoggingMockApplication());
    }
    @After
    public void tearDown() throws Exception {
        .destroy();
    }
    @Test
    public void builderConstructsCorrectBehavior() {
        ClientSideLoggingBehavior.Builder b = ClientSideLoggingBehavior.newBuilder();
        assertThat(b.build(), is(notNullValue()));
        assertThat(b.data().size(), is(equalTo(0)));
    }
    @Test
        ClientSideLoggingBehavior.Builder b = ClientSideLoggingBehavior.newBuilder()
                .collectClientInfos(false)
                .collectionType(.)
                .collectionTimer(Duration.seconds(100));
        assertThat(b.data().size(), is(equalTo(3)));
        assertThat(b.data().containsKey("collectClientInfos"), is(true));
        assertThat(b.data().containsKey("collectionType"), is(true));
        assertThat(b.data().containsKey("collectionTimer"), is(true));
    }
    @Test
        ClientSideLoggingBehavior.Builder b = ClientSideLoggingBehavior.newBuilder("collectClientInfos=false,collectionType=Unload,collectionTimer=100 seconds");
        assertThat(b.data().size(), is(equalTo(3)));
        assertThat(b.data().containsKey("collectClientInfos"), is(true));
        assertThat(b.data().containsKey("collectionType"), is(true));
        assertThat(b.data().containsKey("collectionTimer"), is(true));
    }
    @Test
        ClientSideLoggingBehavior.Builder b = ClientSideLoggingBehavior.newBuilder();
        assertThat(b.build(MyBehavior.class), is(notNullValue()));
        assertThat(b.build(MyBehavior.class), is(instanceOf(MyBehavior.class)));
    }
    public static class MyBehavior extends ClientSideLoggingBehavior {
        public MyBehavior(Map<StringObjectdata) {
            super(data);
        }
    }
New to GrepCode? Check out our FAQ X