@Test void findAllPetTypes() { PetType type1 = petData.createType("type1"); PetType type2 = petData.createType("Another type"); List<PetType> petTypes = petScreen.getTypes(); List<PetType> petTypesAgain = petScreen.getTypes(); petTypes.retainAll(asList(type1, type2)); assertSame(type1, petTypes.get(1)); assertSame(type2, petTypes.get(0)); assertSame(petTypes, petTypesAgain); }
@Nonnull public List<PetType> getTypes() { if (types == null) { types = petMaintenance.findPetTypes(); } return types; }
PetScreen { @Nonnull public List<PetType> getTypes() { if (types == null) { types = petMaintenance.findPetTypes(); } return types; } }
PetScreen { @Nonnull public List<PetType> getTypes() { if (types == null) { types = petMaintenance.findPetTypes(); } return types; }  }
PetScreen { @Nonnull public List<PetType> getTypes() { if (types == null) { types = petMaintenance.findPetTypes(); } return types; }  @Nonnull List<PetType> getTypes(); @Nullable Pet getPet(); void requestNewPet(); void selectOwner(int ownerId); void selectPet(int petId); void createOrUpdatePet(); }
PetScreen { @Nonnull public List<PetType> getTypes() { if (types == null) { types = petMaintenance.findPetTypes(); } return types; }  @Nonnull List<PetType> getTypes(); @Nullable Pet getPet(); void requestNewPet(); void selectOwner(int ownerId); void selectPet(int petId); void createOrUpdatePet();  }