From 1abb4330582eecfb63dcd8508105bf4a248aaf2b Mon Sep 17 00:00:00 2001 From: David Weber Date: Thu, 18 Jan 2024 13:11:10 +0100 Subject: [PATCH] feat: remove rest v1 BREAKING CHANGE: as v1 is removed --- .gitignore | 3 +- docs/openapi.json | 237 ------------------ docs/swagger.json | 228 ----------------- pom.xml | 4 +- .../corellia/api/ContractRestController.java | 51 ---- .../corellia/api/entities/ContractV1.java | 175 ------------- .../api/entities/DocumentTypeTest.java | 4 +- 7 files changed, 6 insertions(+), 696 deletions(-) delete mode 100644 src/main/java/ch/baloise/corellia/api/entities/ContractV1.java diff --git a/.gitignore b/.gitignore index a85a0ec..cf3e997 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ target/ .idea/ *.iml -node_modules/ \ No newline at end of file +node_modules/ +.idea \ No newline at end of file diff --git a/docs/openapi.json b/docs/openapi.json index 2e00226..c2c677c 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -255,178 +255,6 @@ } } } - }, - "/contracts/v1" : { - "post" : { - "tags" : [ "contracts" ], - "summary" : "Upload a contract V1 to the insurer.", - "description" : "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown", - "operationId" : "uploadContractV1", - "parameters" : [ { - "name" : "X-Caller-Name", - "in" : "header", - "description" : "Identifying the sender of this event (request) ", - "required" : true, - "schema" : { - "type" : "string", - "description" : "Defined by the callee" - } - }, { - "name" : "X-Event-ID", - "in" : "header", - "description" : "Unique identifier per event (request)", - "required" : true, - "schema" : { - "type" : "string", - "description" : "Generated UUID", - "format" : "uuid" - } - } ], - "requestBody" : { - "description" : "Contract that needs to be uploaded to the insurer", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ContractV1" - } - } - }, - "required" : true - }, - "responses" : { - "default" : { - "description" : "A handle to the contract for conversation with the insurer is provided", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ContractReference" - } - } - } - }, - "400" : { - "description" : "Invalid contract is provided. See ErrorResponse for more information about validation issues", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "503" : { - "description" : "Technical issue on server side, please retry later", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/contracts/v1/documents" : { - "post" : { - "tags" : [ "documents" ], - "summary" : "Upload a document for a contract.", - "description" : "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract", - "operationId" : "uploadDocumentV1", - "parameters" : [ { - "name" : "X-Caller-Name", - "in" : "header", - "description" : "Identifying the sender of this event (request) ", - "required" : true, - "schema" : { - "type" : "string", - "description" : "Defined by the callee" - } - }, { - "name" : "X-Event-ID", - "in" : "header", - "description" : "Unique identifier per event (request)", - "required" : true, - "schema" : { - "type" : "string", - "description" : "Generated UUID", - "format" : "uuid" - } - } ], - "requestBody" : { - "description" : "a documnent that is part of a contract", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/Document" - } - } - }, - "required" : true - }, - "responses" : { - "default" : { - "description" : "A handle for the uploaded document which can be used in providing a new contract via POST contracts", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/FileHandle" - } - } - } - }, - "400" : { - "description" : "Invalid document is provided. See ErrorResponse for more information about validation issues", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - }, - "503" : { - "description" : "Technical issue on server side, please retry later", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/contracts/v1/version" : { - "get" : { - "tags" : [ "version" ], - "summary" : "Callable way of retrieving current API version (following semver)", - "description" : "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.", - "operationId" : "versionV1", - "responses" : { - "default" : { - "description" : "Version identifier", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/Version" - } - } - } - }, - "503" : { - "description" : "Technical issue on server side, please retry later", - "content" : { - "application/json; charset=UTF-8" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" - } - } - } - } - } - } } }, "components" : { @@ -942,71 +770,6 @@ "format" : "int32" } } - }, - "ContractV1" : { - "required" : [ "conditionMonthYear", "contractId", "creationDate", "endDate", "fileHandles", "paymentCode", "product", "roles", "startDate", "totalNetPrice" ], - "type" : "object", - "properties" : { - "creationDate" : { - "type" : "string", - "description" : "The day the contract was issued", - "format" : "date" - }, - "startDate" : { - "type" : "string", - "description" : "Start of contract which means start of insurance coverage", - "format" : "date" - }, - "endDate" : { - "type" : "string", - "description" : "End of contract which means end of insurance coverage", - "format" : "date" - }, - "contractId" : { - "maxLength" : 20, - "minLength" : 0, - "type" : "string", - "description" : "Id given by SaaS provider" - }, - "totalNetPrice" : { - "$ref" : "#/components/schemas/MonetaryAmount" - }, - "roles" : { - "maxItems" : 99, - "minItems" : 1, - "type" : "array", - "description" : "All roles in the contract, e.g. insuranceHolder", - "items" : { - "$ref" : "#/components/schemas/Role" - } - }, - "product" : { - "$ref" : "#/components/schemas/Product" - }, - "agent" : { - "$ref" : "#/components/schemas/Agent" - }, - "paymentCode" : { - "type" : "integer", - "description" : "A code uniquely identifying the type of payment e.g. invoice or creditcard, Paypal etc.", - "format" : "int32" - }, - "fileHandles" : { - "maxItems" : 2, - "minItems" : 0, - "type" : "array", - "description" : "A contract is only complete with its corresponding documents. This is the contract issued by the SaaS provider and maybe some further documents like e.g. customer provided documents like e.g. receipts. At least one contract document is required", - "items" : { - "$ref" : "#/components/schemas/FileHandle" - } - }, - "conditionMonthYear" : { - "maxLength" : 4, - "minLength" : 4, - "type" : "string", - "description" : "When was the condition issued? Format MMYY" - } - } } } } diff --git a/docs/swagger.json b/docs/swagger.json index a8bfc29..74ba63c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -13,158 +13,6 @@ "version": "0.1.0" }, "paths": { - "/contracts/v1": { - "post": { - "consumes": [ - "application/json; charset=UTF-8" - ], - "produces": [ - "application/json; charset=UTF-8" - ], - "parameters": [ - { - "description": "Identifying the sender of this event (request) ", - "in": "header", - "name": "X-Caller-Name", - "required": true, - "type": "string" - }, - { - "description": "Unique identifier per event (request)", - "format": "uuid", - "in": "header", - "name": "X-Event-ID", - "required": true, - "type": "string" - }, - { - "description": "Contract that needs to be uploaded to the insurer", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ContractV1" - } - } - ], - "responses": { - "400": { - "description": "Invalid contract is provided. See ErrorResponse for more information about validation issues", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "503": { - "description": "Technical issue on server side, please retry later", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "default": { - "description": "A handle to the contract for conversation with the insurer is provided", - "schema": { - "$ref": "#/definitions/ContractReference" - } - } - }, - "tags": [ - "contracts" - ], - "description": "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown", - "operationId": "uploadContractV1", - "summary": "Upload a contract V1 to the insurer." - } - }, - "/contracts/v1/documents": { - "post": { - "consumes": [ - "application/json; charset=UTF-8" - ], - "produces": [ - "application/json; charset=UTF-8" - ], - "parameters": [ - { - "description": "Identifying the sender of this event (request) ", - "in": "header", - "name": "X-Caller-Name", - "required": true, - "type": "string" - }, - { - "description": "Unique identifier per event (request)", - "format": "uuid", - "in": "header", - "name": "X-Event-ID", - "required": true, - "type": "string" - }, - { - "description": "a documnent that is part of a contract", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Document" - } - } - ], - "responses": { - "400": { - "description": "Invalid document is provided. See ErrorResponse for more information about validation issues", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "503": { - "description": "Technical issue on server side, please retry later", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "default": { - "description": "A handle for the uploaded document which can be used in providing a new contract via POST contracts", - "schema": { - "$ref": "#/definitions/FileHandle" - } - } - }, - "tags": [ - "documents" - ], - "description": "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract", - "operationId": "uploadDocumentV1", - "summary": "Upload a document for a contract." - } - }, - "/contracts/v1/version": { - "get": { - "produces": [ - "application/json; charset=UTF-8" - ], - "parameters": [], - "responses": { - "503": { - "description": "Technical issue on server side, please retry later", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, - "default": { - "description": "Version identifier", - "schema": { - "$ref": "#/definitions/Version" - } - } - }, - "tags": [ - "version" - ], - "description": "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.", - "operationId": "versionV1", - "summary": "Callable way of retrieving current API version (following semver)" - } - }, "/contracts/v2": { "post": { "consumes": [ @@ -636,82 +484,6 @@ }, "type": "object" }, - "ContractV1": { - "properties": { - "agent": { - "$ref": "#/definitions/Agent" - }, - "conditionMonthYear": { - "description": "When was the condition issued? Format MMYY", - "maxLength": 4, - "minLength": 4, - "type": "string" - }, - "contractId": { - "description": "Id given by SaaS provider", - "maxLength": 20, - "minLength": 0, - "type": "string" - }, - "creationDate": { - "description": "The day the contract was issued", - "format": "date", - "type": "string" - }, - "endDate": { - "description": "End of contract which means end of insurance coverage", - "format": "date", - "type": "string" - }, - "fileHandles": { - "description": "A contract is only complete with its corresponding documents. This is the contract issued by the SaaS provider and maybe some further documents like e.g. customer provided documents like e.g. receipts. At least one contract document is required", - "items": { - "$ref": "#/definitions/FileHandle" - }, - "maxItems": 2, - "minItems": 0, - "type": "array" - }, - "paymentCode": { - "description": "A code uniquely identifying the type of payment e.g. invoice or creditcard, Paypal etc.", - "format": "int32", - "type": "integer" - }, - "product": { - "$ref": "#/definitions/Product" - }, - "roles": { - "description": "All roles in the contract, e.g. insuranceHolder", - "items": { - "$ref": "#/definitions/Role" - }, - "maxItems": 99, - "minItems": 1, - "type": "array" - }, - "startDate": { - "description": "Start of contract which means start of insurance coverage", - "format": "date", - "type": "string" - }, - "totalNetPrice": { - "$ref": "#/definitions/MonetaryAmount" - } - }, - "required": [ - "conditionMonthYear", - "contractId", - "creationDate", - "endDate", - "fileHandles", - "paymentCode", - "product", - "roles", - "startDate", - "totalNetPrice" - ], - "type": "object" - }, "Coverable": { "properties": { "code": { diff --git a/pom.xml b/pom.xml index 8a532bb..ad44eff 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ ch.baloise.corellia api - 2.0.5-SNAPSHOT + 3.0.0-SNAPSHOT jar @@ -39,7 +39,7 @@ https://github.com/baloise/corellia.git scm:git:https://github.com/baloise/corellia.git scm:git:https://github.com/baloise/corellia.git - v2.0.1 + v3.0.0 diff --git a/src/main/java/ch/baloise/corellia/api/ContractRestController.java b/src/main/java/ch/baloise/corellia/api/ContractRestController.java index 455aac4..58b9357 100644 --- a/src/main/java/ch/baloise/corellia/api/ContractRestController.java +++ b/src/main/java/ch/baloise/corellia/api/ContractRestController.java @@ -17,7 +17,6 @@ import ch.baloise.corellia.api.entities.Cancellation; import ch.baloise.corellia.api.entities.Contract; -import ch.baloise.corellia.api.entities.ContractV1; import ch.baloise.corellia.api.entities.Document; import ch.baloise.corellia.api.entities.Version; import io.swagger.v3.oas.annotations.Operation; @@ -42,26 +41,6 @@ public interface ContractRestController { String X_EVENT_ID = "X-Event-ID"; String X_CALLER_NAME = "X-Caller-Name"; - @Path("/v1") - @POST - @Operation(summary = "Upload a contract V1 to the insurer.", - tags = {"contracts"}, - description = "Uploads a contract. If validation fails processing is refused, a corresponding error is thrown", - responses = { - @ApiResponse(description = "A handle to the contract for conversation with the insurer is provided", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ContractReference.class))), - @ApiResponse(responseCode = "400", description = "Invalid contract is provided. See ErrorResponse for more information about validation issues", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))), - @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))) - }) - - public ch.baloise.corellia.api.entities.ContractReference uploadContractV1( - @Parameter(in = ParameterIn.HEADER, name= X_CALLER_NAME, required = true, description = "Identifying the sender of this event (request) ", // - schema = @Schema(type = "string", description = "Defined by the callee")) - @HeaderParam(X_CALLER_NAME) String callerName, - @Parameter(in = ParameterIn.HEADER, name= X_EVENT_ID, required = true, description = "Unique identifier per event (request)", // - schema = @Schema(type = "string", format = "uuid", description = "Generated UUID")) - @HeaderParam(X_EVENT_ID) String eventId, - @Parameter(description = "Contract that needs to be uploaded to the insurer", required = true) ContractV1 contractV1); - @Path("/v2") @POST @Operation(summary = "Upload a contract to the insurer.", @@ -82,25 +61,6 @@ public ch.baloise.corellia.api.entities.ContractReference uploadContract( @HeaderParam(X_EVENT_ID) String eventId, @Parameter(description = "Contract that needs to be uploaded to the insurer", required = true) Contract contract); - @POST - @Path("/v1/documents") - @Operation(summary = "Upload a document for a contract.", - tags = {"documents"}, - description = "Please note that this operation needs to be called per document for a contract to be uploaded. The response contains a handle to the document. This handle should be provided with the contract to be uploaded via uploadContract", - responses = { - @ApiResponse(description = "A handle for the uploaded document which can be used in providing a new contract via POST contracts", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.FileHandle.class))), - @ApiResponse(responseCode = "400", description = "Invalid document is provided. See ErrorResponse for more information about validation issues", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))), - @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))), - }) - public ch.baloise.corellia.api.entities.FileHandle uploadDocumentV1( - @Parameter(in = ParameterIn.HEADER, name= X_CALLER_NAME, required = true, description = "Identifying the sender of this event (request) ", // - schema = @Schema(type = "string", description = "Defined by the callee")) - @HeaderParam(X_CALLER_NAME) String callerName, - @Parameter(in = ParameterIn.HEADER, name= X_EVENT_ID, required = true, description = "Unique identifier per event (request)", // - schema = @Schema(type = "string", format = "uuid", description = "Generated UUID")) - @HeaderParam(X_EVENT_ID) String eventId, - @Parameter(description = "a documnent that is part of a contract", required = true) Document document); - @POST @Path("/v2/documents") @Operation(summary = "Upload a document for a contract.", @@ -120,17 +80,6 @@ public ch.baloise.corellia.api.entities.FileHandle uploadDocument( @HeaderParam(X_EVENT_ID) String eventId, @Parameter(description = "a documnent that is part of a contract", required = true) Document document); - @GET - @Path("/v1/version") - @Operation(summary = "Callable way of retrieving current API version (following semver)", - tags = {"version"}, - description = "Endpoint to retrieve the current API version (following semver). Can be compared to the URI version. Can be used for testing purposes.", - responses = { - @ApiResponse(description = "Version identifier", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.Version.class))), - @ApiResponse(responseCode = "503", description = "Technical issue on server side, please retry later", content = @Content(schema = @Schema(implementation = ch.baloise.corellia.api.entities.ErrorResponse.class))), - }) - public Version versionV1(); - @GET @Path("/v2/version") @Operation(summary = "Callable way of retrieving current API version (following semver)", diff --git a/src/main/java/ch/baloise/corellia/api/entities/ContractV1.java b/src/main/java/ch/baloise/corellia/api/entities/ContractV1.java deleted file mode 100644 index 441f070..0000000 --- a/src/main/java/ch/baloise/corellia/api/entities/ContractV1.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2018 Baloise Group - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.baloise.corellia.api.entities; - -import static ch.baloise.corellia.api.constraints.SizeConstraint.CONTRACT_FILE_HANDLES_MAX_SIZE; -import static ch.baloise.corellia.api.constraints.SizeConstraint.CONTRACT_FILE_HANDLES_MIN_SIZE; -import static ch.baloise.corellia.api.constraints.SizeConstraint.CONTRACT_ID_MAX_SIZE; -import static ch.baloise.corellia.api.constraints.SizeConstraint.LIST_MAX_SIZE; -import static ch.baloise.corellia.api.constraints.SizeConstraint.MONTH_YEAR_SIZE; - -import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import java.io.Serializable; -import java.time.LocalDate; -import java.util.List; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -public class ContractV1 implements Serializable { - - private static final long serialVersionUID = 10; - - @NotNull - @JsonPropertyDescription("The day the contract was issued") - private LocalDate creationDate; - - @NotNull - @JsonPropertyDescription("Start of contract which means start of insurance coverage") - private LocalDate startDate; - - @NotNull - @JsonPropertyDescription("End of contract which means end of insurance coverage") - private LocalDate endDate; - - @NotNull - @Size(max = CONTRACT_ID_MAX_SIZE) - @JsonPropertyDescription("Id given by SaaS provider") - private String contractId; - - @NotNull - @JsonPropertyDescription("The amount the customer pays excluding tax") - private MonetaryAmount totalNetPrice; - - @NotNull - @Valid - @Size(min = 1, max = LIST_MAX_SIZE) - @JsonPropertyDescription("All roles in the contract, e.g. insuranceHolder") - private List roles; - - @NotNull - @Valid - private Product product; - - @Valid - @JsonPropertyDescription("The agent who induced the contract issuance, usually is eligible for receiving commission") - private Agent agent; - - @NotNull - @JsonPropertyDescription("A code uniquely identifying the type of payment e.g. invoice or creditcard, Paypal etc.") - private Integer paymentCode; - - @NotNull - @Size(min = CONTRACT_FILE_HANDLES_MIN_SIZE, max = CONTRACT_FILE_HANDLES_MAX_SIZE) - @JsonPropertyDescription("A contract is only complete with its corresponding documents. This is the contract issued by the SaaS provider and maybe some further documents like e.g. customer provided documents like e.g. receipts. At least one contract document is required") - private List fileHandles; - - @NotNull - @Size(min = MONTH_YEAR_SIZE, max = MONTH_YEAR_SIZE) - @JsonPropertyDescription("When was the condition issued? Format MMYY") - private String conditionMonthYear; - - public ContractV1() { - } - - public LocalDate getCreationDate() { - return creationDate; - } - - public void setCreationDate(LocalDate creationDate) { - this.creationDate = creationDate; - } - - public LocalDate getStartDate() { - return startDate; - } - - public void setStartDate(LocalDate startDate) { - this.startDate = startDate; - } - - public LocalDate getEndDate() { - return endDate; - } - - public void setEndDate(LocalDate endDate) { - this.endDate = endDate; - } - - public String getContractId() { - return contractId; - } - - public void setContractId(String contractId) { - this.contractId = contractId; - } - - public MonetaryAmount getTotalNetPrice() { - return totalNetPrice; - } - - public void setTotalNetPrice(MonetaryAmount totalNetPrice) { - this.totalNetPrice = totalNetPrice; - } - - public List getRoles() { - return roles; - } - - public void setRoles(List roles) { - this.roles = roles; - } - - public Product getProduct() { - return product; - } - - public void setProduct(Product product) { - this.product = product; - } - - public Agent getAgent() { - return agent; - } - - public void setAgent(Agent agent) { - this.agent = agent; - } - - public Integer getPaymentCode() { - return paymentCode; - } - - public void setPaymentCode(Integer paymentCode) { - this.paymentCode = paymentCode; - } - - public List getFileHandles() { - return fileHandles; - } - - public void setFileHandles(List fileHandles) { - this.fileHandles = fileHandles; - } - - public String getConditionMonthYear() { - return conditionMonthYear; - } - - public void setConditionMonthYear(String conditionMonthYear) { - this.conditionMonthYear = conditionMonthYear; - } -} diff --git a/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java b/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java index 81cfae7..6cac37a 100644 --- a/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java +++ b/src/test/java/ch/baloise/corellia/api/entities/DocumentTypeTest.java @@ -21,13 +21,13 @@ void setUp() { @Test void fromLowerCase() throws IOException { - Document.DocumentType documentType = objectMapper.readValue("\"application_pdf\"", Document.DocumentType.class); + Document.DocumentType documentType = objectMapper.readValue("\"contract\"", Document.DocumentType.class); assertEquals(Document.DocumentType.CONTRACT, documentType); } @Test void fromUpperCase() throws IOException { - Document.DocumentType documentType = objectMapper.readValue("\"APPLICATION_PDF\"", Document.DocumentType.class); + Document.DocumentType documentType = objectMapper.readValue("\"CONTRACT\"", Document.DocumentType.class); assertEquals(Document.DocumentType.CONTRACT, documentType); }