From 843834cb8c2c8184607270e4a01c9c3af2d0313e Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 23 May 2024 15:22:07 +0200 Subject: Improve tests for exception handling - add more assertions to ExceptionHandlerTest - add class definitions for error responses to allow the usage of object mappers for that Issue-ID: AAI-3691 Change-Id: I0a3f26c7f3a14bf536cc4f023b567aeb4191e963 Signed-off-by: Fiete Ostkamp --- .../org/onap/aai/entities/AAIErrorResponse.java | 32 +++++++++++++++++++ .../java/org/onap/aai/entities/RequestError.java | 32 +++++++++++++++++++ .../org/onap/aai/entities/ServiceException.java | 36 ++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 aai-resources/src/main/java/org/onap/aai/entities/AAIErrorResponse.java create mode 100644 aai-resources/src/main/java/org/onap/aai/entities/RequestError.java create mode 100644 aai-resources/src/main/java/org/onap/aai/entities/ServiceException.java (limited to 'aai-resources/src/main/java/org') diff --git a/aai-resources/src/main/java/org/onap/aai/entities/AAIErrorResponse.java b/aai-resources/src/main/java/org/onap/aai/entities/AAIErrorResponse.java new file mode 100644 index 0000000..eeaecd4 --- /dev/null +++ b/aai-resources/src/main/java/org/onap/aai/entities/AAIErrorResponse.java @@ -0,0 +1,32 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2024 Deutsche Telekom. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.aai.entities; + +import lombok.Builder; +import lombok.Data; +import lombok.extern.jackson.Jacksonized; + +@Data +@Builder +@Jacksonized +public class AAIErrorResponse { + private final RequestError requestError; +} diff --git a/aai-resources/src/main/java/org/onap/aai/entities/RequestError.java b/aai-resources/src/main/java/org/onap/aai/entities/RequestError.java new file mode 100644 index 0000000..3fb051b --- /dev/null +++ b/aai-resources/src/main/java/org/onap/aai/entities/RequestError.java @@ -0,0 +1,32 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2024 Deutsche Telekom. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.aai.entities; + +import lombok.Builder; +import lombok.Data; +import lombok.extern.jackson.Jacksonized; + +@Data +@Builder +@Jacksonized +public class RequestError { + private ServiceException serviceException; +} diff --git a/aai-resources/src/main/java/org/onap/aai/entities/ServiceException.java b/aai-resources/src/main/java/org/onap/aai/entities/ServiceException.java new file mode 100644 index 0000000..38075c0 --- /dev/null +++ b/aai-resources/src/main/java/org/onap/aai/entities/ServiceException.java @@ -0,0 +1,36 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2024 Deutsche Telekom. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.aai.entities; + +import java.util.List; + +import lombok.Builder; +import lombok.Data; +import lombok.extern.jackson.Jacksonized; + +@Data +@Builder +@Jacksonized +public class ServiceException { + private String messageId; + private String text; + private List variables; +} -- cgit 1.2.3-korg