0514d6e7a6b50d58d5b4cf8b742e9668c00ad302
[portal/sdk.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal SDK
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.onap.portalsdk.analytics.system.fusion.domain;
39
40 import static org.junit.Assert.*;
41
42 import org.junit.Test;
43
44 public class RaptorSearchTest {
45
46         public RaptorSearch mockRaptorSearch() {
47                 RaptorSearch raptorSearch = new RaptorSearch();
48                 raptorSearch.setRepId((long) 1);
49                 raptorSearch.setTitle("title");
50                 raptorSearch.setDescr("descr");
51                 raptorSearch.setOwnerName("ownerName");
52                 raptorSearch.setCreated(null);
53                 raptorSearch.setCanEdit("Y");
54                 raptorSearch.setReadOnly("readOnly");
55                 raptorSearch.setSchedule("schedule");
56                 raptorSearch.setCreateDate(null);
57                 return raptorSearch;
58         }
59
60         @Test
61         public void raptorSearchTest() {
62                 RaptorSearch raptorSearch = mockRaptorSearch();
63                 RaptorSearch raptorSearch1 = mockRaptorSearch();
64                 assertEquals(raptorSearch.getRepId(), raptorSearch1.getRepId());
65                 assertEquals(raptorSearch.getTitle(), raptorSearch1.getTitle());
66                 assertEquals(raptorSearch.getDescr(), raptorSearch1.getDescr());
67                 assertEquals(raptorSearch.getOwnerName(), raptorSearch1.getOwnerName());
68                 assertEquals(raptorSearch.getCreated(), raptorSearch1.getCreated());
69                 assertEquals(raptorSearch.getCanEdit(), raptorSearch1.getCanEdit());
70                 assertEquals(raptorSearch.getReadOnly(), raptorSearch1.getReadOnly());
71                 assertEquals(raptorSearch.getSchedule(), raptorSearch1.getSchedule());
72                 assertTrue(raptorSearch.canDelete());
73                 assertNull(raptorSearch.getCreateDate());
74                 assertTrue(raptorSearch.canCopy());
75                 raptorSearch.setReadOnly("Y");
76                 assertTrue(raptorSearch.canCopy());
77                 raptorSearch.setReadOnly("N");
78                 assertTrue(raptorSearch.canCopy());
79                 raptorSearch.setReadOnly(null);
80                 assertTrue(raptorSearch.canCopy());
81                 raptorSearch.setCanEdit(null);
82                 assertFalse(raptorSearch.canDelete());
83
84         }
85 }