MetaWeblog { @SuppressWarnings("unchecked") public Post getPost(String postid) throws XmlRpcException { Object[] pParams = {postid, configInfo.getUserName(), configInfo.getPassword()}; Object result = null; try { result = this.xmlRpcExecute.execute(configInfo.getServerUrl(), "metaWeblog.getPost", pParams); } catch (XmlRpcException e) { if (e.code == 404) { logger.debug("post is not found", e); return null; } throw e; } return result == null ? null : ReflectUtil.reflectFields(new Post(), (Map<String, Object>) result); } MetaWeblog(); String newPost(String blogid, Post post, boolean publish); boolean editPost(Post post, boolean publish); @SuppressWarnings("unchecked") Post getPost(String postid); boolean deletePost(String postid); void setConfigInfo(ConfigInfo configInfo); ConfigInfo getConfigInfo();  }
@Test public void getPost() throws Exception { when(xmlRpcClient.execute(anyString(), any(Objects[].class))).thenReturn(JsonUtil.readValue(JsonUtil.writeBytes(post), HashMap.class)); Assertions.assertThat(metaWeblog.getPost("1")).isEqualToIgnoringGivenFields(post, "dateCreated"); }