{"action":"created","comment":{"url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/comments/244831001","pull_request_review_id":188799475,"id":244831001,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDgzMTAwMQ==","diff_hunk":"@@ -0,0 +1,143 @@\n+package uk.gov.hmcts.reform.iacaseapi.integration;\n+\n+import static com.github.tomakehurst.wiremock.client.WireMock.*;\n+import static org.hamcrest.CoreMatchers.is;\n+import static org.hamcrest.MatcherAssert.assertThat;\n+import static org.junit.Assert.assertFalse;\n+import static uk.gov.hmcts.reform.iacaseapi.integration.stubs.CcdMock.paginationMetadataUrl;\n+import static uk.gov.hmcts.reform.iacaseapi.integration.util.TestAsylumCaseBuilder.anAsylumCase;\n+import static uk.gov.hmcts.reform.iacaseapi.integration.util.TestFixtures.someListOfCasesIncludingButPriorTo;\n+\n+import com.fasterxml.jackson.core.JsonProcessingException;\n+import java.util.List;\n+import java.util.Optional;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.test.annotation.DirtiesContext;\n+import uk.gov.hmcts.reform.iacaseapi.domain.entities.ccd.field.AsylumAppealType;\n+import uk.gov.hmcts.reform.iacaseapi.domain.service.AppealReferenceNumberGenerator;\n+import uk.gov.hmcts.reform.iacaseapi.infrastructure.serialization.Serializer;\n+import uk.gov.hmcts.reform.iacaseapi.integration.stubs.CcdMock;\n+import uk.gov.hmcts.reform.iacaseapi.integration.util.IdamStubbedSpringBootIntegrationTest;\n+\n+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)\n+public class AppealReferenceNumberGeneratorIntegrationTest extends IdamStubbedSpringBootIntegrationTest {\n+\n+    @Autowired\n+    private AppealReferenceNumberGenerator appealReferenceNumberGenerator;\n+\n+    @Autowired\n+    private Serializer<List> ccdCaseListSerializer;\n+\n+    private CcdMock givenCcd;\n+\n+    @Before\n+    public void createCcdMock() {\n+        givenCcd = new CcdMock(ccdCaseListSerializer);\n+    }\n+\n+    @Test\n+    public void generates_revocation_of_protection_appeal_reference_number_when_there_are_no_previous_appeals_in_Ccd() throws JsonProcessingException {\n+\n+        givenCcd.doesntHaveAnyExistingAppealCases();\n+\n+        Optional<String> appealReferenceNumber =\n+            appealReferenceNumberGenerator\n+                .getNextAppealReferenceNumberFor(AsylumAppealType.RP.toString());\n+\n+        assertThat(appealReferenceNumber.get(), is(\"RP/50001/2018\"));","path":"src/integrationTest/java/uk/gov/hmcts/reform/iacaseapi/integration/AppealReferenceNumberGeneratorIntegrationTest.java","position":105,"original_position":49,"commit_id":"14c958b65dc7ef6e6daabc24b87c49810d463100","original_commit_id":"e07c51cda0ea26192c49688e42a16832c7e177d1","user":{"login":"Rob-Doherty","id":11600884,"node_id":"MDQ6VXNlcjExNjAwODg0","avatar_url":"https://avatars2.githubusercontent.com/u/11600884?v=4","gravatar_id":"","url":"https://api.github.com/users/Rob-Doherty","html_url":"https://github.com/Rob-Doherty","followers_url":"https://api.github.com/users/Rob-Doherty/followers","following_url":"https://api.github.com/users/Rob-Doherty/following{/other_user}","gists_url":"https://api.github.com/users/Rob-Doherty/gists{/gist_id}","starred_url":"https://api.github.com/users/Rob-Doherty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rob-Doherty/subscriptions","organizations_url":"https://api.github.com/users/Rob-Doherty/orgs","repos_url":"https://api.github.com/users/Rob-Doherty/repos","events_url":"https://api.github.com/users/Rob-Doherty/events{/privacy}","received_events_url":"https://api.github.com/users/Rob-Doherty/received_events","type":"User","site_admin":false},"body":"dates have now been fixed to 2018, but moving to 2019 has not broken them, and a test to cover this scenario has already been included","created_at":"2019-01-02T19:34:05Z","updated_at":"2019-01-02T19:34:05Z","html_url":"https://github.com/hmcts/ia-case-api/pull/38#discussion_r244831001","pull_request_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/comments/244831001"},"html":{"href":"https://github.com/hmcts/ia-case-api/pull/38#discussion_r244831001"},"pull_request":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38"}},"in_reply_to_id":243367744},"pull_request":{"url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38","id":237120555,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MTIwNTU1","html_url":"https://github.com/hmcts/ia-case-api/pull/38","diff_url":"https://github.com/hmcts/ia-case-api/pull/38.diff","patch_url":"https://github.com/hmcts/ia-case-api/pull/38.patch","issue_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/38","number":38,"state":"open","locked":false,"title":"Ria 581 create appeal reference number for a protection appeal","user":{"login":"t80","id":1504913,"node_id":"MDQ6VXNlcjE1MDQ5MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/1504913?v=4","gravatar_id":"","url":"https://api.github.com/users/t80","html_url":"https://github.com/t80","followers_url":"https://api.github.com/users/t80/followers","following_url":"https://api.github.com/users/t80/following{/other_user}","gists_url":"https://api.github.com/users/t80/gists{/gist_id}","starred_url":"https://api.github.com/users/t80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t80/subscriptions","organizations_url":"https://api.github.com/users/t80/orgs","repos_url":"https://api.github.com/users/t80/repos","events_url":"https://api.github.com/users/t80/events{/privacy}","received_events_url":"https://api.github.com/users/t80/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-09T10:01:43Z","updated_at":"2019-01-02T19:34:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f26b92a5e5d5c5a1d009d3a004c5eb87c3ea45b8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38/commits","review_comments_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38/comments","review_comment_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/38/comments","statuses_url":"https://api.github.com/repos/hmcts/ia-case-api/statuses/14c958b65dc7ef6e6daabc24b87c49810d463100","head":{"label":"hmcts:RIA-581-Create-appeal-reference-number-for-a-protection-appeal","ref":"RIA-581-Create-appeal-reference-number-for-a-protection-appeal","sha":"14c958b65dc7ef6e6daabc24b87c49810d463100","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":143270778,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMyNzA3Nzg=","name":"ia-case-api","full_name":"hmcts/ia-case-api","private":false,"owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmcts/ia-case-api","description":"Immigration & Asylum case API","fork":false,"url":"https://api.github.com/repos/hmcts/ia-case-api","forks_url":"https://api.github.com/repos/hmcts/ia-case-api/forks","keys_url":"https://api.github.com/repos/hmcts/ia-case-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/ia-case-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/ia-case-api/teams","hooks_url":"https://api.github.com/repos/hmcts/ia-case-api/hooks","issue_events_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/ia-case-api/events","assignees_url":"https://api.github.com/repos/hmcts/ia-case-api/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/ia-case-api/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/ia-case-api/tags","blobs_url":"https://api.github.com/repos/hmcts/ia-case-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/ia-case-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/ia-case-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/ia-case-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/ia-case-api/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/ia-case-api/languages","stargazers_url":"https://api.github.com/repos/hmcts/ia-case-api/stargazers","contributors_url":"https://api.github.com/repos/hmcts/ia-case-api/contributors","subscribers_url":"https://api.github.com/repos/hmcts/ia-case-api/subscribers","subscription_url":"https://api.github.com/repos/hmcts/ia-case-api/subscription","commits_url":"https://api.github.com/repos/hmcts/ia-case-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/ia-case-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/ia-case-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/ia-case-api/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/ia-case-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/ia-case-api/merges","archive_url":"https://api.github.com/repos/hmcts/ia-case-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/ia-case-api/downloads","issues_url":"https://api.github.com/repos/hmcts/ia-case-api/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/ia-case-api/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/ia-case-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/ia-case-api/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/ia-case-api/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/ia-case-api/deployments","created_at":"2018-08-02T09:11:26Z","updated_at":"2019-01-02T12:49:07Z","pushed_at":"2019-01-02T16:57:33Z","git_url":"git://github.com/hmcts/ia-case-api.git","ssh_url":"git@github.com:hmcts/ia-case-api.git","clone_url":"https://github.com/hmcts/ia-case-api.git","svn_url":"https://github.com/hmcts/ia-case-api","homepage":null,"size":717,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"hmcts:master","ref":"master","sha":"e7045e3dfdc0865b55e0cba9b469afa447b1f1c1","user":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"repo":{"id":143270778,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMyNzA3Nzg=","name":"ia-case-api","full_name":"hmcts/ia-case-api","private":false,"owner":{"login":"hmcts","id":22817111,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyODE3MTEx","avatar_url":"https://avatars1.githubusercontent.com/u/22817111?v=4","gravatar_id":"","url":"https://api.github.com/users/hmcts","html_url":"https://github.com/hmcts","followers_url":"https://api.github.com/users/hmcts/followers","following_url":"https://api.github.com/users/hmcts/following{/other_user}","gists_url":"https://api.github.com/users/hmcts/gists{/gist_id}","starred_url":"https://api.github.com/users/hmcts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmcts/subscriptions","organizations_url":"https://api.github.com/users/hmcts/orgs","repos_url":"https://api.github.com/users/hmcts/repos","events_url":"https://api.github.com/users/hmcts/events{/privacy}","received_events_url":"https://api.github.com/users/hmcts/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/hmcts/ia-case-api","description":"Immigration & Asylum case API","fork":false,"url":"https://api.github.com/repos/hmcts/ia-case-api","forks_url":"https://api.github.com/repos/hmcts/ia-case-api/forks","keys_url":"https://api.github.com/repos/hmcts/ia-case-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmcts/ia-case-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmcts/ia-case-api/teams","hooks_url":"https://api.github.com/repos/hmcts/ia-case-api/hooks","issue_events_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/events{/number}","events_url":"https://api.github.com/repos/hmcts/ia-case-api/events","assignees_url":"https://api.github.com/repos/hmcts/ia-case-api/assignees{/user}","branches_url":"https://api.github.com/repos/hmcts/ia-case-api/branches{/branch}","tags_url":"https://api.github.com/repos/hmcts/ia-case-api/tags","blobs_url":"https://api.github.com/repos/hmcts/ia-case-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmcts/ia-case-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmcts/ia-case-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmcts/ia-case-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmcts/ia-case-api/statuses/{sha}","languages_url":"https://api.github.com/repos/hmcts/ia-case-api/languages","stargazers_url":"https://api.github.com/repos/hmcts/ia-case-api/stargazers","contributors_url":"https://api.github.com/repos/hmcts/ia-case-api/contributors","subscribers_url":"https://api.github.com/repos/hmcts/ia-case-api/subscribers","subscription_url":"https://api.github.com/repos/hmcts/ia-case-api/subscription","commits_url":"https://api.github.com/repos/hmcts/ia-case-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmcts/ia-case-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmcts/ia-case-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmcts/ia-case-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmcts/ia-case-api/contents/{+path}","compare_url":"https://api.github.com/repos/hmcts/ia-case-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmcts/ia-case-api/merges","archive_url":"https://api.github.com/repos/hmcts/ia-case-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmcts/ia-case-api/downloads","issues_url":"https://api.github.com/repos/hmcts/ia-case-api/issues{/number}","pulls_url":"https://api.github.com/repos/hmcts/ia-case-api/pulls{/number}","milestones_url":"https://api.github.com/repos/hmcts/ia-case-api/milestones{/number}","notifications_url":"https://api.github.com/repos/hmcts/ia-case-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmcts/ia-case-api/labels{/name}","releases_url":"https://api.github.com/repos/hmcts/ia-case-api/releases{/id}","deployments_url":"https://api.github.com/repos/hmcts/ia-case-api/deployments","created_at":"2018-08-02T09:11:26Z","updated_at":"2019-01-02T12:49:07Z","pushed_at":"2019-01-02T16:57:33Z","git_url":"git://github.com/hmcts/ia-case-api.git","ssh_url":"git@github.com:hmcts/ia-case-api.git","clone_url":"https://github.com/hmcts/ia-case-api.git","svn_url":"https://github.com/hmcts/ia-case-api","homepage":null,"size":717,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":7,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38"},"html":{"href":"https://github.com/hmcts/ia-case-api/pull/38"},"issue":{"href":"https://api.github.com/repos/hmcts/ia-case-api/issues/38"},"comments":{"href":"https://api.github.com/repos/hmcts/ia-case-api/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmcts/ia-case-api/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/hmcts/ia-case-api/statuses/14c958b65dc7ef6e6daabc24b87c49810d463100"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Rob-Doherty"}}