44import org .eclipse .jetty .util .thread .QueuedThreadPool ;
55import org .junit .After ;
66import org .junit .Test ;
7+
78import spark .embeddedserver .EmbeddedServer ;
89import spark .route .Routes ;
910import spark .staticfiles .StaticFilesConfiguration ;
1011
11- import static org .mockito .Mockito .*;
12+ import static org .mockito .Mockito .mock ;
13+ import static org .mockito .Mockito .times ;
14+ import static org .mockito .Mockito .verify ;
15+ import static org .mockito .Mockito .verifyNoMoreInteractions ;
16+ import static org .mockito .Mockito .when ;
1217
1318public class EmbeddedJettyFactoryTest {
19+
1420 private EmbeddedServer embeddedServer ;
1521
1622 @ Test
@@ -19,14 +25,14 @@ public void create() throws Exception {
1925 final StaticFilesConfiguration staticFilesConfiguration = mock (StaticFilesConfiguration .class );
2026 final Routes routes = mock (Routes .class );
2127
22- when (jettyServerFactory .create (100 ,10 ,10000 )).thenReturn (new Server ());
28+ when (jettyServerFactory .create (100 , 10 , 10000 )).thenReturn (new Server ());
2329
2430 final EmbeddedJettyFactory embeddedJettyFactory = new EmbeddedJettyFactory (jettyServerFactory );
2531 embeddedServer = embeddedJettyFactory .create (routes , staticFilesConfiguration , false );
2632
27- embeddedServer .ignite ("localhost" , 8080 , null , 100 ,10 ,10000 );
33+ embeddedServer .ignite ("localhost" , 6757 , null , 100 , 10 , 10000 );
2834
29- verify (jettyServerFactory , times (1 )).create (100 ,10 ,10000 );
35+ verify (jettyServerFactory , times (1 )).create (100 , 10 , 10000 );
3036 verifyNoMoreInteractions (jettyServerFactory );
3137 }
3238
@@ -42,7 +48,7 @@ public void create_withThreadPool() throws Exception {
4248 final EmbeddedJettyFactory embeddedJettyFactory = new EmbeddedJettyFactory (jettyServerFactory ).withThreadPool (threadPool );
4349 embeddedServer = embeddedJettyFactory .create (routes , staticFilesConfiguration , false );
4450
45- embeddedServer .ignite ("localhost" , 8080 , null , 0 ,0 , 0 );
51+ embeddedServer .ignite ("localhost" , 6758 , null , 0 , 0 , 0 );
4652
4753 verify (jettyServerFactory , times (1 )).create (threadPool );
4854 verifyNoMoreInteractions (jettyServerFactory );
@@ -54,19 +60,21 @@ public void create_withNullThreadPool() throws Exception {
5460 final StaticFilesConfiguration staticFilesConfiguration = mock (StaticFilesConfiguration .class );
5561 final Routes routes = mock (Routes .class );
5662
57- when (jettyServerFactory .create (100 ,10 ,10000 )).thenReturn (new Server ());
63+ when (jettyServerFactory .create (100 , 10 , 10000 )).thenReturn (new Server ());
5864
5965 final EmbeddedJettyFactory embeddedJettyFactory = new EmbeddedJettyFactory (jettyServerFactory ).withThreadPool (null );
6066 embeddedServer = embeddedJettyFactory .create (routes , staticFilesConfiguration , false );
6167
62- embeddedServer .ignite ("localhost" , 8080 , null , 100 ,10 ,10000 );
68+ embeddedServer .ignite ("localhost" , 6759 , null , 100 , 10 , 10000 );
6369
64- verify (jettyServerFactory , times (1 )).create (100 ,10 ,10000 );
70+ verify (jettyServerFactory , times (1 )).create (100 , 10 , 10000 );
6571 verifyNoMoreInteractions (jettyServerFactory );
6672 }
6773
6874 @ After
6975 public void tearDown () throws Exception {
70- if (embeddedServer != null ) embeddedServer .extinguish ();
76+ if (embeddedServer != null ) {
77+ embeddedServer .extinguish ();
78+ }
7179 }
7280}
0 commit comments