Package com.jcabi.http.mock

Examples of com.jcabi.http.mock.MkGrizzlyContainer


     *
     * @throws Exception if there is any problem
     */
    @Test(expected = NoSuchElementException.class)
    public void throwsIfNoMoreElement() throws Exception {
        final MkContainer container = new MkGrizzlyContainer()
            .next(simple("Hi there")).start();
        try {
            final Request request = new ApacheRequest(container.home());
            final RtPagination<JsonObject> page = new RtPagination<JsonObject>(
                request, new RtPagination.Mapping<JsonObject, JsonObject>() {
View Full Code Here


     */
    @Test
    public void canCreateRelease() throws Exception {
        final String tag = "v1.0.0";
        final String rel = release(tag).toString();
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, rel)
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, rel)).start();
        final RtReleases releases = new RtReleases(
            new JdkRequest(container.home()),
            repo()
View Full Code Here

     * RtReleases can delete a release.
     * @throws Exception If some problem inside
     */
    @Test
    public void canDeleteRelease() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_NO_CONTENT,
                ""
            )
        ).start();
View Full Code Here

     */
    @Test
    public void createPull() throws Exception {
        final String title = "new feature";
        final String body = pull(title).toString();
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, body)
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)).start();
        final RtPulls pulls = new RtPulls(
            new ApacheRequest(container.home()),
            repo()
View Full Code Here

     * @throws Exception if some problem inside
     */
    @Test
    public void getSinglePull() throws Exception {
        final String title = "new-feature";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                pull(title).toString()
            )
        ).start();
View Full Code Here

     * RtPulls can iterate pulls.
     * @throws Exception if there is any error
     */
    @Test
    public void iteratePulls() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                Json.createArrayBuilder()
                    .add(pull("new-topic"))
                    .add(pull("Amazing new feature"))
View Full Code Here

     * RtReleaseAsset can create a patch request.
     * @throws Exception If a problem occurs.
     */
    @Test
    public void patchesAsset() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
        ).start();
        final RtReleaseAsset asset = new RtReleaseAsset(
            new ApacheRequest(container.home()),
            release(),
View Full Code Here

     * RtReleaseAsset can remove itself.
     * @throws Exception If a problem occurs.
     */
    @Test
    public void removesAsset() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, "")
        ).start();
        final RtReleaseAsset asset = new RtReleaseAsset(
            new ApacheRequest(container.home()),
            release(),
View Full Code Here

     * RtReleaseAsset can stream raw content.
     * @throws Exception If a problem occurs.
     */
    @Test
    public void rawAsset() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "")
        ).start();
        final RtReleaseAsset asset = new RtReleaseAsset(
            new ApacheRequest(container.home()),
            release(),
View Full Code Here

     *
     * @throws Exception if there is any problem
     */
    @Test
    public void sendHttpRequest() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"body\":\"hi\"}")
        ).start();
        final RtJson json = new RtJson(new ApacheRequest(container.home()));
        MatcherAssert.assertThat(
            json.fetch().getString("body"),
View Full Code Here

TOP

Related Classes of com.jcabi.http.mock.MkGrizzlyContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.