@Test public void represent() throws ResourceException, IOException { final Variant variant = context.mock(Variant.class); final String overview = "my overview"; context.checking(new Expectations() { { oneOf(personMapper).findByOpenSocialId(SAMPLE_UUID); will(returnValue(person)); oneOf(person).getOverview(); will(returnValue(overview)); } }); Representation actual = sut.represent(variant); JSONObject json = JSONObject.fromObject(actual.getText()); assertEquals(json.get(PersonOverviewResource.OVERVIEW_KEY), overview); context.assertIsSatisfied(); }
public Representation represent(final Variant variant) { log.debug("Finding person with uuid=" + uuid); Person person = personMapper.findByOpenSocialId(uuid); JSONObject json = new JSONObject(); if (null != person) { json.put(OVERVIEW_KEY, person.getOverview()); } else { json.put(OVERVIEW_KEY, ""); } Representation rep = new StringRepresentation(json.toString(), MediaType.APPLICATION_JSON); rep.setExpirationDate(new Date(0L)); return rep; }
PersonOverviewResource extends WritableResource { public Representation represent(final Variant variant) { log.debug("Finding person with uuid=" + uuid); Person person = personMapper.findByOpenSocialId(uuid); JSONObject json = new JSONObject(); if (null != person) { json.put(OVERVIEW_KEY, person.getOverview()); } else { json.put(OVERVIEW_KEY, ""); } Representation rep = new StringRepresentation(json.toString(), MediaType.APPLICATION_JSON); rep.setExpirationDate(new Date(0L)); return rep; } }
PersonOverviewResource extends WritableResource { public Representation represent(final Variant variant) { log.debug("Finding person with uuid=" + uuid); Person person = personMapper.findByOpenSocialId(uuid); JSONObject json = new JSONObject(); if (null != person) { json.put(OVERVIEW_KEY, person.getOverview()); } else { json.put(OVERVIEW_KEY, ""); } Representation rep = new StringRepresentation(json.toString(), MediaType.APPLICATION_JSON); rep.setExpirationDate(new Date(0L)); return rep; }  }
PersonOverviewResource extends WritableResource { public Representation represent(final Variant variant) { log.debug("Finding person with uuid=" + uuid); Person person = personMapper.findByOpenSocialId(uuid); JSONObject json = new JSONObject(); if (null != person) { json.put(OVERVIEW_KEY, person.getOverview()); } else { json.put(OVERVIEW_KEY, ""); } Representation rep = new StringRepresentation(json.toString(), MediaType.APPLICATION_JSON); rep.setExpirationDate(new Date(0L)); return rep; }  Representation represent(final Variant variant); @Override void storeRepresentation(final Representation entity); void setPersonMapper(final PersonMapper inPersonMapper); }
PersonOverviewResource extends WritableResource { public Representation represent(final Variant variant) { log.debug("Finding person with uuid=" + uuid); Person person = personMapper.findByOpenSocialId(uuid); JSONObject json = new JSONObject(); if (null != person) { json.put(OVERVIEW_KEY, person.getOverview()); } else { json.put(OVERVIEW_KEY, ""); } Representation rep = new StringRepresentation(json.toString(), MediaType.APPLICATION_JSON); rep.setExpirationDate(new Date(0L)); return rep; }  Representation represent(final Variant variant); @Override void storeRepresentation(final Representation entity); void setPersonMapper(final PersonMapper inPersonMapper); static final String OVERVIEW_KEY; }