@Test public void testCreateFromDecodedStringBody() throws Exception { String str = "Gaap is awesome"; byte[] content = str.getBytes(); byte[] compressedContent = new GzipCompressor().compress(content); RecordedStringHttpBody recordedStringHttpBody = new RecordedStringHttpBody(str); RecordedEncodedHttpBody recordedEncodedHttpBody = new RecordedEncodedHttpBody(recordedStringHttpBody, "gzip"); Assert.assertEquals(recordedEncodedHttpBody.getContent("UTF-8"), compressedContent); }
@Override public byte[] getContent(String charSet) throws IOException { if (_encodedContent == null) { _encodedContent = getCompressor().compress(_decodedBody.getContent(charSet)); } return _encodedContent; }
RecordedEncodedHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) throws IOException { if (_encodedContent == null) { _encodedContent = getCompressor().compress(_decodedBody.getContent(charSet)); } return _encodedContent; } }
RecordedEncodedHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) throws IOException { if (_encodedContent == null) { _encodedContent = getCompressor().compress(_decodedBody.getContent(charSet)); } return _encodedContent; } RecordedEncodedHttpBody(RecordedHttpBody decodedBody, String encodingName);  RecordedEncodedHttpBody(byte[] encodedContent, String encodingName, String charset, String contentType); }
RecordedEncodedHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) throws IOException { if (_encodedContent == null) { _encodedContent = getCompressor().compress(_decodedBody.getContent(charSet)); } return _encodedContent; } RecordedEncodedHttpBody(RecordedHttpBody decodedBody, String encodingName);  RecordedEncodedHttpBody(byte[] encodedContent, String encodingName, String charset, String contentType); @Override byte[] getContent(String charSet); String getEncodingName(); RecordedHttpBody getDecodedBody(); }
RecordedEncodedHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) throws IOException { if (_encodedContent == null) { _encodedContent = getCompressor().compress(_decodedBody.getContent(charSet)); } return _encodedContent; } RecordedEncodedHttpBody(RecordedHttpBody decodedBody, String encodingName);  RecordedEncodedHttpBody(byte[] encodedContent, String encodingName, String charset, String contentType); @Override byte[] getContent(String charSet); String getEncodingName(); RecordedHttpBody getDecodedBody();  }