diff options
author | aravind.est <aravindhan.a@est.tech> | 2024-02-16 18:44:53 +0000 |
---|---|---|
committer | aravind.est <aravindhan.a@est.tech> | 2024-02-16 18:44:53 +0000 |
commit | 00fd5055c54d94b99cd52e8bd737f2bfac4287d0 (patch) | |
tree | 15edc98d2543cc17676c4628aa4715fe21c70c8e /a1-policy-management/src/test | |
parent | 7ae613e5469750773d32bf2e25361f6c73eb150f (diff) |
Improve error message for A1 client custom adapter handling
Error message improvement when using custom handler.
Issue-ID: CCSDK-3986
Signed-off-by: aravind.est <aravindhan.a@est.tech>
Change-Id: I11db77d7f861432614a7685498eeca02bba1a8fb
Diffstat (limited to 'a1-policy-management/src/test')
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java index f50d5537..a23540e5 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/A1ClientFactoryTest.java @@ -3,6 +3,7 @@ * ONAP : ccsdk oran * ====================================================================== * Copyright (C) 2020-2023 Nordix Foundation. All rights reserved. + * Copyright (C) 2024 OpenInfra Foundation Europe. 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. @@ -41,6 +42,7 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; import org.onap.ccsdk.oran.a1policymanagementservice.repository.Ric; +import org.onap.ccsdk.oran.a1policymanagementservice.utils.MockA1Client; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -148,6 +150,18 @@ class A1ClientFactoryTest { factoryUnderTest.createClient(new Ric(ricConfig("", "junk")), A1ProtocolType.CUSTOM_PROTOCOL); }); assertEquals("Could not find class: junk", e.getMessage()); + + Exception exceptionNoSuchMethod = Assertions.assertThrows(Exception.class, () -> { + factoryUnderTest.createClient(new Ric(ricConfig("", MockA1Client.class.getName())), + A1ProtocolType.CUSTOM_PROTOCOL); + }); + assertEquals("Could not find the required constructor in class " + MockA1Client.class.getName(), + exceptionNoSuchMethod.getMessage()); + + Exception exceptionNullCustomAdaptor = Assertions.assertThrows(Exception.class, () -> { + factoryUnderTest.createClient(new Ric(ricConfig("", null)), A1ProtocolType.CUSTOM_PROTOCOL); + }); + assertEquals("Custom adapter class is required to use A1ProtocolType.CUSTOM_PROTOCOL", exceptionNullCustomAdaptor.getMessage()); } @Test |