mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
Fix SAT MethodNameCheck findings (#1111)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
3d52c72a91
commit
998168698a
@ -138,27 +138,27 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartScan_nonExisting() {
|
||||
public void testStartScanNonExisting() {
|
||||
assertFalse(discoveryServiceRegistry.startScan(new ThingTypeUID("bindingId", "thingType"), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartScan_existing() {
|
||||
public void testStartScanExisting() {
|
||||
assertTrue(discoveryServiceRegistry.startScan(new ThingTypeUID(ANY_BINDING_ID_1, ANY_THING_TYPE_1), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStan_faulty() {
|
||||
public void testScanFaulty() {
|
||||
assertFalse(discoveryServiceRegistry.startScan(new ThingTypeUID(FAULTY_BINDING_ID, FAULTY_THING_TYPE), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbortScan_nonExisting() {
|
||||
public void testAbortScanNonExisting() {
|
||||
assertFalse(discoveryServiceRegistry.abortScan(new ThingTypeUID("bindingId", "thingType")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbortScan_known() {
|
||||
public void testAbortScanKnown() {
|
||||
ScanListener mockScanListener = mock(ScanListener.class);
|
||||
|
||||
assertTrue(discoveryServiceRegistry.startScan(new ThingTypeUID(ANY_BINDING_ID_1, ANY_THING_TYPE_1),
|
||||
@ -195,7 +195,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveOlderResults_works() {
|
||||
public void testRemoveOlderResultsWorks() {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
ScanListener mockScanListener2 = mock(ScanListener.class);
|
||||
|
||||
@ -224,7 +224,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveOlderResults_onlySameService() {
|
||||
public void testRemoveOlderResultsOnlySameService() {
|
||||
mockDiscoveryListener = mock(DiscoveryListener.class);
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
|
||||
@ -262,7 +262,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveOlderResults_onlyOfSpecificBridge() {
|
||||
public void testRemoveOlderResultsOnlyOfSpecificBridge() {
|
||||
mockDiscoveryListener = mock(DiscoveryListener.class);
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
|
||||
@ -318,7 +318,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThingDiscovered_removedListener() {
|
||||
public void testThingDiscoveredRemovedListener() {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
discoveryServiceRegistry.addDiscoveryListener(mockDiscoveryListener);
|
||||
discoveryServiceRegistry.removeDiscoveryListener(mockDiscoveryListener);
|
||||
@ -329,7 +329,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartScan_twoDiscoveryServices() {
|
||||
public void testStartScanTwoDiscoveryServices() {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
DiscoveryService anotherDiscoveryServiceMock = new DiscoveryServiceMock(
|
||||
new ThingTypeUID(ANY_BINDING_ID_1, ANY_THING_TYPE_1), 1);
|
||||
@ -343,7 +343,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStartScan_bindingId() {
|
||||
public void testStartScanBindingId() {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
discoveryServiceRegistry.startScan(ANY_BINDING_ID_1, mockScanListener1);
|
||||
|
||||
|
@ -33,9 +33,11 @@ import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.service.cm.Configuration;
|
||||
import org.osgi.service.cm.ConfigurationAdmin;
|
||||
@ -43,6 +45,7 @@ import org.osgi.service.cm.ConfigurationAdmin;
|
||||
/**
|
||||
* @author Petar Valchev - Initial contribution
|
||||
*/
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@Rule
|
||||
@ -205,7 +208,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IfNoPIDIsDefinedInConfigurationFileWithNo_dotNameTheDefaultNamespacePlusTheFileNameBecomesPID() {
|
||||
public void ifNoPIDIsDefinedInConfigurationFileWithNoDotNameTheDefaultNamespacePlusTheFileNameBecomesPID() {
|
||||
String configDirectory = configBaseDirectory + SEP + "no_pid_no_dot_conf";
|
||||
String servicesDirectory = "no_pid_no_dot_services";
|
||||
// In this test case we need configuration files, which names don't contain dots.
|
||||
@ -515,7 +518,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PropertyValuePairsForALocalPIDInDifferentFilesAreStillAssociatedWithThatPID() {
|
||||
public void propertyValuePairsForALocalPIDInDifferentFilesAreStillAssociatedWithThatPID() {
|
||||
String configDirectory = configBaseDirectory + SEP + "local_pid_different_files_no_conflict_conf";
|
||||
String servicesDirectory = "local_pid_different_files_no_conflict_services";
|
||||
String defaultConfigFilePath = configDirectory + SEP + "local.pid.default.file.cfg";
|
||||
@ -592,7 +595,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenLocalPIDIsDefinedForGlobalPIDFile_AbortParsing() {
|
||||
public void whenLocalPIDIsDefinedForGlobalPIDFileAbortParsing() {
|
||||
String configDirectory = configBaseDirectory + SEP + "global_pid_with_local_pid_line_error";
|
||||
String servicesDirectory = "global_pid_with_local_pid_line_services_error";
|
||||
|
||||
@ -663,7 +666,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenExclusivePIDFileIsDeleted_DeleteTheConfiguration() throws IOException {
|
||||
public void whenExclusivePIDFileIsDeletedDeleteTheConfiguration() throws IOException {
|
||||
String configDirectory = configBaseDirectory + SEP + "exclusive_pid_file_removed_during_runtime";
|
||||
String servicesDirectory = "exclusive_pid_file_removed_during_runtime_services";
|
||||
|
||||
@ -690,7 +693,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenExclusiveConfigIsTruncated_OverrideReducedConfig() throws IOException {
|
||||
public void whenExclusiveConfigIsTruncatedOverrideReducedConfig() throws IOException {
|
||||
String configDirectory = configBaseDirectory + SEP + "exclusive_pid_overrides_configuration_on_update";
|
||||
String servicesDirectory = "exclusive_pid_overrides_configuration_on_update_services";
|
||||
|
||||
@ -719,7 +722,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenExclusiveConfigFileIsDeleted_shouldRemoveConfigFromConfigAdmin() throws IOException {
|
||||
public void whenExclusiveConfigFileIsDeletedShouldRemoveConfigFromConfigAdmin() throws IOException {
|
||||
String configDirectory = configBaseDirectory + SEP + "exclusive_pid_configuration_removed_after_file_delete";
|
||||
String servicesDirectory = "exclusive_pid_configuration_removed_after_file_delete_services";
|
||||
|
||||
@ -789,7 +792,7 @@ public class ConfigDispatcherOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenExclusivePIDisDefinedInlineFromDifferentFile_skipTheLine() {
|
||||
public void whenExclusivePIDisDefinedInlineFromDifferentFileSkipTheLine() {
|
||||
String configDirectory = configBaseDirectory + SEP + "global_and_local_pid_different_files_conf";
|
||||
String servicesDirectory = "global_and_local_pid_no_conflict_services";
|
||||
String defaultConfigFilePath = configDirectory + SEP + "global.and.local.pid.default.file.cfg";
|
||||
|
@ -252,7 +252,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMetadata_nonExistingItem() {
|
||||
public void testAddMetadataNonExistingItem() {
|
||||
MetadataDTO dto = new MetadataDTO();
|
||||
dto.value = "some value";
|
||||
Response response = itemResource.addMetadata("nonExisting", "foo", dto);
|
||||
@ -260,7 +260,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMetadata_ValueEmtpy() {
|
||||
public void testAddMetadataValueEmpty() {
|
||||
MetadataDTO dto = new MetadataDTO();
|
||||
dto.value = "";
|
||||
Response response = itemResource.addMetadata(ITEM_NAME1, "foo", dto);
|
||||
@ -268,7 +268,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMetadata_ValueNull() {
|
||||
public void testAddMetadataValueNull() {
|
||||
MetadataDTO dto = new MetadataDTO();
|
||||
dto.value = null;
|
||||
Response response = itemResource.addMetadata(ITEM_NAME1, "foo", dto);
|
||||
@ -276,7 +276,7 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddMetadata_update() {
|
||||
public void testAddMetadataUpdate() {
|
||||
MetadataDTO dto = new MetadataDTO();
|
||||
dto.value = "some value";
|
||||
assertEquals(201, itemResource.addMetadata(ITEM_NAME1, "namespace", dto).getStatus());
|
||||
@ -286,19 +286,19 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMetadata_nonExistingItem() {
|
||||
public void testRemoveMetadataNonExistingItem() {
|
||||
Response response = itemResource.removeMetadata("nonExisting", "anything");
|
||||
assertEquals(404, response.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMetadata_nonExistingNamespace() {
|
||||
public void testRemoveMetadataNonExistingNamespace() {
|
||||
Response response = itemResource.removeMetadata(ITEM_NAME1, "anything");
|
||||
assertEquals(404, response.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMetadata_unmanagedMetadata() {
|
||||
public void testRemoveMetadataUnmanagedMetadata() {
|
||||
MetadataProvider provider = mock(MetadataProvider.class);
|
||||
when(provider.getAll()).thenReturn(
|
||||
Collections.singleton(new Metadata(new MetadataKey("namespace", ITEM_NAME1), "some value", null)));
|
||||
|
@ -240,7 +240,7 @@ public class FolderObserverTest extends JavaOSGiTest {
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCreation_untrackedExtension() throws Exception {
|
||||
public void testCreationUntrackedExtension() throws Exception {
|
||||
String noParserExtension = "jpg";
|
||||
|
||||
configProps.put(EXISTING_SUBDIR_NAME, "java,txt," + noParserExtension);
|
||||
@ -263,7 +263,7 @@ public class FolderObserverTest extends JavaOSGiTest {
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCreation_untrackedDirectory() throws Exception {
|
||||
public void testCreationUntrackedDirectory() throws Exception {
|
||||
configProps.put(EXISTING_SUBDIR_NAME, "txt,jpg");
|
||||
folderObserver.activate(context);
|
||||
|
||||
@ -317,7 +317,7 @@ public class FolderObserverTest extends JavaOSGiTest {
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCreation_noExtensions() throws Exception {
|
||||
public void testCreationNoExtensions() throws Exception {
|
||||
String subdir = "noExtensionsSubdir";
|
||||
new File(WATCHED_DIRECTORY, subdir).mkdirs();
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class GenericItemProvider2Test extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetadata_simple() {
|
||||
public void testMetadataSimple() {
|
||||
String model = "Switch simple { namespace=\"value\" } ";
|
||||
|
||||
modelRepository.addOrRefreshModel(TESTMODEL_NAME, new ByteArrayInputStream(model.getBytes()));
|
||||
@ -231,7 +231,7 @@ public class GenericItemProvider2Test extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMetadata_configured() {
|
||||
public void testMetadataConfigured() {
|
||||
String model = "Switch simple { namespace=\"value\" } " + //
|
||||
"Switch configured { foo=\"bar\" [ answer=42 ] } ";
|
||||
|
||||
|
@ -25,7 +25,7 @@ import org.junit.Test;
|
||||
public class GenericMetadataProviderTest {
|
||||
|
||||
@Test
|
||||
public void testGetAll_empty() {
|
||||
public void testGetAllEmpty() {
|
||||
GenericMetadataProvider provider = new GenericMetadataProvider();
|
||||
Collection<Metadata> res = provider.getAll();
|
||||
assertNotNull(res);
|
||||
@ -42,7 +42,7 @@ public class GenericMetadataProviderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveMetadata_nonExistentItem() {
|
||||
public void testRemoveMetadataNonExistentItem() {
|
||||
GenericMetadataProvider provider = new GenericMetadataProvider();
|
||||
provider.removeMetadata("nonExistentItem");
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangedEventTrigger_withoutQuotes() throws Exception {
|
||||
public void testChangedEventTriggerWithoutQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Item test changed to world " + //
|
||||
@ -58,7 +58,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangedEventTrigger_withQuotes() throws Exception {
|
||||
public void testChangedEventTriggerWithQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Item test changed to \"world\" " + //
|
||||
@ -71,7 +71,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommandEventTrigger_withoutQuotes() throws Exception {
|
||||
public void testCommandEventTriggerWithoutQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Item test received command world " + //
|
||||
@ -84,7 +84,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCommandEventTrigger_withQuotes() throws Exception {
|
||||
public void testCommandEventTriggerWithQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Item test received command \"world\" " + //
|
||||
@ -97,7 +97,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEventEmittedTrigger_withoutQuotes() throws Exception {
|
||||
public void testEventEmittedTriggerWithoutQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Channel test triggered world " + //
|
||||
@ -110,7 +110,7 @@ public class RuleTriggerTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEventEmittedTrigger_withQuotes() throws Exception {
|
||||
public void testEventEmittedTriggerWithQuotes() throws Exception {
|
||||
String model = "rule\"State Machine Rule 1\" " + //
|
||||
"when " + //
|
||||
" Channel test triggered \"world\" " + //
|
||||
|
@ -182,7 +182,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void testGreaterThan_Number_Number() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testGreaterThanNumberNumber() throws ScriptParsingException, ScriptExecutionException {
|
||||
Item numberItem = itemRegistry.get(NUMBER_ITEM_DECIMAL);
|
||||
((NumberItem) numberItem).setState(new DecimalType(20));
|
||||
|
||||
@ -195,7 +195,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareGreaterThanQuantityType_False() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testCompareGreaterThanQuantityTypeFalse() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertFalse(runScript("20.0|°F > 20|°C"));
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareLessThanQuantityType_False() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testCompareLessThanQuantityTypeFalse() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertFalse(runScript("20.0|°C < 20|°F"));
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiplyQuantityType_Number() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testMultiplyQuantityTypeNumber() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat((QuantityType<?>) runScript("1|m * 20"), is(QuantityType.valueOf("20 m")));
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void testDivideItemState_QuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testDivideItemStateQuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
Item numberItem = itemRegistry.get(NUMBER_ITEM_LENGTH);
|
||||
((NumberItem) numberItem).setState(new QuantityType<>("1 m"));
|
||||
|
||||
@ -267,50 +267,50 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDivideQuantityType_Number() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testDivideQuantityTypeNumber() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat((QuantityType<?>) runScript("1|m / 2"), is(QuantityType.valueOf("0.5 m")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDivide_Number_QuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testDivideNumberQuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat((QuantityType<?>) runScript("1 / 2|m"), is(new QuantityType<>("0.5 one/m")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDivide_Number_QuantityType_1() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testDivideNumberQuantityType1() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat((QuantityType<?>) runScript("0.5|\"one/m\" + 0.5|\"one/m\""), is(new QuantityType<>("1 one/m")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDivide_Length_Time() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testDivideLengthTime() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat((QuantityType<?>) runScript("100|km / 1|h"), is(new QuantityType<>("100 km/h")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnit_QuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testToUnitQuantityType() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("20|°C.toUnit(\"°F\")"), is(new QuantityType<>("68 °F")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnit_QuantityType2() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testToUnitQuantityType2() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("new QuantityType(20, CELSIUS).toUnit('°F').doubleValue"), is(Double.valueOf(68)));
|
||||
assertThat(runScript("new QuantityType(68, FAHRENHEIT).toUnit('°C').doubleValue"), is(Double.valueOf(20)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnit_QuantityType3() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testToUnitQuantityType3() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("new QuantityType(1, KELVIN)"), is(new QuantityType<>(1, SmartHomeUnits.KELVIN)));
|
||||
assertThat(runScript("new QuantityType(1, MICRO(KELVIN))"),
|
||||
is(new QuantityType<>(1, MetricPrefix.MICRO(SmartHomeUnits.KELVIN))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals_QuantityType_Number() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testEqualsQuantityTypeNumber() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("20|m.equals(20)"), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuantityType_UnitSymbols() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testQuantityTypeUnitSymbols() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("20|m²"), is(new QuantityType<>(20, SIUnits.SQUARE_METRE)));
|
||||
assertThat(runScript("20|\"m**2\""), is(new QuantityType<>(20, SIUnits.SQUARE_METRE)));
|
||||
assertThat(runScript("20|m³"), is(new QuantityType<>(20, SIUnits.SQUARE_METRE.multiply(SIUnits.METRE))));
|
||||
@ -319,7 +319,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompare_QuantityType_ONE_Number() throws ScriptParsingException, ScriptExecutionException {
|
||||
public void testCompareQuantityTypeOneNumber() throws ScriptParsingException, ScriptExecutionException {
|
||||
assertThat(runScript("1 == 1|one"), is(true));
|
||||
assertThat(runScript("1|one == 1"), is(true));
|
||||
|
||||
|
@ -46,199 +46,199 @@ public class NumberExtensionsTest {
|
||||
private static final QuantityType<Dimensionless> Q_ONE_2 = new QuantityType<>(2, SmartHomeUnits.ONE);
|
||||
|
||||
@Test
|
||||
public void operatorPlus_Number_Number() {
|
||||
public void operatorPlusNumberNumber() {
|
||||
assertThat(NumberExtensions.operator_plus(DECIMAL1, DECIMAL2), is(BigDecimal.valueOf(3)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorPlus_Number_Quantity_ONE() {
|
||||
public void operatorPlusNumberQuantityOne() {
|
||||
assertThat(NumberExtensions.operator_plus(Q_ONE_1, DECIMAL2), is(BigDecimal.valueOf(3)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorPlus_Quantity_Quantity() {
|
||||
public void operatorPlusQuantityQuantity() {
|
||||
assertThat(NumberExtensions.operator_plus(Q_CELSIUS_1, Q_CELSIUS_2), is(QuantityType.valueOf("3 °C")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMinus_Number() {
|
||||
public void operatorMinusNumber() {
|
||||
assertThat(NumberExtensions.operator_minus(DECIMAL1), is(BigDecimal.valueOf(-1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMinus_Quantity() {
|
||||
public void operatorMinusQuantity() {
|
||||
assertThat(NumberExtensions.operator_minus(Q_CELSIUS_1), is(QuantityType.valueOf("-1 °C")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMinus_Number_Number() {
|
||||
public void operatorMinusNumberNumber() {
|
||||
assertThat(NumberExtensions.operator_minus(DECIMAL2, DECIMAL1), is(BigDecimal.valueOf(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMinus_Number_Quantity_ONE() {
|
||||
public void operatorMinusNumberQuantityOne() {
|
||||
assertThat(NumberExtensions.operator_minus(Q_ONE_2, DECIMAL1), is(BigDecimal.valueOf(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMinus_Quantity_Quantity() {
|
||||
public void operatorMinusQuantityQuantity() {
|
||||
assertThat(NumberExtensions.operator_minus(Q_LENGTH_1_M, Q_LENGTH_2_CM), is(QuantityType.valueOf("0.98 m")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMultiply_Number_Quantity() {
|
||||
public void operatorMultiplyNumberQuantity() {
|
||||
assertThat(NumberExtensions.operator_multiply(DECIMAL2, Q_LENGTH_2_CM), is(QuantityType.valueOf("4 cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorMultiply_Quantity_Quantity() {
|
||||
public void operatorMultiplyQuantityQuantity() {
|
||||
assertThat(NumberExtensions.operator_multiply(Q_LENGTH_1_M, Q_LENGTH_2_CM), is(QuantityType.valueOf("2 m·cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorDivide_Quantity_Number() {
|
||||
public void operatorDivideQuantityNumber() {
|
||||
assertThat(NumberExtensions.operator_divide(Q_LENGTH_1_M, DECIMAL2), is(QuantityType.valueOf("0.5 m")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorDivide_Quantity_Quantity() {
|
||||
public void operatorDivideQuantityQuantity() {
|
||||
assertThat(NumberExtensions.operator_divide(Q_LENGTH_1_M, Q_LENGTH_2_CM), is(QuantityType.valueOf("0.5 m/cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorDivide_Numer_Quantity() {
|
||||
public void operatorDivideNumberQuantity() {
|
||||
assertThat(NumberExtensions.operator_divide(DECIMAL1, Q_LENGTH_2_CM), is(QuantityType.valueOf("0.5 one/cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorEquals_Numer_Quantity() {
|
||||
public void operatorEqualsNumberQuantity() {
|
||||
assertFalse(NumberExtensions.operator_equals((Number) DECIMAL1, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorEquals_Quantity_Number() {
|
||||
public void operatorEqualsQuantityNumber() {
|
||||
assertFalse(NumberExtensions.operator_equals((Number) Q_LENGTH_2_CM, DECIMAL1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorEquals_Quantity_Quantity_False() {
|
||||
public void operatorEqualsQuantityQuantityFalse() {
|
||||
assertFalse(NumberExtensions.operator_equals(Q_LENGTH_1_M, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorEquals_Quantity_Quantity_True() {
|
||||
public void operatorEqualsQuantityQuantityTrue() {
|
||||
assertTrue(NumberExtensions.operator_equals(Q_LENGTH_1_M, new QuantityType<Length>("100 cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessThan_Number_Quantity() {
|
||||
public void operatorLessThanNumberQuantity() {
|
||||
assertFalse(NumberExtensions.operator_lessThan((Number) Q_LENGTH_1_M, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessThan_Type_Quantity() {
|
||||
public void operatorLessThanTypeQuantity() {
|
||||
assertFalse(NumberExtensions.operator_lessThan((Type) Q_LENGTH_1_M, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessThan_Quantity_Quantity_False() {
|
||||
public void operatorLessThanQuantityQuantityFalse() {
|
||||
assertFalse(NumberExtensions.operator_lessThan(Q_LENGTH_1_M, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessThan_Quantity_Quantity_True() {
|
||||
public void operatorLessThanQuantityQuantityTrue() {
|
||||
assertTrue(NumberExtensions.operator_lessThan(Q_LENGTH_2_CM, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterThan_Number_Quantity() {
|
||||
public void operatorGreaterThanNumberQuantity() {
|
||||
assertFalse(NumberExtensions.operator_greaterThan((Number) Q_LENGTH_1_M, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterThan_Type_Quantity() {
|
||||
public void operatorGreaterThanTypeQuantity() {
|
||||
assertFalse(NumberExtensions.operator_greaterThan((Type) Q_LENGTH_1_M, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterThan_Quantity_Quantity_False() {
|
||||
public void operatorGreaterThanQuantityQuantityFalse() {
|
||||
assertFalse(NumberExtensions.operator_greaterThan(Q_LENGTH_2_CM, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterThan_Quantity_Quantity_True() {
|
||||
public void operatorGreaterThanQuantityQuantityTrue() {
|
||||
assertTrue(NumberExtensions.operator_greaterThan(Q_LENGTH_1_M, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessEqualsThan_Number_Quantity() {
|
||||
public void operatorLessEqualsThanNumberQuantity() {
|
||||
assertFalse(
|
||||
NumberExtensions.operator_lessEqualsThan(BigDecimal.valueOf(100), new QuantityType<Length>("100 cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessEqualsThan_Type_Quantity() {
|
||||
public void operatorLessEqualsThanTypeQuantity() {
|
||||
assertTrue(NumberExtensions.operator_lessEqualsThan((Type) Q_LENGTH_1_M, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessEqualsThan_Quantity_Quantity_False() {
|
||||
public void operatorLessEqualsThanQuantityQuantityFalse() {
|
||||
assertFalse(NumberExtensions.operator_lessEqualsThan(Q_LENGTH_1_M, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessEqualsThan_Quantity_Quantity_True() {
|
||||
public void operatorLessEqualsThanQuantityQuantityTrue() {
|
||||
assertTrue(NumberExtensions.operator_lessEqualsThan(Q_LENGTH_2_CM, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterEqualsThan_Number_Quantity() {
|
||||
public void operatorGreaterEqualsThanNumberQuantity() {
|
||||
assertFalse(
|
||||
NumberExtensions.operator_greaterEqualsThan(BigDecimal.valueOf(1), new QuantityType<Length>("1 km")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterEqualsThan_Type_Quantity() {
|
||||
public void operatorGreaterEqualsThanTypeQuantity() {
|
||||
assertTrue(
|
||||
NumberExtensions.operator_greaterEqualsThan((Type) Q_LENGTH_1_M, new QuantityType<Length>("100 cm")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterEqualsThan_Quantity_Quantity_False() {
|
||||
public void operatorGreaterEqualsThanQuantityQuantityFalse() {
|
||||
assertFalse(NumberExtensions.operator_greaterEqualsThan(Q_LENGTH_2_CM, Q_LENGTH_1_M));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterEqualsThan_Quantity_Quantity_True() {
|
||||
public void operatorGreaterEqualsThanQuantityQuantityTrue() {
|
||||
assertTrue(NumberExtensions.operator_greaterEqualsThan(Q_LENGTH_1_M, Q_LENGTH_2_CM));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorEquals_Quantity_ONE_Number() {
|
||||
public void operatorEqualsQuantityOneNumber() {
|
||||
assertTrue(NumberExtensions.operator_equals(Q_ONE_1, DECIMAL1));
|
||||
assertTrue(NumberExtensions.operator_equals((Number) DECIMAL1, Q_ONE_1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessThan_Quantity_ONE_Number() {
|
||||
public void operatorLessThanQuantityOneNumber() {
|
||||
assertTrue(NumberExtensions.operator_lessThan(Q_ONE_1, DECIMAL2));
|
||||
assertTrue(NumberExtensions.operator_lessThan((Number) DECIMAL1, Q_ONE_2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorLessEqualsThan_Quantity_ONE_Number() {
|
||||
public void operatorLessEqualsThanQuantityOneNumber() {
|
||||
assertTrue(NumberExtensions.operator_lessEqualsThan(Q_ONE_1, DECIMAL1));
|
||||
assertTrue(NumberExtensions.operator_lessEqualsThan((Number) DECIMAL1, Q_ONE_1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterThan_Quantity_ONE_Number() {
|
||||
public void operatorGreaterThanQuantityOneNumber() {
|
||||
assertTrue(NumberExtensions.operator_greaterThan(Q_ONE_2, DECIMAL1));
|
||||
assertTrue(NumberExtensions.operator_greaterThan((Number) DECIMAL2, Q_ONE_1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void operatorGreaterEqualsThan_Quantity_ONE_Number() {
|
||||
public void operatorGreaterEqualsThanQuantityOneNumber() {
|
||||
assertTrue(NumberExtensions.operator_greaterEqualsThan(Q_ONE_1, DECIMAL1));
|
||||
assertTrue(NumberExtensions.operator_greaterEqualsThan((Number) DECIMAL1, Q_ONE_1));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_plus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_plus() {
|
||||
public void testOperatorPlus() {
|
||||
Number x = 9;
|
||||
Number y = 0;
|
||||
|
||||
@ -48,7 +48,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_plus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_plusNullLeft() {
|
||||
public void testOperatorPlusNullLeft() {
|
||||
Number x = null;
|
||||
Number y = 5;
|
||||
|
||||
@ -62,7 +62,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_plus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_plusNullRight() {
|
||||
public void testOperatorPlusNullRight() {
|
||||
Number x = 10;
|
||||
Number y = null;
|
||||
|
||||
@ -76,7 +76,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_minus(java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_minusNumber() {
|
||||
public void testOperatorMinusNumber() {
|
||||
Number x = 2;
|
||||
|
||||
BigDecimal result = NumberExtensions.operator_minus(x);
|
||||
@ -89,7 +89,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_minus(java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_minusNull() {
|
||||
public void testOperatorMinusNull() {
|
||||
Number x = null;
|
||||
|
||||
BigDecimal result = NumberExtensions.operator_minus(x);
|
||||
@ -101,7 +101,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_minus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_minusNumberNumber() {
|
||||
public void testOperatorMinusNumberNumber() {
|
||||
Number x = 10;
|
||||
Number y = 100;
|
||||
|
||||
@ -115,7 +115,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_minus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_minusNullNumber() {
|
||||
public void testOperatorMinusNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 100;
|
||||
|
||||
@ -129,7 +129,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_minus(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_minusNumberNull() {
|
||||
public void testOperatorMinusNumberNull() {
|
||||
Number x = 10;
|
||||
Number y = null;
|
||||
|
||||
@ -143,7 +143,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_multiply(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_multiply() {
|
||||
public void testOperatorMultiply() {
|
||||
Number x = 20;
|
||||
Number y = 30;
|
||||
|
||||
@ -157,7 +157,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_multiply(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_multiplyNullLeft() {
|
||||
public void testOperatorMultiplyNullLeft() {
|
||||
Number x = null;
|
||||
Number y = 30;
|
||||
|
||||
@ -171,7 +171,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_multiply(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_multiplyNullRight() {
|
||||
public void testOperatorMultiplyNullRight() {
|
||||
Number x = 20;
|
||||
Number y = null;
|
||||
|
||||
@ -185,7 +185,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_divide(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_divide() {
|
||||
public void testOperatorDivide() {
|
||||
Number x = 12;
|
||||
Number y = 4;
|
||||
|
||||
@ -199,7 +199,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_divide(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testOperator_divideNullLeft() {
|
||||
public void testOperatorDivideNullLeft() {
|
||||
Number x = null;
|
||||
Number y = 4;
|
||||
|
||||
@ -213,7 +213,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_divide(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testOperator_divideNullRight() {
|
||||
public void testOperatorDivideNullRight() {
|
||||
Number x = 12;
|
||||
Number y = null;
|
||||
|
||||
@ -224,7 +224,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_equals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_equalsNumberNumber() {
|
||||
public void testOperatorEqualsNumberNumber() {
|
||||
Number x = 123;
|
||||
Number y = 123;
|
||||
|
||||
@ -242,7 +242,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_equals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_equalsNullNumber() {
|
||||
public void testOperatorEqualsNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -254,7 +254,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_equals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_equalsNumberNull() {
|
||||
public void testOperatorEqualsNumberNull() {
|
||||
Number x = 123;
|
||||
Number y = null;
|
||||
|
||||
@ -266,7 +266,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_equals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_equalsNullrNull() {
|
||||
public void testOperatorEqualsNullrNull() {
|
||||
Number x = null;
|
||||
Number y = null;
|
||||
|
||||
@ -278,7 +278,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_notEquals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_notEqualsNumberNumber() {
|
||||
public void testOperatorNotEqualsNumberNumber() {
|
||||
Number x = 123;
|
||||
Number y = 123;
|
||||
|
||||
@ -296,7 +296,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_notEquals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_notEqualsNullNumber() {
|
||||
public void testOperatorNotEqualsNullNumber() {
|
||||
Number x = 123;
|
||||
Number y = null;
|
||||
|
||||
@ -308,7 +308,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_notEquals(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_notEqualsNumberNull() {
|
||||
public void testOperatorNotEqualsNumberNull() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -320,7 +320,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessThanNumberNumber() {
|
||||
public void testOperatorLessThanNumberNumber() {
|
||||
Number x = 12;
|
||||
Number y = 123;
|
||||
|
||||
@ -338,7 +338,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessThanNullNumber() {
|
||||
public void testOperatorLessThanNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -350,7 +350,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessThanNumberNull() {
|
||||
public void testOperatorLessThanNumberNull() {
|
||||
Number x = 12;
|
||||
Number y = null;
|
||||
|
||||
@ -362,7 +362,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterThanNumberNumber() {
|
||||
public void testOperatorGreaterThanNumberNumber() {
|
||||
Number x = 12;
|
||||
Number y = 123;
|
||||
|
||||
@ -380,7 +380,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterThanNullNumber() {
|
||||
public void testOperatorGreaterThanNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -392,7 +392,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterThanNumberNull() {
|
||||
public void testOperatorGreaterThanNumberNull() {
|
||||
Number x = 123;
|
||||
Number y = null;
|
||||
|
||||
@ -404,7 +404,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessEqualsThanNumberNumber() {
|
||||
public void testOperatorLessEqualsThanNumberNumber() {
|
||||
Number x = 12;
|
||||
Number y = 123;
|
||||
|
||||
@ -428,7 +428,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessEqualsThanNullNumber() {
|
||||
public void testOperatorLessEqualsThanNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -440,7 +440,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessEqualsThanNumberNull() {
|
||||
public void testOperatorLessEqualsThanNumberNull() {
|
||||
Number x = 12;
|
||||
Number y = null;
|
||||
|
||||
@ -452,7 +452,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_lessEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessEqualsThanNullNull() {
|
||||
public void testOperatorLessEqualsThanNullNull() {
|
||||
Number x = null;
|
||||
Number y = null;
|
||||
|
||||
@ -464,7 +464,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterEqualsThanNumberNumber() {
|
||||
public void testOperatorGreaterEqualsThanNumberNumber() {
|
||||
Number x = 12;
|
||||
Number y = 123;
|
||||
|
||||
@ -488,7 +488,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterEqualsThanNullNumber() {
|
||||
public void testOperatorGreaterEqualsThanNullNumber() {
|
||||
Number x = null;
|
||||
Number y = 123;
|
||||
|
||||
@ -500,7 +500,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterEqualsThanNumberNull() {
|
||||
public void testOperatorGreaterEqualsThanNumberNull() {
|
||||
Number x = 12;
|
||||
Number y = null;
|
||||
|
||||
@ -512,7 +512,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_greaterEqualsThan(java.lang.Number, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterEqualsThanNullNull() {
|
||||
public void testOperatorGreaterEqualsThanNullNull() {
|
||||
Number x = null;
|
||||
Number y = null;
|
||||
|
||||
@ -524,7 +524,7 @@ public class NumberExtensionsTest {
|
||||
* Test method for {@link NumberExtensions#operator_equals(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_equalsTypeNumber() {
|
||||
public void testOperatorEqualsTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 10;
|
||||
|
||||
@ -544,7 +544,7 @@ public class NumberExtensionsTest {
|
||||
* {@link NumberExtensions#operator_notEquals(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_notEqualsTypeNumber() {
|
||||
public void testOperatorNotEqualsTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 10;
|
||||
|
||||
@ -564,7 +564,7 @@ public class NumberExtensionsTest {
|
||||
* {@link NumberExtensions#operator_greaterThan(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterThanTypeNumber() {
|
||||
public void testOperatorGreaterThanTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 123;
|
||||
|
||||
@ -584,7 +584,7 @@ public class NumberExtensionsTest {
|
||||
* {@link NumberExtensions#operator_greaterEqualsThan(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_greaterEqualsThanTypeNumber() {
|
||||
public void testOperatorGreaterEqualsThanTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 123;
|
||||
|
||||
@ -610,7 +610,7 @@ public class NumberExtensionsTest {
|
||||
* {@link NumberExtensions#operator_lessThan(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessThanTypeNumber() {
|
||||
public void testOperatorLessThanTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 123;
|
||||
|
||||
@ -630,7 +630,7 @@ public class NumberExtensionsTest {
|
||||
* {@link NumberExtensions#operator_lessEqualsThan(org.eclipse.smarthome.core.types.Type, java.lang.Number)}
|
||||
*/
|
||||
@Test
|
||||
public void testOperator_lessEqualsThanTypeNumber() {
|
||||
public void testOperatorLessEqualsThanTypeNumber() {
|
||||
DecimalType type = new DecimalType(10);
|
||||
Number x = 123;
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiThread_sync() {
|
||||
public void testMultiThreadSync() {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
|
||||
@ -180,7 +180,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleThread_sync_secondCallWhileInTimeout() throws Exception {
|
||||
public void testSingleThreadSyncSecondCallWhileInTimeout() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
configureSingleThread();
|
||||
@ -199,7 +199,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleThread_sync_parallel() throws Exception {
|
||||
public void testSingleThreadSyncParallel() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
configureSingleThread();
|
||||
@ -223,7 +223,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiThread_async() throws Exception {
|
||||
public void testMultiThreadAsync() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(TIMEOUT)).when(mock).run();
|
||||
|
||||
@ -239,7 +239,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleThread_async() throws Exception {
|
||||
public void testSingleThreadAsync() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
configureSingleThread();
|
||||
@ -256,7 +256,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecondCallGetsRefused_sameIdentifier() throws Exception {
|
||||
public void testSecondCallGetsRefusedSameIdentifier() throws Exception {
|
||||
Runnable mock1 = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock1).run();
|
||||
Runnable mock2 = mock(Runnable.class);
|
||||
@ -270,7 +270,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSecondCallGetsAccepted_differentIdentifier() throws Exception {
|
||||
public void testSecondCallGetsAcceptedDifferentIdentifier() throws Exception {
|
||||
Runnable mock1 = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock1).run();
|
||||
Runnable mock2 = mock(Runnable.class);
|
||||
@ -297,7 +297,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCall_wrapped() throws Exception {
|
||||
public void testCallWrapped() throws Exception {
|
||||
AtomicReference<String> outerThreadName = new AtomicReference<>();
|
||||
AtomicReference<String> middleThreadName = new AtomicReference<>();
|
||||
AtomicReference<String> innerThreadName = new AtomicReference<>();
|
||||
@ -408,7 +408,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncDoesNotTimeout_differentIdentifiers() throws Exception {
|
||||
public void testAsyncDoesNotTimeoutDifferentIdentifiers() throws Exception {
|
||||
Runnable mock1 = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock1).run();
|
||||
Runnable mock2 = mock(Runnable.class);
|
||||
@ -426,7 +426,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncDoesNotTimeout_defaultIdentifiers() throws Exception {
|
||||
public void testAsyncDoesNotTimeoutDefaultIdentifiers() throws Exception {
|
||||
Runnable mock1 = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock1).run();
|
||||
Runnable mock2 = mock(Runnable.class);
|
||||
@ -442,7 +442,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncRunsSubsequentAndDoesNotTimeout_sameIdentifier() throws Exception {
|
||||
public void testAsyncRunsSubsequentAndDoesNotTimeoutSameIdentifier() throws Exception {
|
||||
Object identifier = new Object();
|
||||
Runnable mock1 = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock1).run();
|
||||
@ -461,7 +461,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncSequential_sameIdentifier() throws Exception {
|
||||
public void testAsyncSequentialSameIdentifier() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
|
||||
@ -479,7 +479,7 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncExceedingThreadPool_differentIdentifier() throws Exception {
|
||||
public void testAsyncExceedingThreadPoolDifferentIdentifier() throws Exception {
|
||||
Runnable mock = mock(Runnable.class);
|
||||
doAnswer(a -> sleep(BLOCK)).when(mock).run();
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubscriberUnregistration1_2() throws Exception {
|
||||
public void testSubscriberUnregistration1And2() throws Exception {
|
||||
internalUnregisterService(TYPE_BASED_SUBSCRIBER_1);
|
||||
internalUnregisterService(TYPE_BASED_SUBSCRIBER_2);
|
||||
eventPublisher.post(createEvent(EVENT_TYPE_A));
|
||||
|
@ -294,7 +294,7 @@ public class GroupItemOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetStateAs_shouldEqualStateUpdate() {
|
||||
public void testGetStateAsShouldEqualStateUpdate() {
|
||||
// Main group uses AND function
|
||||
GroupItem rootGroupItem = new GroupItem("root", new SwitchItem("baseItem"),
|
||||
new ArithmeticGroupFunction.And(OnOffType.ON, OnOffType.OFF));
|
||||
|
@ -93,7 +93,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_inRoot() throws Exception {
|
||||
public void testInRoot() throws Exception {
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, true);
|
||||
|
||||
// File created in the watched directory
|
||||
@ -101,7 +101,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_inSub() throws Exception {
|
||||
public void testInSub() throws Exception {
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, true);
|
||||
|
||||
// File created in a subdirectory of the watched directory
|
||||
@ -109,7 +109,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_inSubSub() throws Exception {
|
||||
public void testInSubSub() throws Exception {
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, true);
|
||||
|
||||
// File created in a sub sub directory of the watched directory
|
||||
@ -117,7 +117,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_identicalNames() throws Exception {
|
||||
public void testIdenticalNames() throws Exception {
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, true);
|
||||
|
||||
String fileName = "duplicateFile";
|
||||
@ -148,7 +148,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_excludeSubdirs() throws Exception {
|
||||
public void testExcludeSubdirs() throws Exception {
|
||||
// Do not watch the subdirectories of the root directory
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, false);
|
||||
|
||||
@ -167,7 +167,7 @@ public class AbstractWatchServiceTest extends JavaTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_includeSubdirs() throws Exception {
|
||||
public void testIncludeSubdirs() throws Exception {
|
||||
// Do watch the subdirectories of the root directory
|
||||
watchService = new RelativeWatchService(WATCHED_DIRECTORY, true);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class ThingPropertiesTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetProperty_newKey() {
|
||||
public void testSetPropertyNewKey() {
|
||||
thing.setProperty("key3", "value3");
|
||||
|
||||
assertEquals(3, thing.getProperties().size());
|
||||
@ -67,7 +67,7 @@ public class ThingPropertiesTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetProperty_newValue() {
|
||||
public void testSetPropertyNewValue() {
|
||||
String value = thing.setProperty("key2", "value3");
|
||||
|
||||
assertEquals("value2", value);
|
||||
@ -86,12 +86,12 @@ public class ThingPropertiesTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testSetProperty_nullKey() {
|
||||
public void testSetPropertyNullKey() {
|
||||
thing.setProperty(nullString, "");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testSetProperty_emptyName() {
|
||||
public void testSetPropertyEmptyName() {
|
||||
thing.setProperty("", "");
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class ThingEventFactoryTest extends JavaOSGiTest {
|
||||
.toJson(new TriggerEventPayloadBean(CommonTriggerEvents.PRESSED, CHANNEL_UID.getAsString()));
|
||||
|
||||
@Test
|
||||
public void testCreateEvent_ThingStatusInfoEvent() throws Exception {
|
||||
public void testCreateEventThingStatusInfoEvent() throws Exception {
|
||||
Event event = factory.createEvent(ThingStatusInfoEvent.TYPE, THING_STATUS_EVENT_TOPIC,
|
||||
THING_STATUS_EVENT_PAYLOAD, null);
|
||||
|
||||
@ -89,7 +89,7 @@ public class ThingEventFactoryTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateEvent_ThingAddedEvent() throws Exception {
|
||||
public void testCreateEventThingAddedEvent() throws Exception {
|
||||
Event event = factory.createEvent(ThingAddedEvent.TYPE, THING_ADDED_EVENT_TOPIC, THING_ADDED_EVENT_PAYLOAD,
|
||||
null);
|
||||
|
||||
@ -125,7 +125,7 @@ public class ThingEventFactoryTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateEvent_ChannelTriggeredEvent() throws Exception {
|
||||
public void testCreateEventChannelTriggeredEvent() throws Exception {
|
||||
Event event = factory.createEvent(ChannelTriggeredEvent.TYPE, CHANNEL_TRIGGERED_EVENT_TOPIC,
|
||||
CHANNEL_TRIGGERED_EVENT_PAYLOAD, null);
|
||||
|
||||
|
@ -249,7 +249,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStateUpdated_singleLink() {
|
||||
public void testStateUpdatedSingleLink() {
|
||||
manager.stateUpdated(STATE_CHANNEL_UID_1, OnOffType.ON);
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile).onStateUpdateFromHandler(eq(OnOffType.ON));
|
||||
@ -259,7 +259,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStateUpdated_multiLink() {
|
||||
public void testStateUpdatedMultiLink() {
|
||||
manager.stateUpdated(STATE_CHANNEL_UID_2, OnOffType.ON);
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile, times(2)).onStateUpdateFromHandler(eq(OnOffType.ON));
|
||||
@ -269,7 +269,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostCommand_singleLink() {
|
||||
public void testPostCommandSingleLink() {
|
||||
manager.postCommand(STATE_CHANNEL_UID_1, OnOffType.ON);
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile).onCommandFromHandler(eq(OnOffType.ON));
|
||||
@ -279,7 +279,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPostCommand_multiLink() {
|
||||
public void testPostCommandMultiLink() {
|
||||
manager.postCommand(STATE_CHANNEL_UID_2, OnOffType.ON);
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile, times(2)).onCommandFromHandler(eq(OnOffType.ON));
|
||||
@ -289,7 +289,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_singleLink() {
|
||||
public void testItemCommandEventSingleLink() {
|
||||
manager.receive(ItemEventFactory.createCommandEvent(ITEM_NAME_2, OnOffType.ON));
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile).onCommandFromItem(eq(OnOffType.ON));
|
||||
@ -300,7 +300,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_Decimal2Quantity() {
|
||||
public void testItemCommandEventDecimal2Quantity() {
|
||||
// Take unit from accepted item type (see channel built from STATE_CHANNEL_UID_3)
|
||||
manager.receive(ItemEventFactory.createCommandEvent(ITEM_NAME_3, DecimalType.valueOf("20")));
|
||||
waitForAssert(() -> {
|
||||
@ -311,7 +311,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_Decimal2Quantity_2() {
|
||||
public void testItemCommandEventDecimal2Quantity2() {
|
||||
// Take unit from state description
|
||||
StateDescriptionService stateDescriptionService = mock(StateDescriptionService.class);
|
||||
when(stateDescriptionService.getStateDescription(ITEM_NAME_3, null)).thenReturn(
|
||||
@ -329,7 +329,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_Decimal2Quantity_ChannelType() {
|
||||
public void testItemCommandEventDecimal2QuantityChannelType() {
|
||||
// The command is sent to an item w/o dimension defined and the channel is legacy (created from a ThingType
|
||||
// definition before UoM was introduced to the binding). The dimension information might now be defined on the
|
||||
// current ThingType.
|
||||
@ -342,7 +342,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_multiLink() {
|
||||
public void testItemCommandEventMultiLink() {
|
||||
manager.receive(ItemEventFactory.createCommandEvent(ITEM_NAME_1, OnOffType.ON));
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile, times(2)).onCommandFromItem(eq(OnOffType.ON));
|
||||
@ -353,7 +353,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_notToSource() {
|
||||
public void testItemCommandEventNotToSource() {
|
||||
manager.receive(
|
||||
ItemEventFactory.createCommandEvent(ITEM_NAME_1, OnOffType.ON, STATE_CHANNEL_UID_2.getAsString()));
|
||||
waitForAssert(() -> {
|
||||
@ -365,7 +365,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemStateEvent_singleLink() {
|
||||
public void testItemStateEventSingleLink() {
|
||||
manager.receive(ItemEventFactory.createStateEvent(ITEM_NAME_2, OnOffType.ON));
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile).onStateUpdateFromItem(eq(OnOffType.ON));
|
||||
@ -376,7 +376,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemStateEvent_multiLink() {
|
||||
public void testItemStateEventMultiLink() {
|
||||
manager.receive(ItemEventFactory.createStateEvent(ITEM_NAME_1, OnOffType.ON));
|
||||
waitForAssert(() -> {
|
||||
verify(stateProfile, times(2)).onStateUpdateFromItem(eq(OnOffType.ON));
|
||||
@ -387,7 +387,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemStateEvent_notToSource() {
|
||||
public void testItemStateEventNotToSource() {
|
||||
manager.receive(
|
||||
ItemEventFactory.createStateEvent(ITEM_NAME_1, OnOffType.ON, STATE_CHANNEL_UID_2.getAsString()));
|
||||
waitForAssert(() -> {
|
||||
@ -399,7 +399,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelTriggeredEvent_singleLink() {
|
||||
public void testChannelTriggeredEventSingleLink() {
|
||||
manager.receive(ThingEventFactory.createTriggerEvent(EVENT, TRIGGER_CHANNEL_UID_1));
|
||||
waitForAssert(() -> {
|
||||
verify(triggerProfile).onTriggerFromHandler(eq(EVENT));
|
||||
@ -409,7 +409,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChannelTriggeredEvent_multiLink() {
|
||||
public void testChannelTriggeredEventMultiLink() {
|
||||
manager.receive(ThingEventFactory.createTriggerEvent(EVENT, TRIGGER_CHANNEL_UID_2));
|
||||
waitForAssert(() -> {
|
||||
verify(triggerProfile, times(2)).onTriggerFromHandler(eq(EVENT));
|
||||
@ -534,7 +534,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemCommandEvent_typeDowncast() {
|
||||
public void testItemCommandEventTypeDowncast() {
|
||||
Thing thing = ThingBuilder.create(THING_TYPE_UID, THING_UID)
|
||||
.withChannels(ChannelBuilder.create(STATE_CHANNEL_UID_2, "Dimmer").withKind(ChannelKind.STATE).build())
|
||||
.build();
|
||||
@ -554,7 +554,7 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemStateEvent_typeDowncast() {
|
||||
public void testItemStateEventTypeDowncast() {
|
||||
Thing thing = ThingBuilder.create(THING_TYPE_UID, THING_UID)
|
||||
.withChannels(ChannelBuilder.create(STATE_CHANNEL_UID_2, "Dimmer").withKind(ChannelKind.STATE).build())
|
||||
.build();
|
||||
|
@ -355,7 +355,7 @@ public class ThingManagerOSGiJavaTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildHandlerInitialized_replacedUnitializedThing() {
|
||||
public void testChildHandlerInitializedReplacedUnitializedThing() {
|
||||
Semaphore childHandlerInitializedSemaphore = new Semaphore(1);
|
||||
Semaphore thingUpdatedSemapthore = new Semaphore(1);
|
||||
|
||||
@ -431,7 +431,7 @@ public class ThingManagerOSGiJavaTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildHandlerInitialized_modifiedUninitializedThing() {
|
||||
public void testChildHandlerInitializedModifiedUninitializedThing() {
|
||||
Semaphore childHandlerInitializedSemaphore = new Semaphore(1);
|
||||
Semaphore thingUpdatedSemapthore = new Semaphore(1);
|
||||
|
||||
@ -507,7 +507,7 @@ public class ThingManagerOSGiJavaTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildHandlerInitialized_replacedInitializedThing() {
|
||||
public void testChildHandlerInitializedReplacedInitializedThing() {
|
||||
Semaphore childHandlerInitializedSemaphore = new Semaphore(1);
|
||||
Semaphore thingUpdatedSemapthore = new Semaphore(1);
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFirmwareStatusInfo_noFirmwareProvider() {
|
||||
public void testGetFirmwareStatusInfoNoFirmwareProvider() {
|
||||
final FirmwareStatusInfo unknownInfo = createUnknownInfo(thing3.getUID());
|
||||
assertThat(firmwareUpdateService.getFirmwareStatusInfo(THING3_UID), is(unknownInfo));
|
||||
|
||||
@ -237,7 +237,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFirmwareStatusInfo_firmwareProviderAddedLate() {
|
||||
public void testGetFirmwareStatusInfoFirmwareProviderAddedLate() {
|
||||
final FirmwareStatusInfo unknownInfo = createUnknownInfo(thing3.getUID());
|
||||
final FirmwareStatusInfo upToDateInfo = createUpToDateInfo(thing3.getUID());
|
||||
assertThat(firmwareUpdateService.getFirmwareStatusInfo(THING3_UID), is(unknownInfo));
|
||||
@ -263,7 +263,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFirmwareStatusInfo_eventsOnlySentOnce() {
|
||||
public void testGetFirmwareStatusInfoEventsOnlySentOnce() {
|
||||
final FirmwareStatusInfo updateExecutableInfoFw112 = createUpdateExecutableInfo(thing1.getUID(), V112);
|
||||
|
||||
assertThat(firmwareUpdateService.getFirmwareStatusInfo(THING1_UID), is(updateExecutableInfoFw112));
|
||||
@ -405,22 +405,22 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void cancelFirmwareUpdate_noFirmwareUpdateHandler() {
|
||||
public void cancelFirmwareUpdateNoFirmwareUpdateHandler() {
|
||||
firmwareUpdateService.cancelFirmwareUpdate(new ThingUID("dummy:thing:withoutHandler"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void cancelFirmwareUpdate_thingIdIdNull() {
|
||||
public void cancelFirmwareUpdateThingIdIdNull() {
|
||||
firmwareUpdateService.cancelFirmwareUpdate(giveNull());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void cancelFirmwareUpdate_updateNotStarted() {
|
||||
public void cancelFirmwareUpdateUpdateNotStarted() {
|
||||
firmwareUpdateService.cancelFirmwareUpdate(THING3_UID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCancelFirmwareUpdate_unexpectedFailure() {
|
||||
public void testCancelFirmwareUpdateUnexpectedFailure() {
|
||||
FirmwareUpdateHandler firmwareUpdateHandler = mock(FirmwareUpdateHandler.class);
|
||||
doThrow(new RuntimeException()).when(firmwareUpdateHandler).cancel();
|
||||
doReturn(true).when(firmwareUpdateHandler).isUpdateExecutable();
|
||||
@ -447,7 +447,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCancelFirmwareUpdate_takesLong() {
|
||||
public void testCancelFirmwareUpdateTakesLong() {
|
||||
firmwareUpdateService.timeout = 50;
|
||||
FirmwareUpdateHandler firmwareUpdateHandler = mock(FirmwareUpdateHandler.class);
|
||||
doAnswer(invocation -> {
|
||||
@ -478,7 +478,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_downgrade() {
|
||||
public void testUpdateFirmwareDowngrade() {
|
||||
final FirmwareStatusInfo upToDateInfo = createUpToDateInfo(thing2.getUID());
|
||||
final FirmwareStatusInfo updateExecutableInfoFw112 = createUpdateExecutableInfo(thing2.getUID(), V112);
|
||||
|
||||
@ -500,27 +500,27 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testGetFirmwareStatusInfo_null() {
|
||||
public void testGetFirmwareStatusInfoNull() {
|
||||
firmwareUpdateService.getFirmwareStatusInfo(giveNull());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testGetFirmwareStatusInfo_null2() {
|
||||
public void testGetFirmwareStatusInfoNull2() {
|
||||
firmwareUpdateService.updateFirmware(giveNull(), V009, null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testGetFirmwareStatusInfo_null3() {
|
||||
public void testGetFirmwareStatusInfoNull3() {
|
||||
firmwareUpdateService.updateFirmware(THING1_UID, giveNull(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFirmwareStatusInfo_notFirmwareUpdateHandler() {
|
||||
public void testGetFirmwareStatusInfoNotFirmwareUpdateHandler() {
|
||||
assertThat(firmwareUpdateService.getFirmwareStatusInfo(UNKNOWN_THING_UID), is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_unknownFirmware() {
|
||||
public void testUpdateFirmwareUnknownFirmware() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(equalTo(String.format("Firmware with version %s for thing with UID %s was not found.",
|
||||
UNKNOWN_FIRMWARE_VERSION, THING1_UID)));
|
||||
@ -529,7 +529,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_noFirmwareUpdateHandler() {
|
||||
public void testUpdateFirmwareNoFirmwareUpdateHandler() {
|
||||
Thing thing4 = ThingBuilder.create(THING_TYPE_UID_WITHOUT_FW, THING5_ID).build();
|
||||
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
@ -540,7 +540,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_notExecutable() {
|
||||
public void testUpdateFirmwareNotExecutable() {
|
||||
doReturn(false).when(handler1).isUpdateExecutable();
|
||||
|
||||
thrown.expect(IllegalStateException.class);
|
||||
@ -551,7 +551,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrerequisiteVersionCheck_illegalVersion() {
|
||||
public void testPrerequisiteVersionCheckIllegalVersion() {
|
||||
when(mockFirmwareRegistry.getFirmware(any(Thing.class), any(String.class))).thenAnswer(invocation -> {
|
||||
String firmwareVersion = (String) invocation.getArguments()[1];
|
||||
if (V111_FIX.equals(firmwareVersion)) {
|
||||
@ -649,7 +649,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFirmwareStatus_updateIsNotExecutable() {
|
||||
public void testFirmwareStatusUpdateIsNotExecutable() {
|
||||
final FirmwareStatusInfo updateExecutableInfoFw112 = createUpdateExecutableInfo(thing1.getUID(), V112);
|
||||
|
||||
assertThat(firmwareUpdateService.getFirmwareStatusInfo(THING1_UID), is(updateExecutableInfoFw112));
|
||||
@ -673,7 +673,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_wrongModel() {
|
||||
public void testUpdateFirmwareWrongModel() {
|
||||
when(mockFirmwareRegistry.getFirmware(any(Thing.class), eq(FWALPHA_RESTRICTED_TO_MODEL2.getVersion()), any()))
|
||||
.thenReturn(FWALPHA_RESTRICTED_TO_MODEL2);
|
||||
when(mockFirmwareRegistry.getFirmwares(any(Thing.class), any())).thenAnswer(invocation -> {
|
||||
@ -738,7 +738,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_timeOut() {
|
||||
public void testUpdateFirmwareTimeOut() {
|
||||
firmwareUpdateService.timeout = 50;
|
||||
|
||||
final FirmwareStatusInfo updateExecutableInfoFw112 = createUpdateExecutableInfo(thing1.getUID(), V112);
|
||||
@ -760,7 +760,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_error() {
|
||||
public void testUpdateFirmwareError() {
|
||||
doAnswer(invocation -> {
|
||||
ProgressCallback progressCallback = (ProgressCallback) invocation.getArguments()[1];
|
||||
progressCallback.defineSequence(SEQUENCE);
|
||||
@ -789,7 +789,7 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFirmware_customError() {
|
||||
public void testUpdateFirmwareCustomError() {
|
||||
doAnswer(invocation -> {
|
||||
ProgressCallback progressCallback = (ProgressCallback) invocation.getArguments()[1];
|
||||
progressCallback.failed("test-error");
|
||||
|
@ -51,13 +51,13 @@ public class SystemProfileFactoryOSGiTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSuggestedProfileTypeUID_nullChannelType1() {
|
||||
public void testGetSuggestedProfileTypeUIDNullChannelType1() {
|
||||
assertThat(profileFactory.getSuggestedProfileTypeUID((ChannelType) null, CoreItemFactory.SWITCH),
|
||||
is(nullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSuggestedProfileTypeUID_nullChannelType2() {
|
||||
public void testGetSuggestedProfileTypeUIDNullChannelType2() {
|
||||
Channel channel = ChannelBuilder.create(new ChannelUID("test:test:test:test"), CoreItemFactory.SWITCH).build();
|
||||
assertThat(profileFactory.getSuggestedProfileTypeUID(channel, CoreItemFactory.SWITCH),
|
||||
is(SystemProfiles.DEFAULT));
|
||||
|
@ -52,7 +52,7 @@ public class ChannelTypesTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ChannelTypesShouldBeLoaded() throws Exception {
|
||||
public void channelTypesShouldBeLoaded() throws Exception {
|
||||
int initialNumberOfChannelTypes = channelTypeProvider.getChannelTypes(null).size();
|
||||
int initialNumberOfChannelGroupTypes = channelGroupTypeProvider.getChannelGroupTypes(null).size();
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class ConfigDescriptionsTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ConfigDescriptionsShouldLoadProperly() throws Exception {
|
||||
public void configDescriptionsShouldLoadProperly() throws Exception {
|
||||
try (final AutoCloseable unused = loadedTestBundle()) {
|
||||
URI bridgeURI = new URI("thing-type:hue:bridge");
|
||||
ConfigDescription bridgeConfigDescription = configDescriptionRegistry.getConfigDescriptions().stream()
|
||||
|
@ -212,7 +212,7 @@ public class ThingTypesTest extends JavaOSGiTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thingTypesShouldBeRemoved_whenBundleIsUninstalled() throws Exception {
|
||||
public void thingTypesShouldBeRemovedWhenBundleIsUninstalled() throws Exception {
|
||||
try (final AutoCloseable unused = loadedTestBundle()) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user