Skip to content

Commit

Permalink
Simplify InitExceptionHandlerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tipsy committed Apr 23, 2017
1 parent d830624 commit 8706ba4
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/test/java/spark/InitExceptionHandlerTest.java
Expand Up @@ -9,36 +9,27 @@


public class InitExceptionHandlerTest { public class InitExceptionHandlerTest {


private static Service service1; private static int NON_VALID_PORT = Integer.MAX_VALUE;
private static Service service2; private static Service service;
private static String errorMessage = ""; private static String errorMessage = "";



@BeforeClass @BeforeClass
public static void setUpClass() throws Exception { public static void setUpClass() throws Exception {

service = ignite();
service1 = ignite(); service.port(NON_VALID_PORT);
service1.port(1122); service.initExceptionHandler((e) -> errorMessage = "Custom init error");
service1.init(); service.init();
service1.awaitInitialization(); service.awaitInitialization();

service2 = ignite();
service2.port(1122);
service2.initExceptionHandler((e) -> errorMessage = "Custom init error");
service2.init();
service2.awaitInitialization();

} }


@Test @Test
public void testGetPort_withRandomPort() throws Exception { public void testInitExceptionHandler() throws Exception {
Assert.assertEquals("Custom init error", errorMessage); Assert.assertEquals("Custom init error", errorMessage);
} }


@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
service1.stop(); service.stop();
service2.stop();
} }


} }

0 comments on commit 8706ba4

Please sign in to comment.