@Test public void testTransform() { final PersonModelView mv = context.mock(PersonModelView.class); final String accountId = "lsdjkfdskfl"; final String avatarId = "lsdkjflsdkflsdjf"; final String displayName = "sldkjfskldjfljdf"; final boolean accountLocked = true; final long entityId = 3872L; context.checking(new Expectations() { { oneOf(mv).getAccountId(); will(returnValue(accountId)); oneOf(mv).getAvatarId(); will(returnValue(avatarId)); oneOf(mv).getDisplayName(); will(returnValue(displayName)); oneOf(mv).getEntityId(); will(returnValue(entityId)); oneOf(mv).isAccountLocked(); will(returnValue(accountLocked)); } }); ArrayList<PersonModelView> people; people = sut.transform(sut.transform(Collections.singletonList(mv))); assertEquals(accountId, people.get(0).getAccountId()); assertEquals(avatarId, people.get(0).getAvatarId()); assertEquals(displayName, people.get(0).getDisplayName()); assertEquals(entityId, people.get(0).getEntityId()); assertEquals(accountLocked, people.get(0).isAccountLocked()); context.assertIsSatisfied(); }
@Override public ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople) { ArrayList<PersonModelView> returnPeople = new ArrayList<PersonModelView>(); log.debug("Trimming " + inPeople.size() + " PersonModelViews of all information not necessary for avatar display"); for (PersonModelView mv : inPeople) { PersonModelView newPerson = new PersonModelView(); newPerson.setAccountId(mv.getAccountId()); newPerson.setAvatarId(mv.getAvatarId()); newPerson.setEntityId(mv.getEntityId()); newPerson.setDisplayName(mv.getDisplayName()); newPerson.setAccountLocked(mv.isAccountLocked()); returnPeople.add(newPerson); } return returnPeople; }
PersonModelViewAvatarDisplayTransformer implements
        Transformer<List<PersonModelView>, ArrayList<PersonModelView>> { @Override public ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople) { ArrayList<PersonModelView> returnPeople = new ArrayList<PersonModelView>(); log.debug("Trimming " + inPeople.size() + " PersonModelViews of all information not necessary for avatar display"); for (PersonModelView mv : inPeople) { PersonModelView newPerson = new PersonModelView(); newPerson.setAccountId(mv.getAccountId()); newPerson.setAvatarId(mv.getAvatarId()); newPerson.setEntityId(mv.getEntityId()); newPerson.setDisplayName(mv.getDisplayName()); newPerson.setAccountLocked(mv.isAccountLocked()); returnPeople.add(newPerson); } return returnPeople; } }
PersonModelViewAvatarDisplayTransformer implements
        Transformer<List<PersonModelView>, ArrayList<PersonModelView>> { @Override public ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople) { ArrayList<PersonModelView> returnPeople = new ArrayList<PersonModelView>(); log.debug("Trimming " + inPeople.size() + " PersonModelViews of all information not necessary for avatar display"); for (PersonModelView mv : inPeople) { PersonModelView newPerson = new PersonModelView(); newPerson.setAccountId(mv.getAccountId()); newPerson.setAvatarId(mv.getAvatarId()); newPerson.setEntityId(mv.getEntityId()); newPerson.setDisplayName(mv.getDisplayName()); newPerson.setAccountLocked(mv.isAccountLocked()); returnPeople.add(newPerson); } return returnPeople; }  }
PersonModelViewAvatarDisplayTransformer implements
        Transformer<List<PersonModelView>, ArrayList<PersonModelView>> { @Override public ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople) { ArrayList<PersonModelView> returnPeople = new ArrayList<PersonModelView>(); log.debug("Trimming " + inPeople.size() + " PersonModelViews of all information not necessary for avatar display"); for (PersonModelView mv : inPeople) { PersonModelView newPerson = new PersonModelView(); newPerson.setAccountId(mv.getAccountId()); newPerson.setAvatarId(mv.getAvatarId()); newPerson.setEntityId(mv.getEntityId()); newPerson.setDisplayName(mv.getDisplayName()); newPerson.setAccountLocked(mv.isAccountLocked()); returnPeople.add(newPerson); } return returnPeople; }  @Override ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople); }
PersonModelViewAvatarDisplayTransformer implements
        Transformer<List<PersonModelView>, ArrayList<PersonModelView>> { @Override public ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople) { ArrayList<PersonModelView> returnPeople = new ArrayList<PersonModelView>(); log.debug("Trimming " + inPeople.size() + " PersonModelViews of all information not necessary for avatar display"); for (PersonModelView mv : inPeople) { PersonModelView newPerson = new PersonModelView(); newPerson.setAccountId(mv.getAccountId()); newPerson.setAvatarId(mv.getAvatarId()); newPerson.setEntityId(mv.getEntityId()); newPerson.setDisplayName(mv.getDisplayName()); newPerson.setAccountLocked(mv.isAccountLocked()); returnPeople.add(newPerson); } return returnPeople; }  @Override ArrayList<PersonModelView> transform(final List<PersonModelView> inPeople);  }