@Test public void initAllAnalyses() throws Exception { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.addProperty(CONFKEY_ANALYSIS_COG_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_SOG_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_TYPESIZE_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_DRIFT_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_CLOSEENCOUNTER_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_FREEFLOW_ENABLED, true); configuration.addProperty(CONFKEY_ANALYSIS_FREEFLOW_BBOX, new Integer[] {1, 2, 3, 4}); configuration.addProperty(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_LENGTH, 2.0); configuration.addProperty(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_BREADTH, 3.0); configuration.addProperty(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_BEHIND, 0.25); final JUnit4Mockery context = new JUnit4Mockery(); Injector injectorMock = context.mock(Injector.class); EventEmittingTracker trackingServiceMock = context.mock(EventEmittingTracker.class); SafetyZoneService safetyZoneService = new SafetyZoneService(configuration); context.checking(new Expectations() {{ ignoring(trackingServiceMock); oneOf(injectorMock).getInstance(with(CourseOverGroundAnalysis.class)); will(returnValue(new CourseOverGroundAnalysis(configuration, null, null, trackingServiceMock, null, null))); oneOf(injectorMock).getInstance(with(SpeedOverGroundAnalysis.class)); will(returnValue(new SpeedOverGroundAnalysis(configuration, null, null, trackingServiceMock, null, null))); oneOf(injectorMock).getInstance(with(ShipTypeAndSizeAnalysis.class)); will(returnValue(new ShipTypeAndSizeAnalysis(configuration, null, null, trackingServiceMock, null, null))); oneOf(injectorMock).getInstance(with(DriftAnalysis.class)); will(returnValue(new DriftAnalysis(configuration, null, trackingServiceMock, null))); oneOf(injectorMock).getInstance(with(SuddenSpeedChangeAnalysis.class)); will(returnValue(new SuddenSpeedChangeAnalysis(configuration, null, trackingServiceMock, null))); oneOf(injectorMock).getInstance(with(CloseEncounterAnalysis.class)); will(returnValue(new CloseEncounterAnalysis(configuration, null, trackingServiceMock, null, safetyZoneService))); oneOf(injectorMock).getInstance(with(FreeFlowAnalysis.class)); will(returnValue(new FreeFlowAnalysis(configuration, null, trackingServiceMock, null))); }}); PacketHandlerImpl sut = new PacketHandlerImpl(configuration, injectorMock, null, null, null, null); Set<Analysis> analyses = sut.getAnalyses(); assertEquals(7, analyses.size()); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof CourseOverGroundAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof SpeedOverGroundAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof ShipTypeAndSizeAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof DriftAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof SuddenSpeedChangeAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof CloseEncounterAnalysis)); assertEquals(true, analyses.stream().anyMatch(a -> a instanceof FreeFlowAnalysis)); }
Set<Analysis> getAnalyses() { return this.analyses; }
PacketHandlerImpl implements PacketHandler { Set<Analysis> getAnalyses() { return this.analyses; } }
PacketHandlerImpl implements PacketHandler { Set<Analysis> getAnalyses() { return this.analyses; } @Inject  PacketHandlerImpl(
            Configuration configuration,
            Injector injector,
            AppStatisticsService statisticsService,
            EventEmittingTracker tracker,
            Set<IPacketFilter> filters,
            @Named("shipNameFilter") Predicate<AisPacket> shipNameFilter
    ); }
PacketHandlerImpl implements PacketHandler { Set<Analysis> getAnalyses() { return this.analyses; } @Inject  PacketHandlerImpl(
            Configuration configuration,
            Injector injector,
            AppStatisticsService statisticsService,
            EventEmittingTracker tracker,
            Set<IPacketFilter> filters,
            @Named("shipNameFilter") Predicate<AisPacket> shipNameFilter
    ); void accept(final AisPacket packet); }
PacketHandlerImpl implements PacketHandler { Set<Analysis> getAnalyses() { return this.analyses; } @Inject  PacketHandlerImpl(
            Configuration configuration,
            Injector injector,
            AppStatisticsService statisticsService,
            EventEmittingTracker tracker,
            Set<IPacketFilter> filters,
            @Named("shipNameFilter") Predicate<AisPacket> shipNameFilter
    ); void accept(final AisPacket packet);  }