### Question:
AbnormalAnalyzerAppModule extends AbstractModule { @Provides @Singleton Grid provideGrid() { Grid grid = null; try { StatisticDataRepository statisticsRepository = AbnormalAnalyzerApp.getInjector().getInstance(StatisticDataRepository.class); DatasetMetaData metaData = statisticsRepository.getMetaData(); Double gridResolution = metaData.getGridResolution(); grid = Grid.create(gridResolution); LOG.info("Created Grid with size " + grid.getSize() + " meters."); } catch (Exception e) { int defaultGridResolution = getConfiguration().getInt(CONFKEY_APPL_GRID_RESOLUTION_DEFAULT, 200); LOG.warn("Could not obtain grid resolution from statistics file. Assuming grid resolution " + defaultGridResolution + "."); grid = Grid.create(defaultGridResolution); } return grid; } AbnormalAnalyzerAppModule(Path configFile); @Override void configure(); final static long STARTUP_TIMESTAMP; }### Answer:
@Test public void canProvideGridWithDefaultResolution() { Grid grid = sut.provideGrid(); assertEquals(200.0, grid.getResolution(), 1e-6); }
@Test public void canProvideGridWithResolutionFromConfigFile() { configuration.addProperty(CONFKEY_APPL_GRID_RESOLUTION_DEFAULT, 149); Grid grid = sut.provideGrid(); assertEquals(149, grid.getResolution(), 1e-6); }