Package com.tobedevoured.modelcitizen.model

Examples of com.tobedevoured.modelcitizen.model.Wheel


        modelFactory.registerBlueprint(OptionBlueprint.class);
    }

    @Test
    public void spireTireBlueprintInheritsFromWheelBlueprint() throws CreateModelException {
        Wheel wheel = modelFactory.createModel(Wheel.class);
        SpareTire spareTire = modelFactory.createModel(SpareTire.class);

        assertEquals(wheel.getColor(), spareTire.getColor());

        assertEquals("spare tire name", spareTire.getName());
        assertEquals(9, (int) spareTire.getSize());
        assertEquals(400, (int) spareTire.getMileLimit());
    }
View Full Code Here


        modelFactory.registerBlueprint(optionBlueprint);
    }


    public void testEmptyListDoesNotInjectBlueprint() throws CreateModelException {
        Wheel wheel = new Wheel("Test");
        wheel.setOptions(new ArrayList<Option>()); // prevents injection

        Wheel factoryWheel = modelFactory.createModel(wheel);

        assertEquals(0, factoryWheel.getOptions().size());
        assertEquals(3, factoryWheel.getVariants().size());
    }
View Full Code Here

        assertEquals(0, factoryWheel.getOptions().size());
        assertEquals(3, factoryWheel.getVariants().size());
    }

    public void testEmptyListInjectsBlueprint() throws CreateModelException {
        Wheel wheel = new Wheel("Test");
        wheel.setVariants(new ArrayList<Option>())// still injected due to ignoreEmpty = true

        Wheel factoryWheel = modelFactory.createModel(wheel);

        assertEquals(3, factoryWheel.getOptions().size());
        assertEquals(3, factoryWheel.getVariants().size());
    }
View Full Code Here

    @Test
    public void testForceAlwaysCreatesMappedList() throws CreateModelException {

        Car car = new Car();
        car.setWheels(Arrays.asList(new Wheel[]{new Wheel("test")}));
        car = modelFactory.createModel(car);

        assertEquals("force=true ensures wheels will be injected", 4, car.getWheels().size());
    }
View Full Code Here

        car.setMake("new make");
        car.setManufacturer("test manuf");

        car.setWheels(new ArrayList<Wheel>());
        Wheel wheel = new Wheel("mega tire");
        car.getWheels().add(wheel);

        car.setSpares(new HashSet<Wheel>());

        car = modelFactory.createModel(car);
View Full Code Here

    }

    @Test
    public void testCreateModelWithConstructorCallBack() throws CreateModelException {

        Wheel wheel1 = modelFactory.createModel(Wheel.class);
        assertEquals("tire name", wheel1.getName());

        Wheel wheel2 = modelFactory.createModel(Wheel.class);
        assertEquals("tire name", wheel1.getName());

        assertFalse("Should create new instances", wheel1.equals(wheel2));
    }
View Full Code Here

TOP

Related Classes of com.tobedevoured.modelcitizen.model.Wheel

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.