Package org.geoserver

Examples of org.geoserver.ExtendedCapabilitiesProvider$Translator


    }

    @Test
    public void key_and_type_mismatch()
    {
        Translator t = mockTranslator();

        train_getType(t, Long.class);

        replay();
View Full Code Here


    }

    @Test
    public void name_collision_with_standard_translators()
    {
        Translator t1 = mockTranslator("fred", Integer.class);
        Translator t2 = mockTranslator("fred", Long.class);

        Map<Class, Translator> configuration = CollectionFactory.newMap();
        configuration.put(Integer.class, t1);
        configuration.put(Long.class, t2);
View Full Code Here

    }

    @Test
    public void get_alternate_translator_by_name()
    {
        Translator t1 = mockTranslator("fred", Integer.class);
        Translator t2 = mockTranslator();

        Map<Class, Translator> configuration = newConfiguration(Integer.class, t1);

        Map<String, Translator> alternates = CollectionFactory.newMap();
        alternates.put("barney", t2);
View Full Code Here

    }

    @Test
    public void name_collision_between_standard_and_alternate_translator()
    {
        Translator t1 = mockTranslator("fred", Integer.class);
        Translator t2 = mockTranslator();

        Map<Class, Translator> configuration = newConfiguration(Integer.class, t1);

        Map<String, Translator> alternates = CollectionFactory.newMap();
        alternates.put("fred", t2);
View Full Code Here

    }

    @Test
    public void unknown_translator_is_failure()
    {
        Translator fred = mockTranslator("fred", String.class);
        Translator barney = mockTranslator("barney", Long.class);

        Map<Class, Translator> configuration = CollectionFactory.newMap();

        configuration.put(String.class, fred);
        configuration.put(Long.class, barney);
View Full Code Here

    }

    @Test(dataProvider = "to_client_data")
    public void to_client(Class type, Object value, String expected)
    {
        Translator t = source.getByType(type);

        String actual = t.toClient(value);

        assertEquals(actual, expected);
    }
View Full Code Here

    }

    @Test(dataProvider = "parse_client_success_data")
    public void parse_client(Class type, String input, Object expected) throws Exception
    {
        Translator t = source.getByType(type);

        Object actual = t.parseClient(null, input, null);

        assertEquals(actual, expected);
    }
View Full Code Here

    }

    @Test(dataProvider = "parse_client_failure_data")
    public void parse_client_failure(Class type, String input, String expectedMessage)
    {
        Translator t = source.getByType(type);
        Field field = mockField();

        replay();

        try
        {
            t.parseClient(field, input, expectedMessage);
            unreachable();
        }
        catch (ValidationException ex)
        {
            assertEquals(ex.getMessage(), expectedMessage);
View Full Code Here

    }

    @Test
    public void find_by_type()
    {
        Translator t = mockTranslator("string", String.class);

        replay();

        TranslatorSource source = new TranslatorSourceImpl(newConfiguration(String.class, t));
View Full Code Here

    }

    @Test
    public void get_by_type_not_found()
    {
        Translator string = mockTranslator("string", String.class);
        Translator bool = mockTranslator("bool", Boolean.class);

        Map<Class, Translator> configuration = CollectionFactory.newMap();
        configuration.put(String.class, string);
        configuration.put(Boolean.class, bool);
View Full Code Here

TOP

Related Classes of org.geoserver.ExtendedCapabilitiesProvider$Translator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.