Package com.jcabi.http.mock

Examples of com.jcabi.http.mock.MkGrizzlyContainer


     * RtHooks can fetch empty list of hooks.
     * @throws Exception if some problem inside
     */
    @Test
    public void canFetchEmptyListOfHooks() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "[]")
        ).start();
        final Hooks hooks = new RtHooks(
            new JdkRequest(container.home()),
            RtHooksTest.repo()
View Full Code Here


     * RtHooks can fetch non empty list of hooks.
     * @throws Exception if some problem inside
     */
    @Test
    public void canFetchNonEmptyListOfHooks() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                Json.createArrayBuilder()
                    .add(hook("hook 1", Collections.<String, String>emptyMap()))
                    .add(hook("hook 2", Collections.<String, String>emptyMap()))
View Full Code Here

     * @throws Exception if some problem inside
     */
    @Test
    public void canFetchSingleHook() throws Exception {
        final String name = "hook name";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                RtHooksTest.hook(
                    name,
                    Collections.<String, String>emptyMap()
View Full Code Here

        final ConcurrentHashMap<String, String> config =
            new ConcurrentHashMap<String, String>(2);
        config.put("url", "http://example.com");
        config.put("content_type", "json");
        final String body = RtHooksTest.hook(name, config).toString();
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, body)
        ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body)).start();
        final Hooks hooks = new RtHooks(
            new JdkRequest(container.home()),
            RtHooksTest.repo()
View Full Code Here

     *
     * @throws Exception if something goes wrong.
     */
    @Test
    public void canDeleteHook() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, "")
        ).start();
        final Hooks hooks = new RtHooks(
            new JdkRequest(container.home()),
            RtHooksTest.repo()
View Full Code Here

     * @throws Exception if there is any error
     */
    @Test
    public void iterateUsers() throws Exception {
        final String identifier = "1";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                Json.createArrayBuilder()
                    .add(RtUsersTest.json("octocat", identifier))
                    .add(RtUsersTest.json("dummy", "2"))
View Full Code Here

     * @throws Exception  if there is any error
     */
    @Test
    public void getSingleUser() throws Exception {
        final String login = "mark";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                RtUsersTest.json(login, "3").toString()
            )
        ).start();
View Full Code Here

     * @throws Exception  if there is any error
     */
    @Test
    public void getCurrentUser() throws Exception {
        final String login = "kendy";
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                RtUsersTest.json(login, "4").toString()
            )
        ).start();
View Full Code Here

     * RtReferences should create and return a Reference.
     * @throws Exception - if something goes wrong.
     */
    @Test
    public void createsReference() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_CREATED,
                "{\"ref\":\"refs/heads/feature-a\"}"
            )
        ).start();
View Full Code Here

     * RtReferences should be able to iterate over References.
     * @throws Exception - If something goes wrong.
     */
    @Test
    public void iteratesReferences() throws Exception {
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(
                HttpURLConnection.HTTP_OK,
                "{\"ref\":\"refs/heads/feature-a\"}"
            )
        ).start();
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.