Move core unit tests (#1070)

* Move core unit tests

Moves the core unit tests from the itests project to the bundle project.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born 2019-10-03 19:51:53 +02:00 committed by Christoph Weitkamp
parent 41e95ac16b
commit 7926b2280e
60 changed files with 60 additions and 26 deletions

View File

@ -31,7 +31,6 @@ import org.junit.Test;
import org.mockito.Mock;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.component.ComponentContext;
/**
@ -59,11 +58,8 @@ public class I18nProviderImplTest {
private static final String TIMEZONE_GMT9 = "Etc/GMT-9";
// LocationProvider translationProvider;
I18nProviderImpl i18nProviderImpl;
ConfigurationAdmin configAdmin;
Dictionary<String, Object> initialConfig = new Hashtable<>();
private I18nProviderImpl i18nProviderImpl;
private Dictionary<String, Object> initialConfig = new Hashtable<>();
@Mock
private ComponentContext componentContext;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.service;
package org.eclipse.smarthome.core.internal.service;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

View File

@ -0,0 +1,48 @@
/**
* Copyright (c) 2010-2019 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.items;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.types.State;
/**
* {@link GenericItem} implementation used for testing.
*
* @author Christoph Knauf - Initial contribution
*/
@NonNullByDefault
public class TestItem extends GenericItem {
public TestItem(String name) {
super("Test", name);
}
public Set<StateChangeListener> getListeners() {
return listeners;
}
@Override
public List<Class<? extends State>> getAcceptedDataTypes() {
return Collections.emptyList();
}
@Override
public List<Class<? extends Command>> getAcceptedCommandTypes() {
return Collections.emptyList();
}
}

View File

@ -10,11 +10,11 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.events;
package org.eclipse.smarthome.core.items.events;
import static org.junit.Assert.*;
import org.eclipse.smarthome.core.items.events.ItemEventFactory;
import org.eclipse.smarthome.core.events.AbstractEventFactory;
import org.junit.Test;
/**

View File

@ -10,19 +10,14 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.events;
package org.eclipse.smarthome.core.items.events;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import org.eclipse.smarthome.core.events.Event;
import org.eclipse.smarthome.core.items.Item;
import org.eclipse.smarthome.core.items.dto.ItemDTOMapper;
import org.eclipse.smarthome.core.items.events.GroupItemStateChangedEvent;
import org.eclipse.smarthome.core.items.events.ItemAddedEvent;
import org.eclipse.smarthome.core.items.events.ItemCommandEvent;
import org.eclipse.smarthome.core.items.events.ItemEventFactory;
import org.eclipse.smarthome.core.items.events.ItemStateEvent;
import org.eclipse.smarthome.core.items.events.ItemStatePredictedEvent;
import org.eclipse.smarthome.core.library.CoreItemFactory;
import org.eclipse.smarthome.core.library.items.SwitchItem;
import org.eclipse.smarthome.core.library.types.OnOffType;

View File

@ -10,14 +10,13 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.types;
package org.eclipse.smarthome.core.library.dimension;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import javax.measure.Unit;
import org.eclipse.smarthome.core.library.dimension.VolumetricFlowRate;
import org.eclipse.smarthome.core.library.unit.SmartHomeUnits;
import org.eclipse.smarthome.core.types.util.UnitUtils;
import org.junit.Test;

View File

@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.types;
package org.eclipse.smarthome.core.library.unit;
import static org.eclipse.smarthome.core.library.unit.MetricPrefix.HECTO;
import static org.hamcrest.CoreMatchers.is;
@ -30,10 +30,6 @@ import org.eclipse.smarthome.core.library.dimension.ArealDensity;
import org.eclipse.smarthome.core.library.dimension.Density;
import org.eclipse.smarthome.core.library.dimension.Intensity;
import org.eclipse.smarthome.core.library.types.QuantityType;
import org.eclipse.smarthome.core.library.unit.ImperialUnits;
import org.eclipse.smarthome.core.library.unit.MetricPrefix;
import org.eclipse.smarthome.core.library.unit.SIUnits;
import org.eclipse.smarthome.core.library.unit.SmartHomeUnits;
import org.junit.Test;
import tec.uom.se.quantity.Quantities;

View File

@ -10,11 +10,11 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.smarthome.core.common;
package org.eclipse.smarthome.core.util;
import java.util.function.Consumer;
import org.eclipse.smarthome.core.util.UIDUtils;
import org.eclipse.smarthome.core.common.AbstractUID;
import org.hamcrest.core.IsEqual;
import org.junit.Assert;
import org.junit.Test;

View File

@ -68,7 +68,7 @@ import tec.uom.se.unit.Units;
/**
* @author Stefan Triller - Initial contribution
*/
public class GroupItemTest extends JavaOSGiTest {
public class GroupItemOSGiTest extends JavaOSGiTest {
/** Time to sleep when a file is created/modified/deleted, so the event can be handled */
private final static int WAIT_EVENT_TO_BE_HANDLED = 1000;