07d9a926992aac3743988c38718c226e0e39b889
[portal/sdk.git] /
1 /*
2  * ============LICENxSE_START==========================================
3  * ONAP Portal SDK
4  * ===================================================================
5  * Copyright © 2018 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  * 
37  */
38 package org.onap.portalsdk.analytics.gmap.map;
39
40 import static org.junit.Assert.assertEquals;
41 import static org.junit.Assert.assertNotNull;
42
43 import java.awt.Color;
44
45 import org.junit.Before;
46 import org.junit.Test;
47
48 public class ColorPropertiesTest {
49         
50         ColorProperties colorProperties;
51         private String TYPE = "type";
52         private String COLOR = "10,10,10";
53         private String SHAPE = "circle";
54         private String SIZE = "100";
55         private int NUMBER = 1;
56         
57         @Before
58         public void init() {
59                 NovaMap map = new NovaMap();
60                 colorProperties = new ColorProperties(map);
61                 colorProperties.setColor(TYPE, COLOR);
62                 colorProperties.setShape(TYPE, SHAPE);
63                 colorProperties.setSize(TYPE, SIZE);
64                 colorProperties.setShape(TYPE, NUMBER, SHAPE);
65         }
66         
67         @Test
68         public void testNotNull() {
69                 assertNotNull(colorProperties);
70         }
71         
72         @Test
73         public void testGetColor() {
74                 Color color1 = new Color(10,10,10);
75                 Color color2 = colorProperties.getColor(TYPE);
76                 assertEquals(true, color1.equals(color2));
77         }
78         
79         @Test
80         public void testGetShape() {
81                 assertEquals(SHAPE, colorProperties.getShape(TYPE));
82         }
83         
84         @Test
85         public void testGetShapeWithNumber() {
86                 assertEquals(SHAPE, colorProperties.getShape(TYPE, NUMBER));
87         }
88         
89         @Test
90         public void testGetSize() {
91                 assertEquals(100, colorProperties.getSize(TYPE));
92         }
93 }