@Test public void should_generate_new_siblings() { List<Person> oldSiblings = createSiblings(); Person person = createPersonWithStreetNumberAndSiblingsAndName(oldSiblings); List<Person> siblings = systemUnderTest.createNewSiblings(person); then(siblings).doesNotContainAnyElementsOf(oldSiblings); }
public List<Person> createNewSiblings(Person person) { List<Person> newSiblings = new ArrayList<Person>(); for(Person sibling : person.getSiblings()) { Person newPerson = new Person(); person.setName(createNewName(sibling)); person.setAddress(sibling.getAddress()); person.setSiblings(sibling.getSiblings()); newSiblings.add(newPerson); } return newSiblings; }
NewIdentityCreator { public List<Person> createNewSiblings(Person person) { List<Person> newSiblings = new ArrayList<Person>(); for(Person sibling : person.getSiblings()) { Person newPerson = new Person(); person.setName(createNewName(sibling)); person.setAddress(sibling.getAddress()); person.setSiblings(sibling.getSiblings()); newSiblings.add(newPerson); } return newSiblings; } }
NewIdentityCreator { public List<Person> createNewSiblings(Person person) { List<Person> newSiblings = new ArrayList<Person>(); for(Person sibling : person.getSiblings()) { Person newPerson = new Person(); person.setName(createNewName(sibling)); person.setAddress(sibling.getAddress()); person.setSiblings(sibling.getSiblings()); newSiblings.add(newPerson); } return newSiblings; }  }
NewIdentityCreator { public List<Person> createNewSiblings(Person person) { List<Person> newSiblings = new ArrayList<Person>(); for(Person sibling : person.getSiblings()) { Person newPerson = new Person(); person.setName(createNewName(sibling)); person.setAddress(sibling.getAddress()); person.setSiblings(sibling.getSiblings()); newSiblings.add(newPerson); } return newSiblings; }  String createNewName(Person person); int createNewStreetNumber(Person person); List<Person> createNewSiblings(Person person); }
NewIdentityCreator { public List<Person> createNewSiblings(Person person) { List<Person> newSiblings = new ArrayList<Person>(); for(Person sibling : person.getSiblings()) { Person newPerson = new Person(); person.setName(createNewName(sibling)); person.setAddress(sibling.getAddress()); person.setSiblings(sibling.getSiblings()); newSiblings.add(newPerson); } return newSiblings; }  String createNewName(Person person); int createNewStreetNumber(Person person); List<Person> createNewSiblings(Person person);  }