File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,17 @@ abstract class Base implements Server {
9393
9494 private final AtomicBoolean stopping = new AtomicBoolean ();
9595
96+ /**
97+ * Clears custom connection lost listeners. Intended for internal testing use to prevent static
98+ * state leakage between tests. Internal usage only.
99+ */
100+ static void clearState () {
101+ connectionLostListeners .clear ();
102+ connectionLostListeners .add (Base .CONNECTION_LOST );
103+ addressInUseListeners .clear ();
104+ addressInUseListeners .add (Base .ADDRESS_IN_USE );
105+ }
106+
96107 protected void fireStart (List <Jooby > applications , Executor defaultWorker ) {
97108 for (Jooby app : applications ) {
98109 app .setDefaultWorker (defaultWorker ).start (this );
Original file line number Diff line number Diff line change @@ -865,7 +865,7 @@ void sendErrorCustomHandlerException() {
865865 doThrow (new RuntimeException ("Handler crashed" )).when (errorHandler ).apply (any (), any (), any ());
866866
867867 ctx .sendError (cause );
868- verify (log ).error (anyString (), anyString (), any (RuntimeException .class ));
868+ verify (log ).error (anyString (), any (RuntimeException .class ));
869869 }
870870
871871 @ Test
Original file line number Diff line number Diff line change 88import static org .junit .jupiter .api .Assertions .assertFalse ;
99import static org .junit .jupiter .api .Assertions .assertTrue ;
1010
11+ import org .junit .jupiter .api .AfterEach ;
12+ import org .junit .jupiter .api .BeforeEach ;
1113import org .junit .jupiter .api .Test ;
1214
1315public class Issue2369 {
1416
17+ @ BeforeEach
18+ @ AfterEach
19+ public void cleanState () {
20+ Server .Base .clearState ();
21+ }
22+
1523 @ Test
1624 public void shouldCustomizeServerLostException () {
1725 Throwable cause = new IllegalArgumentException ();
You can’t perform that action at this time.
0 commit comments