Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package de.agilecoders.wicket.logging;
 
 import org.junit.Test;
 
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

Tests the ClientInfos class

Author(s):
miha
public class ClientInfosTest {
    @Test
    public void putValuesForValidKeysIsAllowed() {
        final ClientInfos clientInfos = new ClientInfos();
        clientInfos.put(."baseUrl");
        clientInfos.put(."windowSize");
        clientInfos.put(."screenSize");
        clientInfos.put(."userAgent");
        assertThat(clientInfos.ajaxBaseUrl(), is(equalTo("baseUrl")));
        assertThat(clientInfos.windowSize(), is(equalTo("windowSize")));
        assertThat(clientInfos.screenSize(), is(equalTo("screenSize")));
        assertThat(clientInfos.userAgent(), is(equalTo("userAgent")));
    }
    @Test(expected = UnsupportedOperationException.class)
    public void putAllIsntSupported() {
        new ClientInfos().putAll(new HashMap<StringString>());
    }
    @Test
    public void putValuesForInvalidKeysIsForbidden() {
        final ClientInfos clientInfos = new ClientInfos();
        String setValue = clientInfos.put("invalidKey""value");
        assertThat(setValueis(nullValue()));
        assertThat(clientInfos.get("invalidKey"), is(nullValue()));
    }
New to GrepCode? Check out our FAQ X