Automated test coverage code
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / model / DRSubTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.dmaap.dbcapi.model;
21
22 import static org.junit.Assert.*;
23
24 import java.lang.reflect.Constructor;
25 import java.lang.reflect.InvocationTargetException;
26 import java.lang.reflect.Method;
27
28 import org.junit.After;
29 import org.junit.Before;
30 import org.junit.Test;
31 public class DRSubTest {
32         String d, un, up, f, du, lu, s, o;
33         Boolean u100, susp;
34
35         @Before
36         public void setUp() throws Exception {
37                 d = "central-onap";
38                 un = "user1";
39                 up = "secretW0rd";
40                 f = "234";
41                 s = "sub123";
42                 du = "sub.server.onap.org:8443/deliver/here";
43                 lu = "https://drps.onap.org:8443/sublog/123";
44                 u100 = true;
45                 susp = false;
46                 o = "joe";
47         }
48
49         @After
50         public void tearDown() throws Exception {
51         }
52
53
54         @Test
55         public void testDRSubClassDefaultConstructor() {
56
57                 DR_Sub t = new DR_Sub();
58         
59                 assertTrue( t.getDcaeLocationName() == null  );
60                 assertTrue( t.getUsername() == null  );
61                 assertTrue( t.getUserpwd() == null  );
62                 assertTrue( t.getFeedId() == null  );
63                 assertTrue( t.getDeliveryURL() == null  );
64                 assertTrue( t.getLogURL() == null  );
65                 assertTrue( t.getSubId() == null  );
66                 assertTrue( ! t.isUse100() );
67                 assertTrue( ! t.isSuspended() );
68                 assertTrue( t.getOwner() == null  );
69         
70         }
71
72         @Test
73         public void testDRSubClassConstructor() {
74
75                 DR_Sub t = new DR_Sub( d, un, up, f, du, lu, u100 );
76         
77                 assertTrue( d.equals( t.getDcaeLocationName() ));
78                 assertTrue( un.equals( t.getUsername() ));
79                 assertTrue( up.equals( t.getUserpwd() ));
80                 assertTrue( f.equals( t.getFeedId() ));
81                 assertTrue( du.equals( t.getDeliveryURL() ) );
82                 assertTrue( lu.equals( t.getLogURL() ) );
83                 assertTrue( t.isUse100() );
84                 assertTrue( ! t.isSuspended() );
85         }
86
87         @Test
88         public void testDRSubClassSetters() {
89
90                 DR_Sub t = new DR_Sub();
91
92                 t.setDcaeLocationName( d );
93                 assertTrue( d.equals( t.getDcaeLocationName() ));
94                 t.setUsername( un );
95                 assertTrue( un.equals( t.getUsername() ));
96                 t.setUserpwd( up );
97                 assertTrue( up.equals( t.getUserpwd() ));
98                 t.setFeedId( f );
99                 assertTrue( f.equals( t.getFeedId() ));
100                 t.setSubId( s );
101                 assertTrue( s.equals( t.getSubId() ));
102                 t.setDeliveryURL( du );
103                 assertTrue( du.equals( t.getDeliveryURL() ) );
104                 t.setLogURL( lu );
105                 assertTrue( lu.equals( t.getLogURL() ) );
106         
107         }
108 }