MetaWeblog { public String newPost(String blogid, Post post, boolean publish) throws XmlRpcException { if (blogid == null || post == null || post.getDateCreated() == null || post.getDescription() == null || post.getTitle() == null) { throw new IllegalArgumentException( "blogid,post,post.Title,post.DateCreated,post.Description cannot be null!"); } Object[] pParams = {blogid, configInfo.getUserName(), configInfo.getPassword(), ReflectUtil.toXMLRPCParams(post), publish}; return (String) this.xmlRpcExecute.execute(configInfo.getServerUrl(), "metaWeblog.newPost", pParams); } 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 newPost() throws Exception { Object[] pramas = {"1", configInfo.getUserName(), configInfo.getPassword(), ReflectUtil.toXMLRPCParams(post), true}; String postId = "2"; when(xmlRpcClient.execute(anyString(), any(Object[].class))).thenReturn(postId); assertThat(metaWeblog.newPost("1", post, true)).isEqualTo(postId); }