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


Java MkContainer.start方法代码示例

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


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

示例1: canFetchNonEmptyListOfDeployKeys

import com.jcabi.http.mock.MkContainer; //导入方法依赖的package包/类
/**
 * RtDeployKeys can fetch non empty list of deploy keys.
 *
 * @throws IOException If some problem inside.
 */
@Test
public void canFetchNonEmptyListOfDeployKeys() throws IOException {
    final MkContainer container = new MkGrizzlyContainer().next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_OK,
            Json.createArrayBuilder()
                .add(key(1))
                .add(key(2))
                .build().toString()
        )
    );
    container.start();
    try {
        MatcherAssert.assertThat(
            new RtDeployKeys(
                new ApacheRequest(container.home()),
                RtDeployKeysTest.repo()
            ).iterate(),
            Matchers.<DeployKey>iterableWithSize(2)
        );
    } finally {
        container.stop();
    }
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:30,代码来源:RtDeployKeysTest.java

示例2: canCreateDeployKey

import com.jcabi.http.mock.MkContainer; //导入方法依赖的package包/类
/**
 * RtDeployKeys can create a key.
 * @throws IOException If some problem inside.
 */
@Test
public void canCreateDeployKey() throws IOException {
    final int number = 2;
    final MkContainer container = new MkGrizzlyContainer().next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_CREATED,
            String.format("{\"id\":%d}", number)
        )
    );
    container.start();
    try {
        final DeployKeys keys = new RtDeployKeys(
            new ApacheRequest(container.home()), RtDeployKeysTest.repo()
        );
        MatcherAssert.assertThat(
            keys.create("Title", "Key").number(),
            Matchers.equalTo(number)
        );
    } finally {
        container.stop();
    }
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:27,代码来源:RtDeployKeysTest.java

示例3: addsEmails

import com.jcabi.http.mock.MkContainer; //导入方法依赖的package包/类
/**
 * RtUserEmails can add emails.
 * @throws Exception If some problem inside
 */
@Test
public void addsEmails() throws Exception {
    final String email = "[email protected]";
    final MkContainer container = new MkGrizzlyContainer().next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_CREATED,
            String.format("[{\"email\":\"%s\"}]", email)
        )
    );
    container.start();
    try {
        final UserEmails emails = new RtUserEmails(
            new ApacheRequest(container.home())
        );
        MatcherAssert.assertThat(
            emails.add(Collections.singletonList(email)).iterator().next(),
            Matchers.equalTo(email)
        );
    } finally {
        container.stop();
    }
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:27,代码来源:RtUserEmailsTest.java

示例4: fork

import com.jcabi.http.mock.MkContainer; //导入方法依赖的package包/类
/**
 * RtGist can fork itself.
 *
 * @throws IOException If there is a problem.
 */
@Test
public void fork() throws IOException {
    final String fileContent = "success";
    final MkContainer container = new MkGrizzlyContainer();
    container.next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_OK,
            "{\"files\":{\"hello\":{\"raw_url\":\"world\"}}}"
        )
    );
    container.next(
        new MkAnswer.Simple(HttpURLConnection.HTTP_OK, fileContent)
    );
    container.next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_CREATED,
            "{\"id\": \"forked\"}"
        )
    );
    container.next(
        new MkAnswer.Simple(
            HttpURLConnection.HTTP_OK,
            "{\"files\":{\"hello\":{\"raw_url\":\"world\"}}}"
        )
    );
    container.next(
        new MkAnswer.Simple(HttpURLConnection.HTTP_OK, fileContent)
    );
    container.start();
    final Gist gist = new RtGist(
        new MkGithub(),
        new ApacheRequest(container.home()),
        "test"
    );
    final String content = gist.read("hello");
    final Gist forkedGist = gist.fork();
    try {
        MatcherAssert.assertThat(
            forkedGist.read("hello"),
            Matchers.equalTo(content)
        );
    } finally {
        container.stop();
    }
}
 
开发者ID:cvrebert,项目名称:typed-github,代码行数:51,代码来源:RtGistTest.java


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