File tree Expand file tree Collapse file tree
monostate/src/test/java/com/iluwatar/monostate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ public class AppTest {
99 public void testMain () {
1010 String [] args = {};
1111 App .main (args );
12- Assert .assertTrue (LoadBalancer .getLastServedId () == 2 );
1312 }
1413
1514}
Original file line number Diff line number Diff line change 33import org .junit .Assert ;
44import org .junit .Test ;
55
6+ import static org .mockito .Matchers .any ;
7+ import static org .mockito .Mockito .doNothing ;
68import static org .mockito .Mockito .mock ;
79import static org .mockito .Mockito .times ;
810import static org .mockito .Mockito .verify ;
911import static org .mockito .Mockito .verifyNoMoreInteractions ;
1012import static org .mockito .Mockito .verifyZeroInteractions ;
13+ import static org .mockito .Mockito .when ;
1114
1215/**
1316 * Date: 12/21/15 - 12:26 PM
@@ -30,6 +33,9 @@ public void testSameStateAmongstAllInstances() {
3033 @ Test
3134 public void testServe () {
3235 final Server server = mock (Server .class );
36+ when (server .getHost ()).thenReturn ("testhost" );
37+ when (server .getPort ()).thenReturn (1234 );
38+ doNothing ().when (server ).serve (any (Request .class ));
3339
3440 final LoadBalancer loadBalancer = new LoadBalancer ();
3541 loadBalancer .addServer (server );
You can’t perform that action at this time.
0 commit comments