test_class.declarator: versionService
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private VersionService versionService;
test_class.type: VersionService
test_class.var_name: versionService
test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/api/service/info/VersionServiceTest.java
test_class.identifier: VersionServiceTest
test_case.body: @Test
      public void shouldAggregateSameBuildId() throws Exception {
          // given
          final ManifestInfoProvider provider1 = mock(ManifestInfoProvider.class);
          final ManifestInfoProvider provider2 = mock(ManifestInfoProvider.class);
          when(provider1.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
          when(provider2.getManifestInfo()).thenReturn(new ManifestInfo("v1", "1234"));
          ReflectionTestUtils.setField(versionService, "manifestInfoProviders", asList(provider1, provider2));
  
          // when
          final Version version = versionService.version();
  
          // then
          assertEquals("v1", version.getVersionId());
          assertEquals("1234-1234", version.getBuildId());
      }
test_case.class_method_signature: VersionServiceTest.shouldAggregateSameBuildId()
test_case.full_signature: @Test public void shouldAggregateSameBuildId()
test_case.identifier: shouldAggregateSameBuildId
test_case.invocations: mock mock thenReturn when getManifestInfo thenReturn when getManifestInfo setField asList version assertEquals getVersionId assertEquals getBuildId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldAggregateSameBuildId()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(VersionService.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(VersionService.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: UNDEFINED_VERSION_ID = "N/A"
focal_class.modifier: private static final
focal_class.original_string: private static final String UNDEFINED_VERSION_ID = "N/A";
focal_class.type: String
focal_class.var_name: UNDEFINED_VERSION_ID
focal_class.declarator: manifestInfoProviders
focal_class.modifier: @Autowired(required = false)
      private
focal_class.original_string: @Autowired(required = false)
      private List<ManifestInfoProvider> manifestInfoProviders;
focal_class.type: List<ManifestInfoProvider>
focal_class.var_name: manifestInfoProviders
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/api/service/info/VersionService.java
focal_class.identifier: VersionService
focal_class.class_method_signature: VersionService.version()
focal_class.full_signature: @RequestMapping(value = "/version", method = GET) @ApiOperation(value = "Get the version of the service", produces = MediaType.APPLICATION_JSON_VALUE) @Timed @PublicAPI public Version version()
focal_class.identifier: version
focal_class.modifiers: @RequestMapping(value = "/version", method = GET) @ApiOperation(value = "Get the version of the service", produces = MediaType.APPLICATION_JSON_VALUE) @Timed @PublicAPI public
focal_class.parameters: ()
focal_class.return: Version
focal_class.signature: Version version()
focal_method.body: @RequestMapping(value = "/version", method = GET)
      @ApiOperation(value = "Get the version of the service", produces = MediaType.APPLICATION_JSON_VALUE)
      @Timed
      @PublicAPI
      public Version version() {
          String buildId = manifestInfoProviders
                  .stream() //
                  .map(ManifestInfoProvider::getManifestInfo) //
                  .map(ManifestInfo::getBuildId) //
                  .collect(joining("-"));
          final Optional<String> uniqueVersion = manifestInfoProviders
                  .stream() //
                  .map(ManifestInfoProvider::getManifestInfo) //
                  .map(ManifestInfo::getVersionId) //
                  .filter(versionId -> !StringUtils.equals(UNDEFINED_VERSION_ID, versionId)) //
                  .reduce((s, s2) -> {
                      if (StringUtils.equals(s, s2)) {
                          return s;
                      }
                      return s + '-' + s2;
                  });
          String serviceUnifiedVersionId = uniqueVersion.orElse(UNDEFINED_VERSION_ID);
  
          return new Version(serviceUnifiedVersionId, buildId);
      }
focal_method.class_method_signature: VersionService.version()
focal_method.full_signature: @RequestMapping(value = "/version", method = GET) @ApiOperation(value = "Get the version of the service", produces = MediaType.APPLICATION_JSON_VALUE) @Timed @PublicAPI public Version version()
focal_method.identifier: version
focal_method.invocations: collect map map stream joining reduce filter map map stream equals equals orElse
focal_method.modifiers: @RequestMapping(value = "/version", method = GET) @ApiOperation(value = "Get the version of the service", produces = MediaType.APPLICATION_JSON_VALUE) @Timed @PublicAPI public
focal_method.parameters: ()
focal_method.return: Version
focal_method.signature: Version version()