@Test public void shouldMapSegmentToEventType() { Map<Segment, RunMode> map = mapRunModes(); assertThat( map ) .hasSize( 2 ); byte[] stream = "normal-run".getBytes( US_ASCII ); Segment segment = new Segment( stream, 0, stream.length ); assertThat( map.get( segment ) ) .isEqualTo( NORMAL_RUN ); stream = "rerun-test-after-failure".getBytes( US_ASCII ); segment = new Segment( stream, 0, stream.length ); assertThat( map.get( segment ) ) .isEqualTo( RERUN_TEST_AFTER_FAILURE ); }
static Map<Segment, RunMode> mapRunModes() { Map<Segment, RunMode> map = new HashMap<>(); for ( RunMode e : RunMode.values() ) { byte[] array = e.geRunmode().getBytes( US_ASCII ); map.put( new Segment( array, 0, array.length ), e ); } return map; }
EventConsumerThread extends CloseableDaemonThread { static Map<Segment, RunMode> mapRunModes() { Map<Segment, RunMode> map = new HashMap<>(); for ( RunMode e : RunMode.values() ) { byte[] array = e.geRunmode().getBytes( US_ASCII ); map.put( new Segment( array, 0, array.length ), e ); } return map; } }
EventConsumerThread extends CloseableDaemonThread { static Map<Segment, RunMode> mapRunModes() { Map<Segment, RunMode> map = new HashMap<>(); for ( RunMode e : RunMode.values() ) { byte[] array = e.geRunmode().getBytes( US_ASCII ); map.put( new Segment( array, 0, array.length ), e ); } return map; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); }
EventConsumerThread extends CloseableDaemonThread { static Map<Segment, RunMode> mapRunModes() { Map<Segment, RunMode> map = new HashMap<>(); for ( RunMode e : RunMode.values() ) { byte[] array = e.geRunmode().getBytes( US_ASCII ); map.put( new Segment( array, 0, array.length ), e ); } return map; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); @Override void run(); @Override void disable(); @Override void close(); }
EventConsumerThread extends CloseableDaemonThread { static Map<Segment, RunMode> mapRunModes() { Map<Segment, RunMode> map = new HashMap<>(); for ( RunMode e : RunMode.values() ) { byte[] array = e.geRunmode().getBytes( US_ASCII ); map.put( new Segment( array, 0, array.length ), e ); } return map; } EventConsumerThread( @Nonnull String threadName,
                                @Nonnull ReadableByteChannel channel,
                                @Nonnull EventHandler<Event> eventHandler,
                                @Nonnull CountdownCloseable countdownCloseable,
                                @Nonnull ForkNodeArguments arguments ); @Override void run(); @Override void disable(); @Override void close();  }