### Question:
TraversingBasedASTNodeConverter implements ASTNodeConverter<Model, ApplicationConfiguration> { @Override public ApplicationConfiguration convert(Model model) { ApplicationConfiguration applicationConfiguration = new ApplicationConfiguration(); applicationConfiguration.setApplicationName(model.getName()); applicationConfiguration.setVersion(model.getVersion()); List<ApplicationActionConfiguration> actionConfigurations = model .getActions() .stream() .map(applicationAction -> actionConverter.convert(applicationAction)) .collect(Collectors.toList()); applicationConfiguration.setApplicationActionConfigurationList(actionConfigurations); return applicationConfiguration; } @Inject  TraversingBasedASTNodeConverter(ASTNodeConverter<ApplicationAction, ApplicationActionConfiguration>
                                                            actionConverter); @Override ApplicationConfiguration convert(Model model);  }### Answer:
@Test public void setsNameAndVersion() { Model model = mock(Model.class); actionConverter = mock(ASTNodeConverter.class); when(model.getName()).thenReturn(EXAMPLE_NAME); when(model.getVersion()).thenReturn(EXAMPLE_VERSION); when(model.getActions()).thenReturn(new EListMock<>()); TraversingBasedASTNodeConverter converter = new TraversingBasedASTNodeConverter(actionConverter); ApplicationConfiguration configuration = converter.convert(model); assertEquals(EXAMPLE_NAME, configuration.getApplicationName()); assertEquals(EXAMPLE_VERSION, configuration.getVersion()); }
@Test public void correctlyCreatesElementIsPresent() { actionConverter = mock(ASTNodeConverter.class); List<ApplicationActionConfiguration> mockConfigurations = new ArrayList<>(); for (ApplicationAction applicationAction: exampleModel.getActions()) { ApplicationActionConfiguration actionConfigurationMock = mock(ApplicationActionConfiguration.class); mockConfigurations.add(actionConfigurationMock); when(actionConverter.convert(applicationAction)).thenReturn(actionConfigurationMock); } TraversingBasedASTNodeConverter converter = new TraversingBasedASTNodeConverter(actionConverter); ApplicationConfiguration actual = converter.convert(exampleModel); assertEquals(EXAMPLE_NAME, actual.getApplicationName()); assertEquals(EXAMPLE_VERSION, actual.getVersion()); List<ApplicationActionConfiguration> actionConfigurations = actual.getApplicationActionConfigurationList(); assertEquals(exampleModel.getActions().size(), actionConfigurations.size()); assertEquals(actionConfigurations, mockConfigurations); }