isEmpty() expresses the intent more clearly and is therefore preferred.
Counting the number of elements can also be an expensive operation e.g. when using linked lists.
Signed-off-by: Wouter Born <github@maindrain.net>
* Minor code improvements in profile factory
* Added integration test to check if factory creates all available profiles
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
When waitForAssert uses ruleEvents.stream() the ruleEventHandler may add an event to ruleEvents at the same time causing a ConcurrentModificationException.
Using a CopyOnWriteArrayList instead of an ArrayList should fix this.
Signed-off-by: Wouter Born <github@maindrain.net>
The test now makes sure the models and items are removed and the removal events have been processed during tearDown so these events don't interfere with subsequent tests.
Also merges the GenericItemProviderTest and GenericItemProvider2Test together which was still a Groovy leftover.
Fixes#1140
Signed-off-by: Wouter Born <github@maindrain.net>
* Improve ThingTypeXmlProvider exception handling
When a binding such as ZWave has hundereds of ThingTypes it's hard to debug thing type definition issues.
This PR adds a UID (ConfigDescription, ChannelType, ChannelGroupType and ThingType) to the logging so it will be easier to find the root cause of exceptions.
Because the exceptions are caught, an error in one ThingType definition will no longer prevent other perfectly fine ThingTypes to be registered so the impact of definition issues is reduced.
Signed-off-by: Wouter Born <github@maindrain.net>
Most likely the test is unstable because the ChannelGroupTypeProvider is still processing the bundle XML. So using waitForAssert may fix this. It's also used like this to assert the channel types got added by the ChannelTypeProvider.
Fixes#1090
Signed-off-by: Wouter Born <github@maindrain.net>
* fixes for tp-features
* re-enable verification for tp-features
* fix jax-ws feature
* extend jackson feature
* use jackson feature for swagger-jaxrs-provider
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
Activating the PersistentInbox after the mocks are initialized prevents the TimeToLiveCheckingThread calling the storage mock which would cause the exception.
Fixes#1091
Signed-off-by: Wouter Born <github@maindrain.net>
Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2.
Signed-off-by: Wouter Born <github@maindrain.net>
Suppresses the SystemPrintln SAT findings because this class is a Karaf shell command which prints to the console.
Signed-off-by: Wouter Born <github@maindrain.net>
* Changed pid from 'org.eclipse.smarthome.core.i18nprovider' to 'org.eclipse.smarthome.i18n'
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Fixes wrong names identified by the following rules:
* ConstantNameCheck
* LocalFinalVariableNameCheck
* LocalVariableNameCheck
* StaticVariableNameCheck
Most mismatches identified by the MemberNameCheck have also been fixed except for those where the variables are used in events/DTOs etc which would cause issues.
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes the SAT warning: First javadoc author should have "Initial contribution" contribution description.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move IO HTTP unit tests
All IO HTTP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move thing XML unit tests
Moves the thing XML unit tests from the itests project to the bundle project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move compat1x unit tests
All compat1x tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move model LSP unit tests
All model LSP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>