Examples of Tyre


Examples of cz.muni.fi.pa165.stis.entity.Tyre

            fail("exception should be thrown");
        } catch (IllegalArgumentException ex) {
            // ok
        }
       
        Tyre t = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(450));
        TyreTO tto = mapper.map(t, TyreTO.class);
        try {
            service.update(tto);
            fail("exception should be thrown");
        } catch (IllegalArgumentException ex) {
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        }
    }
   
    @Test
    public void testCreate() {
        final Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.create(tto);
        verify(dao).create(argThat(new BaseMatcher<Tyre>() {

            @Override
            public boolean matches(Object item) {
                if (!(item instanceof Tyre)) {
                    return false;
                }
                final Tyre t = (Tyre) item;
                if (!Objects.equals(t.getDiameter(), tyre.getDiameter())) {
                    return false;
                }
                if (!Objects.equals(t.getName(), tyre.getName())) {
                    return false;
                }
                if (!Objects.equals(t.getPrice(), tyre.getPrice())) {
                    return false;
                }
                if (!Objects.equals(t.getType(), tyre.getType())) {
                    return false;
                }
                if (!Objects.equals(t.getVendor(), tyre.getVendor())) {
                    return false;
                }
               
                return true;
            }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        }));
    }

    @Test
    public void testGet() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(4L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);       
       
        when(dao.get(4L)).thenReturn(tyre);
        TyreTO tyreTO = service.get(4L);
        assertEquals(tyreTO, tto);
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        assertEquals(tyreTO, tto);
    }
   
    @Test
    public void testUpdate() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(2L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.update(tto);
        verify(dao).update(tyre);       
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        verify(dao).update(tyre);       
    }
   
    @Test
    public void testRemove() {
        Tyre tyre = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre.setId(2L);
        TyreTO tto = mapper.map(tyre, TyreTO.class);
       
        service.remove(tto);
        verify(dao).remove(tyre);       
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        verify(dao).remove(tyre);       
    }
   
    @Test
    public void testFindAll() {
        Tyre tyre1 = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(420));
        tyre1.setId(2L);
       
        Tyre tyre2 = createTyre(19D, "Potenza RE050A", " 235/40R19", "Bridgestone", BigDecimal.valueOf(324));
        tyre2.setId(3L);
       
        List<Tyre> tyres = Arrays.asList(new Tyre[]{tyre1, tyre2});
        List<TyreTO> tyreTOList = Arrays.asList(new TyreTO[]{
            mapper.map(tyre1, TyreTO.class),
            mapper.map(tyre2, TyreTO.class)
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        assertTrue(tyreTOServiceList.containsAll(tyreTOList) && tyreTOList.containsAll(tyreTOServiceList));
    }
   
    @Test
    public void testFindByName() {
        Tyre tyre1 = createTyre(19D, "P Zero", "235/40ZR19", "Pirelli", BigDecimal.valueOf(450));
        Tyre tyre2 = createTyre(20D, "P Zero", "240/50R20", "Goodyear", BigDecimal.valueOf(480));
        tyre1.setId(2L);
        tyre2.setId(3L);
       
        List<Tyre> tyres = Arrays.asList(new Tyre[]{tyre1, tyre2});
        List<TyreTO> tyreTOList = Arrays.asList(new TyreTO[]{
            mapper.map(tyre1, TyreTO.class),
            mapper.map(tyre2, TyreTO.class)
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

       
        assertTrue(tyreTOServiceList.containsAll(tyreTOList) && tyreTOList.containsAll(tyreTOServiceList));
    }
   
    private static Tyre createTyre(Double diameter, String name, String type, String vendor, BigDecimal price) {
        Tyre t = new Tyre();
        t.setDiameter(diameter);
        t.setName(name);
        t.setType(type);
        t.setVendor(vendor);
        t.setPrice(price);
        return t;
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

        es1.setId(1L);
        ExtraService es2 = newExtraService("Vysavanie", "Vysavanie auta", BigDecimal.valueOf(122.5));
        es2.setId(2L);
        extraServices = new HashSet<ExtraService>(Arrays.asList(new ExtraService[]{es1, es2}));
        //
        Tyre t1 = newTyre(17D, "MM22", "EZ256", "Michellin", BigDecimal.valueOf(222));
        t1.setId(1L);
        Tyre t2 = newTyre(17D, "MM23", "EZ257", "Michellin", BigDecimal.valueOf(222));
        t2.setId(2L);
        Tyre t3 = newTyre(18D, "PR89", "NT99", "Pirelli", BigDecimal.valueOf(253.4));
        t3.setId(3L);
        tyres = new EnumMap<TyrePosition, Tyre>(TyrePosition.class);
        tyres.put(TyrePosition.FRONT_LEFT, t1);
        tyres.put(TyrePosition.FRONT_RIGHT, t2);
        tyres.put(TyrePosition.REAR_LEFT, t3);
        order = newOrder(customer, newDate("22.9.2012 12:13:15"), null, null, extraServices, tyres, BigDecimal.ZERO);
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Tyre

                }
                if (no.getTyres().size() != o.getTyres().size()) {
                    return false;
                }
                for (Map.Entry<TyrePosition, Tyre> me : no.getTyres().entrySet()) {
                    Tyre t = o.getTyres().get(me.getKey());
                    if (!Objects.equals(t, me.getValue())) {
                        return false;
                    }
                }
               
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.