-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
StepDefinitionMatchTest.java
31 lines (25 loc) · 1.16 KB
/
StepDefinitionMatchTest.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
package cucumber.runtime;
import cucumber.runtime.converters.LocalizedXStreams;
import gherkin.formatter.Argument;
import gherkin.formatter.model.Step;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import static org.mockito.Mockito.*;
public class StepDefinitionMatchTest {
@Test
public void shouldConvertParameters() throws Throwable {
List<Argument> arguments = Arrays.asList(new Argument(0, "5"));
StepDefinition stepDefinition = mock(StepDefinition.class);
Class<?>[] parameterTypes = {Integer.TYPE};
when(stepDefinition.getParameterTypes()).thenReturn(parameterTypes);
Step stepWithoutDocStringOrTable = mock(Step.class);
when(stepWithoutDocStringOrTable.getDocString()).thenReturn(null);
when(stepWithoutDocStringOrTable.getRows()).thenReturn(null);
StepDefinitionMatch stepDefinitionMatch = new StepDefinitionMatch(arguments, stepDefinition, "some.feature", stepWithoutDocStringOrTable, new LocalizedXStreams(), null);
stepDefinitionMatch.runStep(Locale.ENGLISH);
Object[] args = {5};
verify(stepDefinition).execute(args);
}
}