RequestBodyBuilderImpl implements RequestBodyBuilder { public RequestBody getBody() { if (body == null) { throw new IllegalStateException("A RequestBodyBuilder was requested, but no body was defined."); } return body; } RequestBodyBuilderImpl(ObjectMapper mapper); @Override void string(String str, String mediaType); @Override void file(Path path, String mediaType); @Override void json(Object payload); RequestBody getBody(); String getFileName();  }
@Test(expected = IllegalStateException.class) public void testGetBodyIfUndefined() { bodyBuilder.getBody(); }