1 /**
2 * Copyright (c) 2013-2023, jcabi.com
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met: 1) Redistributions of source code must retain the above
8 * copyright notice, this list of conditions and the following
9 * disclaimer. 2) Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution. 3) Neither the name of the jcabi.com nor
13 * the names of its contributors may be used to endorse or promote
14 * products derived from this software without specific prior written
15 * permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
19 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 package com.jcabi.github.mock;
31
32 import com.jcabi.github.Issue;
33 import com.jcabi.github.Pull;
34 import com.jcabi.github.Repo;
35 import org.hamcrest.MatcherAssert;
36 import org.hamcrest.Matchers;
37 import org.junit.Ignore;
38 import org.junit.Test;
39
40 /**
41 * Test case for {@link MkPulls}.
42 * @author Paul Polishchuk (ppol@ua.fm)
43 * @version $Id: e3093ec7c206f3739f8620e500587e1a21ee76ce $
44 * @since 1.0
45 * @checkstyle MultipleStringLiteralsCheck (100 lines)
46 */
47 public final class MkPullsTest {
48
49 /**
50 * MkPulls can create a pull.
51 * It should create an issue first, and then pull with the same number
52 * @throws Exception if some problem inside
53 */
54 @Test
55 public void canCreateAPull() throws Exception {
56 final Repo repo = new MkGithub().randomRepo();
57 final Pull pull = repo.pulls().create(
58 "hello",
59 "head-branch",
60 "base-branch"
61 );
62 final Issue.Smart issue = new Issue.Smart(
63 repo.issues().get(pull.number())
64 );
65 MatcherAssert.assertThat(
66 issue.title(),
67 Matchers.is("hello")
68 );
69 }
70
71 /**
72 * MkPulls can fetch empty list of pulls.
73 */
74 @Test
75 @Ignore
76 public void canFetchEmptyListOfPulls() {
77 // to be implemented
78 }
79
80 /**
81 * MkPulls can fetch single pull.
82 */
83 @Test
84 @Ignore
85 public void canFetchSinglePull() {
86 // to be implemented
87 }
88 }