@@ -0,0 +1,2628 @@
+package org.computelab.config;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0A%0Apublic class AbstractConfigTest %7B%0A%0A    @Test(expected=NullPointerException.class)%0A    public void nameCannotBeNull() %7B%0A        mockConstructor(null);%0A    %7D%0A%0A    @Test(expected=IllegalArgumentException.class)%0A    public void nameCannotBeEmpty() %7B%0A        mockConstructor(%22%22);%0A    %7D%0A%0A    @Test%0A    public void getAsBoolean() %7B%0A        String key = %22anyKey%22;%0A        // True scenarios%0A        Config config = mockGet(%22True%22);%0A        assertTrue(config.getAsBoolean(key));%0A        config = mockGet(%22true%22);%0A        assertTrue(config.getAsBoolean(key));%0A        config = mockGet(%22TRUE%22);%0A        assertTrue(config.getAsBoolean(key));%0A        // False scenarios%0A        config = mockGet(%22False%22);%0A        assertFalse(config.getAsBoolean(key));%0A        config = mockGet(null);%0A        assertFalse(config.getAsBoolean(key));%0A        config = mockGet(%22NotBoolean%22);%0A        assertFalse(config.getAsBoolean(key));%0A        config = mockGet(%22yes%22);%0A        assertFalse(config.getAsBoolean(key));%0A        config = mockGet(%221%22);%0A        assertFalse(config.getAsBoolean(key));%0A    %7D%0A%0A    @Test%0A    public void getAsInteger() %7B%0A        Config config = mockGet(%225%22);%0A        assertEquals(5, config.getAsInt(%22anyKey%22));%0A    %7D%0A%0A    @Test(expected=NumberFormatException.class)%0A    public void getAsIntegerNumberFormatException() %7B%0A        Config config = mockGet(%22NotAnInteger%22);%0A        config.getAsInt(%22anyKey%22);%0A    %7D%0A%0A    @Test%0A    public void getAsLong() %7B%0A        Config config = mockGet(%225%22);%0A        assertEquals(5L, config.getAsLong(%22anyKey%22));%0A    %7D%0A%0A    @Test(expected=NumberFormatException.class)%0A    public void getAsLongNumberFormatException() %7B%0A        Config config = mockGet(%22NotAnInteger%22);%0A        config.getAsLong(%22anyKey%22);%0A    %7D%0A%0A    private Config mockConstructor(String name) %7B%0A        return mockConfig(name, null, null);%0A    %7D%0A%0A    private Config mockGet(String get) %7B%0A        return mockConfig(%22name%22, get, null);%0A    %7D%0A%0A    private Config mockConfig(String name, String get, List%3CString%3E getAsList) %7B%0A        return new AbstractConfig(name) %7B%0A            @Override%0A            public boolean has(String key) %7B%0A                return false;%0A            %7D%0A            @Override%0A            public String get(String key) %7B%0A                return get;%0A            %7D%0A            @Override%0A            public List%3CString%3E getAsList(String key) %7B%0A                return getAsList;%0A            %7D%0A        %7D;%0A    %7D%0A%7D%0A

Test AbstractConfig