File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/test/java/io/github/benas/unixstream Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .github .benas .unixstream ;
2
+
3
+ import org .junit .Before ;
4
+ import org .junit .Test ;
5
+ import org .junit .runner .RunWith ;
6
+ import org .mockito .Mock ;
7
+ import org .mockito .Mockito ;
8
+ import org .mockito .junit .MockitoJUnitRunner ;
9
+
10
+ import java .io .BufferedReader ;
11
+ import java .io .IOException ;
12
+
13
+ import static org .mockito .Mockito .verify ;
14
+
15
+ @ RunWith (MockitoJUnitRunner .class )
16
+ public class StandardInputSupplierTest {
17
+
18
+ @ Mock
19
+ private BufferedReader bufferedReader ;
20
+ @ Mock
21
+ private IOException exception ;
22
+
23
+ private StandardInputSupplier standardInputSupplier ;
24
+
25
+ @ Before
26
+ public void setUp () throws Exception {
27
+ standardInputSupplier = new StandardInputSupplier (bufferedReader );
28
+ }
29
+
30
+ @ Test
31
+ public void get () throws Exception {
32
+ standardInputSupplier .get ();
33
+
34
+ verify (bufferedReader ).readLine ();
35
+ }
36
+
37
+ @ Test (expected = RuntimeException .class )
38
+ public void get_whenBufferedReaderThrowsException () throws Exception {
39
+ Mockito .when (bufferedReader .readLine ()).thenThrow (exception );
40
+
41
+ standardInputSupplier .get ();
42
+ }
43
+
44
+ }
You can’t perform that action at this time.
0 commit comments