/
ServiceXmlConfigPropertiesAdaptedTest.java
54 lines (47 loc) · 2.87 KB
/
ServiceXmlConfigPropertiesAdaptedTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*******************************************************************************
* Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.service.config;
import org.eclipse.kapua.qa.markers.junit.JUnitTests;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category(JUnitTests.class)
public class ServiceXmlConfigPropertiesAdaptedTest {
@Test
public void serviceXmlConfigPropertiesAdaptedTest() {
ServiceXmlConfigPropertiesAdapted serviceXmlConfigPropertiesAdapted = new ServiceXmlConfigPropertiesAdapted();
Assert.assertNull("Null expected.", serviceXmlConfigPropertiesAdapted.getProperties());
}
@Test
public void setAndGetPropertiesTest() {
String[] names = {"name", null};
String[][] stringValues = {null, {"String Values 1", "String Values 2"}};
ServiceXmlConfigPropertyAdapted.ConfigPropertyType[] configPropertyType = {null, ServiceXmlConfigPropertyAdapted.ConfigPropertyType.stringType,
ServiceXmlConfigPropertyAdapted.ConfigPropertyType.longType, ServiceXmlConfigPropertyAdapted.ConfigPropertyType.doubleType,
ServiceXmlConfigPropertyAdapted.ConfigPropertyType.floatType, ServiceXmlConfigPropertyAdapted.ConfigPropertyType.integerType,
ServiceXmlConfigPropertyAdapted.ConfigPropertyType.byteType, ServiceXmlConfigPropertyAdapted.ConfigPropertyType.charType,
ServiceXmlConfigPropertyAdapted.ConfigPropertyType.booleanType, ServiceXmlConfigPropertyAdapted.ConfigPropertyType.shortType};
ServiceXmlConfigPropertiesAdapted serviceXmlConfigPropertiesAdapted = new ServiceXmlConfigPropertiesAdapted();
for (String name : names) {
for (String[] value : stringValues) {
for (ServiceXmlConfigPropertyAdapted.ConfigPropertyType type : configPropertyType) {
ServiceXmlConfigPropertyAdapted[] properties = {null, new ServiceXmlConfigPropertyAdapted(), new ServiceXmlConfigPropertyAdapted(name, type, value)};
serviceXmlConfigPropertiesAdapted.setProperties(properties);
Assert.assertEquals("Expected and actual values should be the same.", properties, serviceXmlConfigPropertiesAdapted.getProperties());
serviceXmlConfigPropertiesAdapted.setProperties(null);
Assert.assertNull("Null expected", serviceXmlConfigPropertiesAdapted.getProperties());
}
}
}
}
}