Package org.apache.hivemind.schema.rules

Examples of org.apache.hivemind.schema.rules.SmartTranslator.translate()


    public void testDefault()
    {
        Translator t = new SmartTranslator("default=100");

        Object result = t.translate(null, int.class, "", null);

        assertEquals(new Integer(100), result);
    }

    /**
 
View Full Code Here


     */
    public void testDouble()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, Double.class, "3.14", null);

        assertEquals(new Double("3.14"), result);
    }

    /**
 
View Full Code Here

    public void testString()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, String.class, "Fluffy Puppies", null);

        assertEquals("Fluffy Puppies", result);
    }

    public void testNoEditor()
View Full Code Here

        Translator t = new SmartTranslator();
        Location l = fabricateLocation(22);

        try
        {
            t.translate(null, Registry.class, "fred", l);

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here

    public void testDefault()
    {
        Translator t = new SmartTranslator("default=100");

        Object result = t.translate(null, int.class, null, null);

        assertEquals(new Integer(100), result);
    }

    /**
 
View Full Code Here

     */
    public void testDouble()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, Double.class, "3.14", null);

        assertEquals(new Double("3.14"), result);
    }

    /**
 
View Full Code Here

     */
    public void testString()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, String.class, "Fluffy Puppies", null);

        assertEquals("Fluffy Puppies", result);
    }

    /**
 
View Full Code Here

     */
    public void testObjectAsString()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, Object.class, "Fluffy Puppies", null);

        assertEquals("Fluffy Puppies", result);
    }

    public void testStringWithNoEditor()
View Full Code Here

    {
        PropertyEditorManager.setEditorSearchPath(new String[]
        { "bogus.package" });
        Translator t = new SmartTranslator();

        Object result = t.translate(null, String.class, "Fluffy Puppies", null);

        assertEquals("Fluffy Puppies", result);
    }

    public void testNoEditor()
View Full Code Here

        Translator t = new SmartTranslator();
        Location l = newLocation();

        try
        {
            t.translate(null, Registry.class, "fred", l);

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.