### Question:
ProjectServiceV1 extends AbstractService { @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) public CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author) { return execute(Command.createProject(author, request.name())) .handle(returnOrThrow(() -> DtoConverter.convert(projectManager().get(request.name())))); } ProjectServiceV1(ProjectManager projectManager, CommandExecutor executor, MetadataService mds); @Get("/projects") CompletableFuture<List<ProjectDto>> listProjects(@Param @Nullable String status); @Post("/projects") @StatusCode(201) @ResponseConverter(CreateApiResponseConverter.class) CompletableFuture<ProjectDto> createProject(CreateProjectRequest request, Author author); @Get("/projects/{projectName}") @RequiresRole(roles = { ProjectRole.OWNER, ProjectRole.MEMBER }) CompletableFuture<ProjectMetadata> getProjectMetadata(
            @Param String projectName,
            @Param("checkPermissionOnly") @Default("false") boolean isCheckPermissionOnly); @Delete("/projects/{projectName}") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> removeProject(Project project, Author author); @Delete("/projects/{projectName}/removed") @RequiresRole(roles = ProjectRole.OWNER) CompletableFuture<Void> purgeProject(@Param String projectName, Author author); @Consumes("application/json-patch+json") @Patch("/projects/{projectName}") @RequiresAdministrator CompletableFuture<ProjectDto> patchProject(@Param String projectName, JsonNode node, Author author);  }### Answer:
@Test void createProject() throws IOException { final WebClient client = dogma.httpClient(); final AggregatedHttpResponse aRes = createProject(client, "myPro"); final ResponseHeaders headers = ResponseHeaders.of(aRes.headers()); assertThat(headers.status()).isEqualTo(HttpStatus.CREATED); final String location = headers.get(HttpHeaderNames.LOCATION); assertThat(location).isEqualTo("/api/v1/projects/myPro"); final JsonNode jsonNode = Jackson.readTree(aRes.contentUtf8()); assertThat(jsonNode.get("name").asText()).isEqualTo("myPro"); assertThat(jsonNode.get("createdAt").asText()).isNotNull(); }
@Test void createProjectWithSameName() { final WebClient client = dogma.httpClient(); createProject(client, "myNewPro"); final AggregatedHttpResponse res = createProject(client, "myNewPro"); assertThat(ResponseHeaders.of(res.headers()).status()).isEqualTo(HttpStatus.CONFLICT); final String expectedJson = '{' + " \"exception\": \"" + ProjectExistsException.class.getName() + "\"," + " \"message\": \"Project 'myNewPro' exists already.\"" + '}'; assertThatJson(res.contentUtf8()).isEqualTo(expectedJson); }
@Test void unremoveProject() { final WebClient client = dogma.httpClient(); createProject(client, "bar"); final String projectPath = PROJECTS_PREFIX + "/bar"; client.delete(projectPath).aggregate().join(); final RequestHeaders headers = RequestHeaders.of(HttpMethod.PATCH, projectPath, HttpHeaderNames.CONTENT_TYPE, MediaType.JSON_PATCH); final String unremovePatch = "[{\"op\":\"replace\",\"path\":\"/status\",\"value\":\"active\"}]"; final AggregatedHttpResponse aRes = client.execute(headers, unremovePatch).aggregate().join(); assertThat(ResponseHeaders.of(aRes.headers()).status()).isEqualTo(HttpStatus.OK); final String expectedJson = '{' + " \"name\": \"bar\"," + " \"creator\": {" + " \"name\": \"System\"," + " \"email\": \"system@localhost.localdomain\"" + " }," + " \"url\": \"/api/v1/projects/bar\"," + " \"createdAt\": \"${json-unit.ignore}\"" + '}'; assertThatJson(aRes.contentUtf8()).isEqualTo(expectedJson); }