当前位置: 首页>>代码示例>>Java>>正文


Java MkAnswer.Simple方法代码示例

本文整理汇总了Java中com.jcabi.http.mock.MkAnswer.Simple方法的典型用法代码示例。如果您正苦于以下问题:Java MkAnswer.Simple方法的具体用法?Java MkAnswer.Simple怎么用?Java MkAnswer.Simple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jcabi.http.mock.MkAnswer的用法示例。


在下文中一共展示了MkAnswer.Simple方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simple

import com.jcabi.http.mock.MkAnswer; //导入方法依赖的package包/类
/**
 * Create and return MkAnswer.Simple to test.
 * @param msg Message to build MkAnswer.Simple
 * @return MkAnswer.Simple
 * @throws Exception If some problem inside
 */
private static  MkAnswer.Simple simple(final String msg) throws Exception {
    final String message = Json.createArrayBuilder()
        .add(Json.createObjectBuilder().add("msg", msg))
        .build().toString();
    return new MkAnswer.Simple(HttpURLConnection.HTTP_OK, message);
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:13,代码来源:RtPaginationTest.java

示例2: answer

import com.jcabi.http.mock.MkAnswer; //导入方法依赖的package包/类
/**
 * Create and return success MkAnswer object to test.
 * @param organization The organization of the fork
 * @return Success MkAnswer
 */
private MkAnswer.Simple answer(final String organization) {
    return new MkAnswer.Simple(
        HttpURLConnection.HTTP_OK,
        RtForkTest.fork(organization).toString()
    );
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:12,代码来源:RtForkTest.java

示例3: simple

import com.jcabi.http.mock.MkAnswer; //导入方法依赖的package包/类
/**
 * Create and return MkAnswer.Simple to test.
 * @param one First array element
 * @param another Second array element
 * @return MkAnswer.Simple
 * @throws Exception If some problem inside
 */
private static MkAnswer.Simple simple(final String one,
    final String another
) throws Exception {
    final String message = Json.createArrayBuilder()
        .add(Json.createArrayBuilder().add(one).add(another))
        .build().toString();
    return new MkAnswer.Simple(HttpURLConnection.HTTP_OK, message);
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:16,代码来源:RtValuePaginationTest.java

示例4: iteratesOverBranches

import com.jcabi.http.mock.MkAnswer; //导入方法依赖的package包/类
/**
 * RtBranches can iterate over all branches.
 * @throws Exception if there is any error
 */
@Test
public void iteratesOverBranches() throws Exception {
    final String firstname = "first";
    final String firstsha = "a971b1aca044105897297b87b0b0983a54dd5817";
    final String secondname = "second";
    final String secondsha = "5d8dc2acf9c95d0d4e8881eebe04c2f0cbb249ff";
    final MkAnswer answer = new MkAnswer.Simple(
        HttpURLConnection.HTTP_OK,
        Json.createArrayBuilder()
            .add(branch(firstname, firstsha))
            .add(branch(secondname, secondsha))
            .build().toString()
    );
    final MkContainer container = new MkGrizzlyContainer()
        .next(answer)
        .next(answer)
        .start();
    final RtBranches branches = new RtBranches(
        new JdkRequest(container.home()),
        new MkGithub().randomRepo()
    );
    MatcherAssert.assertThat(
        branches.iterate(),
        Matchers.<Branch>iterableWithSize(2)
    );
    final Iterator<Branch> iter = branches.iterate().iterator();
    final Branch first = iter.next();
    MatcherAssert.assertThat(first.name(), Matchers.equalTo(firstname));
    MatcherAssert.assertThat(
        first.commit().sha(),
        Matchers.equalTo(firstsha)
    );
    final Branch second = iter.next();
    MatcherAssert.assertThat(second.name(), Matchers.equalTo(secondname));
    MatcherAssert.assertThat(
        second.commit().sha(),
        Matchers.equalTo(secondsha)
    );
    container.stop();
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:45,代码来源:RtBranchesTest.java

示例5: patchAndCheckJsonGistComment

import com.jcabi.http.mock.MkAnswer; //导入方法依赖的package包/类
/**
 * RtGistComment can patch comment and return new json.
 * @throws IOException if has some problems with json parsing.
 */
@Test
public final void patchAndCheckJsonGistComment() throws IOException {
    final int identifier = 1;
    final String idString = "id";
    final String bodyString = "body";
    final String body = "somebody";
    final String patchedBody = "some patchedbody";
    final MkAnswer first = new MkAnswer.Simple(
        HttpURLConnection.HTTP_OK,
        Json.createObjectBuilder()
            .add(bodyString, body)
            .add(idString, identifier)
            .build().toString()
    );
    final MkAnswer second = new MkAnswer.Simple(
        HttpURLConnection.HTTP_OK,
        Json.createObjectBuilder()
            .add(bodyString, patchedBody)
            .add(idString, identifier)
            .build().toString()
    );
    final MkAnswer third = new MkAnswer.Simple(
        HttpURLConnection.HTTP_OK,
        Json.createObjectBuilder()
            .add(bodyString, body)
            .add(idString, identifier)
            .build().toString()
    );
    final MkContainer container =
        new MkGrizzlyContainer().next(first).next(second).next(third)
            .start();
    final MkContainer gistContainer = new MkGrizzlyContainer().start();
    final RtGist gist =
        new RtGist(
            new MkGithub(),
            new ApacheRequest(gistContainer.home()), "someName"
        );
    final RtGistComment comment = new RtGistComment(
        new ApacheRequest(container.home()), gist, identifier
    );
    comment.patch(Json.createObjectBuilder()
        .add(bodyString, patchedBody)
        .add(idString, identifier)
        .build()
    );
    MatcherAssert.assertThat(
        comment.json().getString(bodyString),
        Matchers.equalTo(patchedBody)
    );
    container.stop();
    gistContainer.stop();
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:57,代码来源:RtGistCommentTest.java


注:本文中的com.jcabi.http.mock.MkAnswer.Simple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。