@Test public void testToDTOList() { LocationDtoAssembler assembler = new LocationDtoAssembler(); List<Location> locationList = Arrays.asList(SampleLocations.STOCKHOLM, SampleLocations.HAMBURG); List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtos = assembler .toDtoList(locationList); assertEquals(2, dtos.size()); net.java.cargotracker.interfaces.booking.facade.dto.Location dto = dtos .get(0); assertEquals("SESTO", dto.getUnLocode()); assertEquals("Stockholm", dto.getName()); dto = dtos.get(1); assertEquals("DEHAM", dto.getUnLocode()); assertEquals("Hamburg", dto.getName()); }
public List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList( List<Location> allLocations) { List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtoList = new ArrayList<>( allLocations.size()); for (Location location : allLocations) { dtoList.add(toDto(location)); } Collections.sort( dtoList, new Comparator<net.java.cargotracker.interfaces.booking.facade.dto.Location>() { @Override public int compare( net.java.cargotracker.interfaces.booking.facade.dto.Location location1, net.java.cargotracker.interfaces.booking.facade.dto.Location location2) { return location1.getName().compareTo(location2.getName()); } }); return dtoList; }
LocationDtoAssembler { public List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList( List<Location> allLocations) { List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtoList = new ArrayList<>( allLocations.size()); for (Location location : allLocations) { dtoList.add(toDto(location)); } Collections.sort( dtoList, new Comparator<net.java.cargotracker.interfaces.booking.facade.dto.Location>() { @Override public int compare( net.java.cargotracker.interfaces.booking.facade.dto.Location location1, net.java.cargotracker.interfaces.booking.facade.dto.Location location2) { return location1.getName().compareTo(location2.getName()); } }); return dtoList; } }
LocationDtoAssembler { public List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList( List<Location> allLocations) { List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtoList = new ArrayList<>( allLocations.size()); for (Location location : allLocations) { dtoList.add(toDto(location)); } Collections.sort( dtoList, new Comparator<net.java.cargotracker.interfaces.booking.facade.dto.Location>() { @Override public int compare( net.java.cargotracker.interfaces.booking.facade.dto.Location location1, net.java.cargotracker.interfaces.booking.facade.dto.Location location2) { return location1.getName().compareTo(location2.getName()); } }); return dtoList; }  }
LocationDtoAssembler { public List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList( List<Location> allLocations) { List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtoList = new ArrayList<>( allLocations.size()); for (Location location : allLocations) { dtoList.add(toDto(location)); } Collections.sort( dtoList, new Comparator<net.java.cargotracker.interfaces.booking.facade.dto.Location>() { @Override public int compare( net.java.cargotracker.interfaces.booking.facade.dto.Location location1, net.java.cargotracker.interfaces.booking.facade.dto.Location location2) { return location1.getName().compareTo(location2.getName()); } }); return dtoList; }  net.java.cargotracker.interfaces.booking.facade.dto.Location toDto(
            Location location); List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList(
            List<Location> allLocations); }
LocationDtoAssembler { public List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList( List<Location> allLocations) { List<net.java.cargotracker.interfaces.booking.facade.dto.Location> dtoList = new ArrayList<>( allLocations.size()); for (Location location : allLocations) { dtoList.add(toDto(location)); } Collections.sort( dtoList, new Comparator<net.java.cargotracker.interfaces.booking.facade.dto.Location>() { @Override public int compare( net.java.cargotracker.interfaces.booking.facade.dto.Location location1, net.java.cargotracker.interfaces.booking.facade.dto.Location location2) { return location1.getName().compareTo(location2.getName()); } }); return dtoList; }  net.java.cargotracker.interfaces.booking.facade.dto.Location toDto(
            Location location); List<net.java.cargotracker.interfaces.booking.facade.dto.Location> toDtoList(
            List<Location> allLocations);  }