Skip to content

Commit 2ed7695

Browse files
committed
Test adjustments.
1 parent 353d842 commit 2ed7695

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bundles/org.opensmarthouse.core.item/src/test/java/org/openhab/core/items/dto/ItemDTOMapperTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,22 @@
1717

1818
import static org.hamcrest.CoreMatchers.*;
1919
import static org.junit.Assert.assertThat;
20+
import static org.mockito.Mockito.when;
2021

2122
import org.junit.Ignore;
2223
import org.junit.Test;
2324
import org.junit.runner.RunWith;
2425
import org.mockito.Mock;
26+
import org.mockito.invocation.InvocationOnMock;
2527
import org.mockito.junit.MockitoJUnitRunner;
28+
import org.mockito.stubbing.Answer;
2629
import org.openhab.core.items.GenericItem;
2730
import org.openhab.core.items.GroupFunction;
31+
import org.openhab.core.items.Item;
2832
import org.openhab.core.items.ItemBuilderFactory;
2933
import org.openhab.core.items.TestNumberItem;
3034
import org.openhab.core.library.types.StringType;
35+
import org.openhab.core.types.State;
3136

3237
/**
3338
* @author Stefan Triller - Initial contribution
@@ -38,6 +43,9 @@ public class ItemDTOMapperTest {
3843
@Mock
3944
private ItemBuilderFactory factory;
4045

46+
@Mock
47+
private GroupFunction function;
48+
4149
@Test
4250
public void testMapFunctionWithNumberItemAndCountFunction() {
4351
// testing Group:Number:Count(".*hello.*")
@@ -47,6 +55,9 @@ public void testMapFunctionWithNumberItemAndCountFunction() {
4755
gFuncDTO.name = "COUNT";
4856
gFuncDTO.params = new String[] { ".*hello.*" };
4957

58+
when(factory.newFunctionBuilder(item1, gFuncDTO)).thenReturn(function);
59+
when(function.getParameters()).thenReturn(new State[] {new StringType()});
60+
5061
// FIXME This gonna fail
5162
GroupFunction gFunc = ItemDTOMapper.mapFunction(item1, gFuncDTO, factory);
5263

0 commit comments

Comments
 (0)