diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-05-23 15:22:07 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-05-23 15:22:07 +0200 |
commit | 843834cb8c2c8184607270e4a01c9c3af2d0313e (patch) | |
tree | 43f01f5d38a8e83129793b382a46327fe86520dc /aai-resources/src/main/java | |
parent | e4ff951e645d131a5f4793a75c595da66cc6a23c (diff) |
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 <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-resources/src/main/java')
3 files changed, 100 insertions, 0 deletions
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<String> variables; +} |