More sonars in models 10/117810/1
authorJim Hahn <jrh3@att.com>
Fri, 12 Feb 2021 14:26:24 +0000 (09:26 -0500)
committerJim Hahn <jrh3@att.com>
Fri, 12 Feb 2021 17:43:43 +0000 (12:43 -0500)
Addressed the following issues:
- change visibility of constructor
- assert exception type

Issue-ID: POLICY-2905
Change-Id: Iaededb32802e4facbbc776ae51d05d2ef5c60b93
Signed-off-by: Jim Hahn <jrh3@att.com>
models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/TopicServer.java
models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java

index 4c01511..004a2e2 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -43,7 +43,7 @@ public abstract class TopicServer<Q> implements TopicListener {
      * @param sink sink to which responses should be published
      * @param source source from which requests arrive
      */
-    public TopicServer(TopicSink sink, TopicSource source, Coder coder, Class<Q> reqClass) {
+    protected TopicServer(TopicSink sink, TopicSource source, Coder coder, Class<Q> reqClass) {
         this.sink = sink;
         this.source = source;
         this.coder = coder;
index f5598e2..1f52ed1 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. 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.
@@ -242,7 +242,8 @@ public class MainTest {
      */
     @Test
     public void testBuildTopicServerInvalidProvider() {
-        assertThatThrownBy(() -> new Main("invalidTopicServer.json").start());
+        assertThatThrownBy(() -> new Main("invalidTopicServer.json").start())
+                        .hasCauseInstanceOf(IllegalArgumentException.class);
     }
 
     /**
@@ -250,7 +251,8 @@ public class MainTest {
      */
     @Test
     public void testBuildTopicServerNoSink() {
-        assertThatThrownBy(() -> new Main("missingSink.json").start());
+        assertThatThrownBy(() -> new Main("missingSink.json").start())
+                        .hasCauseInstanceOf(IllegalArgumentException.class);
     }
 
     /**
@@ -258,6 +260,7 @@ public class MainTest {
      */
     @Test
     public void testBuildTopicServerNoSource() {
-        assertThatThrownBy(() -> new Main("missingSource.json").start());
+        assertThatThrownBy(() -> new Main("missingSource.json").start())
+                        .hasCauseInstanceOf(IllegalArgumentException.class);
     }
 }