-
Notifications
You must be signed in to change notification settings - Fork 8
/
CoffeeMakerTest.java
42 lines (34 loc) · 1.1 KB
/
CoffeeMakerTest.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
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright (c) 2018 Test Smells Project. All rights reserved.
* Author: Kosta Zaikin <[email protected]>
*/
package speed.unnecessary_robolectric;
import coffee.CoffeeMaker;
import coffee.Heater;
import coffee.Pump;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import sample.Good;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import static org.junit.Assert.assertThat;
import static utils.SystemOutMatcher.has;
@Good("Using default JUnit runner which is much faster and takes less memory than Robolectric")
public class CoffeeMakerTest {
@Mock private Heater heater;
@Mock private Pump pump;
private ByteArrayOutputStream output = new ByteArrayOutputStream();
private CoffeeMaker coffeeMaker;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
System.setOut(new PrintStream(output));
coffeeMaker = new CoffeeMaker(heater, pump);
}
@Test public void brew_makesCoffee() {
coffeeMaker.brew();
assertThat(output, has(CoffeeMaker.COFFEE));
}
}