LazyImmutableRep implements Representation { @Override public String show() { String show = self.show(); if (show.length() <= 80 ) return show; else return show.substring(0, 77) + "..."; } LazyImmutableRep(String contentType, InputStream data); byte[] head(int n); byte[] get(); @Override String contentType(); @Override void write(OutputStream out); @Override String show(); @Override boolean eq(Representation that);  }
@Test public void showTest() throws Exception { LazyImmutableRep rep = new LazyImmutableRep(text, in("baz")); String bigString = "Lorem ipsum dolor sit amet, " + "consectetur adipiscing elit, " + "sed do eiusmod tempor incididunt " + "ut labore et dolore magna aliqua."; LazyImmutableRep bigRep = new LazyImmutableRep(text, in(bigString)); String show1 = rep.show(); String show2 = rep.show(); String show3 = bigRep.show(); assertEquals("baz", show1); assertEquals("baz", show2); assertEquals(bigString.substring(0, 77) + "...", show3); }