Pattern { public ArrayList<Box> getBoxes() { ArrayList<Box> result = new ArrayList<>(); boxes.stream().forEach(b -> { for (int i = 0; i < b.getAmount(); i++) { result.add(new Box(b.getSize(), 1)); } }); return result; } Pattern(Vector size, ArrayList<Box> boxes);  Pattern(Vector size, ArrayList<Box> boxes, ArrayList<PlacedBox> placedBoxes); ArrayList<PlacedBox> getPlacedBoxes(); void setPlacedBoxes(ArrayList<PlacedBox> placedBoxes); Vector getSize(); ArrayList<Box> getAmounts(); ArrayList<Box> getBoxes(); @Override Pattern clone(); @Override String toString(); boolean isPatternEmpty();  }
@Test public void testGetBoxes() throws Exception { ArrayList<Box> result = pattern.getBoxes(); assertEquals(13, result.size()); assertEquals(6, Collections.frequency(result, boxeToTest)); }