@Test public void testGetByteArray() throws Exception { String str = "Hello world"; byte[] content = str.getBytes(); RecordedStringHttpBody recordedStringHttpBody = new RecordedStringHttpBody(str); Assert.assertEquals(content, recordedStringHttpBody.getContent("UTF-8")); }
@Override public byte[] getContent(String charSet) { try { return _content.getBytes(charSet); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to get bytes from string"); } }
RecordedStringHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) { try { return _content.getBytes(charSet); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to get bytes from string"); } } }
RecordedStringHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) { try { return _content.getBytes(charSet); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to get bytes from string"); } } RecordedStringHttpBody(String content); }
RecordedStringHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) { try { return _content.getBytes(charSet); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to get bytes from string"); } } RecordedStringHttpBody(String content); @Override byte[] getContent(String charSet); String getContent(); @Override int hashCode(); @Override boolean equals(Object obj); }
RecordedStringHttpBody implements RecordedHttpBody { @Override public byte[] getContent(String charSet) { try { return _content.getBytes(charSet); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Failed to get bytes from string"); } } RecordedStringHttpBody(String content); @Override byte[] getContent(String charSet); String getContent(); @Override int hashCode(); @Override boolean equals(Object obj);  }