File tree 2 files changed +52
-0
lines changed
src/test/java/cucumber/runtime/groovy
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 52
52
<artifactId >cobertura</artifactId >
53
53
<scope >test</scope >
54
54
</dependency >
55
+ <dependency >
56
+ <groupId >org.mockito</groupId >
57
+ <artifactId >mockito-all</artifactId >
58
+ <scope >test</scope >
59
+ </dependency >
55
60
</dependencies >
56
61
57
62
<build >
Original file line number Diff line number Diff line change
1
+ package cucumber .runtime .groovy ;
2
+
3
+ import cucumber .runtime .CucumberException ;
4
+ import cucumber .runtime .io .ResourceLoader ;
5
+ import groovy .lang .Closure ;
6
+ import org .junit .Before ;
7
+ import org .junit .Test ;
8
+ import org .junit .runner .RunWith ;
9
+ import org .mockito .Mock ;
10
+ import org .mockito .runners .MockitoJUnitRunner ;
11
+
12
+ import static org .mockito .Mockito .verify ;
13
+
14
+
15
+ @ RunWith (MockitoJUnitRunner .class )
16
+ public class GroovyBackendTest {
17
+ @ Mock
18
+ ResourceLoader resourceLoader ;
19
+ @ Mock
20
+ Closure closure ;
21
+
22
+ GroovyBackend backend ;
23
+
24
+ @ Before
25
+ public void setUp () throws Exception {
26
+ backend = new GroovyBackend (resourceLoader );
27
+ }
28
+
29
+ @ Test
30
+ public void builds_world_by_calling_closure () {
31
+ backend .registerWorld (closure );
32
+ backend .buildWorld ();
33
+
34
+ verify (closure ).call ();
35
+ }
36
+
37
+ @ Test
38
+ public void builds_default_wold_if_wold_closer_does_not_set () {
39
+ backend .buildWorld ();
40
+ }
41
+
42
+ @ Test (expected = CucumberException .class )
43
+ public void raises_exception_for_two_wolds () {
44
+ backend .registerWorld (closure );
45
+ backend .registerWorld (closure );
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments