Description
Problem Description: super class JAXRSClientServerWebSocketTest invoke clearAllMaps() before launch server. But in JAXRSClientServerWebSocketSpringWebAppTest which extends the super class, test fixture override startServers() without clearAllMaps()
Result: May lead to flaky test
Suggestion: Maintain independent test fixture.
// JAXRSClientServerWebSocketTest.java @BeforeClass public static void startServers() throws Exception { AbstractResourceInfo.clearAllMaps(); assertTrue("server did not launch correctly", launchServer(new BookServerWebSocket())); createStaticBus(); }
//JAXRSClientServerWebSocketSpringWebAppTest.java @BeforeClass public static void startServers() throws Exception { startServers(PORT); } protected static void startServers(String port) throws Exception { server = new org.eclipse.jetty.server.Server(Integer.parseInt(port)); WebAppContext webappcontext = new WebAppContext(); String contextPath = null; try { contextPath = JAXRSClientServerWebSocketSpringWebAppTest.class .getResource("/jaxrs_websocket").toURI().getPath(); } catch (URISyntaxException e1) { e1.printStackTrace(); } webappcontext.setContextPath("/webapp"); webappcontext.setWar(contextPath); HandlerCollection handlers = new HandlerCollection(); handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()}); server.setHandler(handlers); server.start(); }