### Question:
ScenariosIndexerStrategy { public Optional<ScenariosIndexer> getScenariosIndexer(Technology technology) { if (technology == null) { log.info("The technology can not be null"); return Optional.empty(); } switch (technology) { case CUCUMBER: return Optional.of(cucumberScenariosIndexerService); case POSTMAN: return Optional.of(postmanScenariosIndexerService); case CYPRESS: return Optional.of(cypressScenariosIndexer); default: log.info("The technology {} is not handled yet. It may be a great feature request ;)", technology); return Optional.empty(); } }  Optional<ScenariosIndexer> getScenariosIndexer(Technology technology);  }### Answer:
@Test public void getScenariosIndexer_returnEmpty_whenTechnologyIsNull(){ Optional<ScenariosIndexer> scenariosIndexer = scenariosIndexerStrategy.getScenariosIndexer(null); assertThat(scenariosIndexer).isEmpty(); }
@Test public void getScenariosIndexer_returnCucumberIndexer_whenTechnologyIsCucumber(){ Optional<ScenariosIndexer> scenariosIndexer = scenariosIndexerStrategy.getScenariosIndexer(Technology.CUCUMBER); assertThat(scenariosIndexer).isEqualTo(Optional.of(cucumberScenariosIndexer)); }
@Test public void getScenariosIndexer_returnPostmanIndexer_whenTechnologyIsPostman(){ Optional<ScenariosIndexer> scenariosIndexer = scenariosIndexerStrategy.getScenariosIndexer(Technology.POSTMAN); assertThat(scenariosIndexer).isEqualTo(Optional.of(postmanScenariosIndexer)); }
@Test public void getScenariosIndexer_returnCypressIndexer_whenTechnologyIsCypress(){ Optional<ScenariosIndexer> scenariosIndexer = scenariosIndexerStrategy.getScenariosIndexer(Technology.CYPRESS); assertThat(scenariosIndexer).isEqualTo(Optional.of(cypressScenariosIndexer)); }