ItemToPtoTransformer { public EquipmentPto createPto(IEquipmentItem item) { EquipmentPto pto = new EquipmentPto(); pto.templateId = item.getTemplateId(); pto.customTitle = item.getTitle(); if (!item.getBaseDescription().equals(item.getDescription())) { pto.description = item.getDescription(); } for (IEquipmentStats stats : item.getStats()) { if (item.isPrintEnabled(stats)) { EquipmentStatsPto printPto = createStatsPto(item, stats); pto.printStats.add(printPto); } } return pto; } ItemToPtoTransformer(EquipmentModel heroModel); EquipmentPto createPto(IEquipmentItem item);  }
@Test public void savesPrintStats() throws Exception { DummyEquipmentItem item = new DummyEquipmentItem("Title", "Description"); IEquipmentStats stats = createStats("Stat"); EquipmentModel model = createEquipmentModel(item, stats); ItemToPtoTransformer transformer = new ItemToPtoTransformer(model); item.addEquipment(stats); item.setPrintEnabled(stats, true); EquipmentPto pto = transformer.createPto(item); EquipmentStatsPto expected = new EquipmentStatsPto(); expected.id = "Stat"; assertThat(pto.printStats, contains(expected)); }