auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Variable getVariable(VariableIdentifier identifier) throws VariableNotDefinedException{ // FIXME this does not handle namespaces correctly Variable v = symbolTable.get(identifier); if(v == null){ // no such variable in this scope; check parent scope if(parentScope == null){ throw new VariableNotDefinedException(identifier); } return parentScope.getVariable(identifier); }else{ return v; } }

Target:
public Variable getVariable(VariableIdentifier identifier) throws VariableNotDefinedException { // FIXME this does not handle namespaces correctly Variable v = symbolTable.get(identifier); if (v == null) { // no such variable in this scope; check parent scope if (parentScope == null) { throw new VariableNotDefinedException(identifier); } else { return parentScope.getVariable(identifier); } } else { return v; } }
Source:
void testValidSheets() throws IOException { DataImporter dimp = new RawDataSpreadsheetImporter(); //Check that a canonical file passes File file1 = createValidTestSpreadsheet("/tmp/valid1.xlsx"); Map<Integer,String> errors = dimp.validate(file1); for (Integer i: errors.keySet()) { System.out.printf("Unexpected error, row %d: %s", i, errors.get(i)); } assertEquals(0, errors.size()); }

Target:
public void testValidSheets() throws IOException { DataImporter dimp = new RawDataSpreadsheetImporter(); //Check that a canonical file passes File file1 = createValidTestSpreadsheet("/tmp/valid1.xlsx"); Map<Integer,String> errors = dimp.validate(file1); assertEquals(0, errors.size()); }
Source:
private SurveyAssignment marshallToDomain(SurveyAssignmentDto dto) { //String[] handsOff = {"keyId", "key"}; final SurveyAssignment sa = new SurveyAssignment(); BeanUtils.copyProperties(dto, sa); sa.setKey(KeyFactory.createKey("SurveyAssignment", dto.getKeyId())); sa.setDeviceIds(dto.getDevices()); sa.setSurveyIds(dto.getSurveys()); return sa; }

Target:
private SurveyAssignment marshallToDomain(SurveyAssignmentDto dto) { final SurveyAssignment sa = new SurveyAssignment(); BeanUtils.copyProperties(dto, sa); if (dto.getKeyId() != null) { sa.setKey(KeyFactory.createKey("SurveyAssignment", dto.getKeyId())); } sa.setDeviceIds(dto.getDevices()); sa.setSurveyIds(dto.getSurveys()); return sa; }
Source:
protected List<QuestionDto> parseQuestions(String response) throws Exception { final ObjectMapper JSON_RESPONSE_PARSER = new ObjectMapper(); List<QuestionDto> dtoList = new ArrayList<QuestionDto>(); final JsonNode questionListNode = JSON_RESPONSE_PARSER.readTree(response).get("dtoList"); final List<QuestionDto> qList = JSON_RESPONSE_PARSER.readValue( questionListNode, new TypeReference<List<QuestionDto>>() { }); dtoList.addAll(qList); //Why? return dtoList; }

Target:
protected List<QuestionDto> parseQuestions(String response) throws Exception { final ObjectMapper JSON_RESPONSE_PARSER = new ObjectMapper(); final JsonNode questionListNode = JSON_RESPONSE_PARSER.readTree(response).get("dtoList"); final List<QuestionDto> qList = JSON_RESPONSE_PARSER.readValue( questionListNode, new TypeReference<List<QuestionDto>>() { }); return qList; }
Source:
protected String getDiaarinumero(Student student) { Long studyProgrammeId = student.getStudyProgramme() != null ? student.getStudyProgramme().getId() : null; Long curriculumId = student.getCurriculum() != null ? student.getCurriculum().getId() : null; if ((studyProgrammeId != null) && (curriculumId != null)) return settings.getDiaariNumero(studyProgrammeId, curriculumId); else return null; }

Target:
protected String getDiaarinumero(Student student) { Long studyProgrammeId = student.getStudyProgramme() != null ? student.getStudyProgramme().getId() : null; Long curriculumId = student.getCurriculum() != null ? student.getCurriculum().getId() : null; if ((studyProgrammeId != null) && (curriculumId != null)) { return settings.getDiaariNumero(studyProgrammeId, curriculumId); } else { return null; } }
Source:
protected boolean isPakollinenOppiaine(Student student, KoskiOppiaineetYleissivistava oppiaine) { Set<KoskiOppiaineetYleissivistava> pakollisetOppiaineet = settings.getPakollisetOppiaineet(student.getStudyProgramme().getId()); if (pakollisetOppiaineet != null) return pakollisetOppiaineet.contains(oppiaine); // TODO Vapautetut aineet return false; }

Target:
protected boolean isPakollinenOppiaine(Student student, KoskiOppiaineetYleissivistava oppiaine) { Set<KoskiOppiaineetYleissivistava> pakollisetOppiaineet = settings.getPakollisetOppiaineet(student.getStudyProgramme().getId()); if (pakollisetOppiaineet != null) { return pakollisetOppiaineet.contains(oppiaine); } return false; }
Source:
public void should_throw_error_if_consumer_array_is_null() { // GIVEN Consumer<String>[] consumers = null; Object o = null; String message = "The Consumer<? super E>... expressing the assertions consumers must not be null"; // WHEN/THEN assertThatNullPointerException().isThrownBy(() -> assertThat(actual).satisfy(consumers)) .withMessage(message); }

Target:
public void should_throw_error_if_consumer_array_is_null() { // GIVEN Consumer<String>[] consumers = null; String message = "The Consumer<? super E>... expressing the assertions consumers must not be null"; // WHEN/THEN assertThatNullPointerException().isThrownBy(() -> assertThat(actual).satisfy(consumers)) .withMessage(message); }
Source:
private ShouldHaveMessage(Throwable actual, String expectedMessage) { super("%n" + "Expecting message to be:%n" + " <%s>%n" + "but was:%n" + " <%s>%n" + "%n" + "Throwable that failed the check:%n" + "%n" + Strings.escapePercent(getStackTrace(actual)), // to avoid AssertJ default String formatting expectedMessage, actual.getMessage()); }

Target:
private ShouldHaveMessage(Throwable actual, String expectedMessage) { super("%n" + "Expecting message to be:%n" + " <%s>%n" + "but was:%n" + " <%s>%n" + "%n" + "Throwable that failed the check:%n" + "%n" + escapePercent(getStackTrace(actual)), // to avoid AssertJ default String formatting expectedMessage, actual.getMessage()); }
Source:
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { if (parameterContext.getParameter().getType() == SoftAssertions.class) { return getStore(extensionContext).getOrComputeIfAbsent(SoftAssertions.class); } return getStore(extensionContext).getOrComputeIfAbsent(BDDSoftAssertions.class); }

Target:
public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { // The parameter type is guaranteed to be either SoftAssertions or BDDSoftAssertions return getStore(extensionContext).getOrComputeIfAbsent(parameterContext.getParameter().getType()); }
Source:
public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { // Given Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); // Expect thrown.expectAssertionError(ShouldNotHaveThrown.shouldNotHaveThrown(exception)); // When assertThatCode(boom).doesNotThrowAnyException(); }

Target:
public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { // Given Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); // Expect thrown.expectAssertionError(shouldNotHaveThrown(exception)); // When assertThatCode(boom).doesNotThrowAnyException(); }
Source:
protected String defaultErrorMessage(Description description, Representation representation) { if (actualAndExpectedHaveSameStringRepresentation()) { return defaultDetailedErrorMessage(description, representation); } return comparisonStrategy.isStandard() ? messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE, actual, expected) : messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE_USING_COMPARATOR, actual, expected, comparisonStrategy); }

Target:
private String defaultErrorMessage(Description description, Representation representation) { if (actualAndExpectedHaveSameStringRepresentation()) { // Example : actual = 42f and expected = 42d gives actual : "42" and expected : "42" therefore we need // to create a detailed error message` return defaultDetailedErrorMessage(description, representation); } return comparisonStrategy.isStandard() ? messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE, actual, expected) : messageFormatter.format(description, representation, EXPECTED_BUT_WAS_MESSAGE_USING_COMPARATOR, actual, expected, comparisonStrategy); }
Source:
JWTProcessor<SecurityContext> processor() { ResourceRetriever jwkSetRetriever = new RestOperationsResourceRetriever(this.restOperations); JWKSource<SecurityContext> jwkSource = jwkSource(jwkSetRetriever); ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>(); jwtProcessor.setJWSKeySelector(jwsKeySelector(jwkSource)); // Spring Security validates the claim set independent from Nimbus jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> { }); jwtProcessorCustomizer.accept(jwtProcessor); return jwtProcessor; }

Target:
JWTProcessor<SecurityContext> processor() { ResourceRetriever jwkSetRetriever = new RestOperationsResourceRetriever(this.restOperations); JWKSource<SecurityContext> jwkSource = jwkSource(jwkSetRetriever); ConfigurableJWTProcessor<SecurityContext> jwtProcessor = new DefaultJWTProcessor<>(); jwtProcessor.setJWSKeySelector(jwsKeySelector(jwkSource)); // Spring Security validates the claim set independent from Nimbus jwtProcessor.setJWTClaimsSetVerifier((claims, context) -> { }); this.jwtProcessorCustomizer.accept(jwtProcessor); return jwtProcessor; }
Source:
public Resource retrieveResource(URL url) { String jwkSet = cache.get(url.toString(), () -> resourceRetriever.retrieveResource(url).getContent()); return new Resource(jwkSet, "UTF-8"); }

Target:
public Resource retrieveResource(URL url) throws IOException { String jwkSet; try { jwkSet = cache.get(url.toString(), () -> resourceRetriever.retrieveResource(url).getContent()); } catch (Exception ex) { throw new IOException(ex); } return new Resource(jwkSet, "UTF-8"); }
Source:
public RequestContextDataHolder(@Nullable HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Authentication authentication) { this.request = request; this.response = response; this.authentication = authentication; }

Target:
RequestContextDataHolder(@Nullable HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Authentication authentication) { this.request = request; this.response = response; this.authentication = authentication; }
Source:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); for (OAuth2AuthorizedClientProvider authorizedClientProvider: authorizedClientProviders) { final OAuth2AuthorizedClient oauth2AuthorizedClient = authorizedClientProvider.authorize(context); if (oauth2AuthorizedClient != null) { return oauth2AuthorizedClient; } } return null; }

Target:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); for (OAuth2AuthorizedClientProvider authorizedClientProvider : authorizedClientProviders) { OAuth2AuthorizedClient oauth2AuthorizedClient = authorizedClientProvider.authorize(context); if (oauth2AuthorizedClient != null) { return oauth2AuthorizedClient; } } return null; }
Source:
public static OAuth2AuthorizationRequest.Builder request() { String registrationId = "registration-id"; String clientId = "client-id"; Map<String, Object> additionalParameters = new HashMap<>(); additionalParameters.put(OAuth2ParameterNames.REGISTRATION_ID, registrationId); return OAuth2AuthorizationRequest.authorizationCode() .authorizationUri("https://example.com/login/oauth/authorize") .clientId(clientId) .scope("openid") .redirectUri("https://example.com/authorize/oauth2/code/registration-id") .state("state") .additionalParameters(additionalParameters); }

Target:
public static OAuth2AuthorizationRequest.Builder request() { String registrationId = "registration-id"; String clientId = "client-id"; Map<String, Object> additionalParameters = new HashMap<>(); additionalParameters.put(OAuth2ParameterNames.REGISTRATION_ID, registrationId); return OAuth2AuthorizationRequest.authorizationCode() .authorizationUri("https://example.com/login/oauth/authorize") .clientId(clientId) .redirectUri("https://example.com/authorize/oauth2/code/registration-id") .state("state") .additionalParameters(additionalParameters); }
Source:
protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.rememberMe() .rememberMeServices(new TokenBasedRememberMeServices("key", userDetailsService())); // @formatter:on }

Target:
protected void configure(HttpSecurity http) throws Exception { super.configure(http); // @formatter:off http.rememberMe() .rememberMeServices(new TokenBasedRememberMeServices("key", userDetailsService())); // @formatter:on }
Source:
public PlayerColor getPiranha() { if (state == RED) return PlayerColor.RED; else if (state == BLUE) return PlayerColor.BLUE; return null; }

Target:
public Optional<PlayerColor> getPiranha() { if (state == RED) return Optional.of(PlayerColor.RED); else if (state == BLUE) return Optional.of(PlayerColor.BLUE); return Optional.empty(); }
Source:
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); subscriptions.add(timespanSubject // .flatMap(trendingSearch) // .map(new SearchResultToRepositoryList()), // trendingAdapter); // Load the default selection. timespanSubject.onNext(timespanAdapter.getItem(timespanView.getSelectedItemPosition())); }

Target:
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); subscriptions.add(timespanSubject // .flatMap(trendingSearch) // .map(SearchResultToRepositoryList.instance()), // trendingAdapter); // Load the default selection. timespanSubject.onNext(timespanAdapter.getItem(timespanView.getSelectedItemPosition())); }
Source:
@Override public String toString() { return createdSince == null ? "" : "created:>=" + ISO_8601_DATE.print(createdSince); }

Target:
@Override public String toString() { // Returning null here is not ideal, but it lets retrofit drop the query param altogether. return createdSince == null ? null : "created:>=" + ISO_8601_DATE.print(createdSince); }
Source:
private boolean checkWMSLayerMinMaxScale(WMSLayerInfo wmsLayerInfo, double mapScale) { // // if none configured if (wmsLayerInfo.getMinScale() == null && wmsLayerInfo.getMaxScale() == null) return true; if (wmsLayerInfo.getMinScale() != null) if (mapScale < wmsLayerInfo.getMinScale()) return false; // return false map scale is below min if (wmsLayerInfo.getMaxScale() != null) if (mapScale > wmsLayerInfo.getMaxScale()) return false; // return false map scale is above max return true; }

Target:
private boolean checkWMSLayerMinMaxScale(WMSLayerInfo wmsLayerInfo, double mapScale) { // if none configured if (wmsLayerInfo.getMinScale() == null && wmsLayerInfo.getMaxScale() == null) return true; // return false map scale is below min if (wmsLayerInfo.getMinScale() != null && mapScale < wmsLayerInfo.getMinScale()) return false; // return false map scale is above max if (wmsLayerInfo.getMaxScale() != null && mapScale > wmsLayerInfo.getMaxScale()) return false; return true; }
Source:
public void testGetGeoJsonResponseWfs20() throws Exception { // execute the WFS 2.0 request JSON response = getAsJSON( "wfs?request=GetFeature&version=2.0" + "&typenames=st_gml32:Station_gml32&outputFormat=application/json"); print(response); // validate the obtained response checkStation1Exists(response); }

Target:
public void testGetGeoJsonResponseWfs20() throws Exception { // execute the WFS 2.0 request JSON response = getAsJSON( "wfs?request=GetFeature&version=2.0" + "&typenames=st_gml32:Station_gml32&outputFormat=application/json"); // validate the obtained response checkStation1Exists(response); }
Source:
public ReferencedEnvelope getBounds(Filter filter) { try { GranuleSource source = reader.getGranules(reader.getGridCoverageNames()[0], true); Query query = new Query(null, filter); if (filter != null) { query.setFilter(filter); } // reading the features using the build query FeatureCollection featureCollection = source.getGranules(query); return featureCollection.getBounds(); } catch (Exception exception) { throw new RuntimeException("Failed to collect bounds", exception); } }

Target:
public ReferencedEnvelope getBounds(Filter filter) { try { GranuleSource source = reader.getGranules(reader.getGridCoverageNames()[0], true); Query query = new Query(); if (filter != null) { query.setFilter(filter); } // reading the features using the build query FeatureCollection featureCollection = source.getGranules(query); return featureCollection.getBounds(); } catch (Exception exception) { throw new RuntimeException("Failed to collect bounds", exception); } }
Source:
private static Number parseValue(String s, Class dataType) throws ParseException { if (Date.class.isAssignableFrom(dataType)) { long period = TimeParser.parsePeriod(s); return period; } else { // TODO: add support for Number, e.g., elevation throw new IllegalArgumentException("Unsupported value type " + dataType); } }

Target:
private static Number parseValue(String s, Class dataType) throws ParseException { if (Date.class.isAssignableFrom(dataType)) { return TimeParser.parsePeriod(s); } // TODO: add support for Number, e.g., elevation throw new IllegalArgumentException("Unsupported value type " + dataType); }
Source:
public FileSystemResource(String path) { this.path = Paths.convert(path); this.file = Paths.toFile(baseDirectory, path); }

Target:
public FileSystemResource(String path) { this.path = path; this.file = Paths.toFile(baseDirectory, path); }
Source:
public void testWorkspaceQualifiedNoLayersError() throws Exception { Document dom = getAsDOM("sf/wms?bbox=" + bbox + "&styles=" + "&layers=" + "&format=image/png" + "&request=GetMap" + "&width=550" + "&height=250" + "&srs=EPSG:4326", Charset.defaultCharset().displayName()); print(dom); assertEquals("ServiceExceptionReport", dom.getDocumentElement().getNodeName()); assertTrue(dom.getDocumentElement().getTextContent().contains("No LAYERS has been requested")); }

Target:
public void testWorkspaceQualifiedNoLayersError() throws Exception { Document dom = getAsDOM("sf/wms?bbox=" + bbox + "&styles=" + "&layers=" + "&format=image/png" + "&request=GetMap" + "&width=550" + "&height=250" + "&srs=EPSG:4326", Charset.defaultCharset().displayName()); assertEquals("ServiceExceptionReport", dom.getDocumentElement().getNodeName()); assertTrue(dom.getDocumentElement().getTextContent().contains("No LAYERS has been requested")); }
Source:
public boolean existsRole(String rolename) { try { if(logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Checking Role [" + rolename + "] on ActiveRoleService [" + securityManager.getActiveRoleService() + "]"); } return securityManager.getActiveRoleService().getRoleByName(rolename) != null; } catch (IOException e) { logger.log(Level.WARNING, "No matching Role [" + rolename + "] on ActiveRoleService", e); return false; } }

Target:
public boolean existsRole(String rolename) { try { if(logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Checking Role [" + rolename + "] on ActiveRoleService [" + securityManager.getActiveRoleService() + "]"); } return securityManager.getActiveRoleService().getRoleByName(rolename) != null; } catch (IOException e) { logger.log(Level.WARNING, e.getMessage(), e); return false; } }
Source:
public void testGridSetLoading() throws Exception { // let's wait a max of 30 seconds for the grid set registration GWC gwc = GWC.get(); int waited = 0; while(waited <= 30000 && GWC.get().getGridSetBroker().get(INSPIRE_GRID_SET_NAME) == null) { // let' wait 100 milliseconds Thread.sleep(100); waited += 100; } // let's see if the inspire grid set has been correctly registered assertThat(gwc.getGridSetBroker().get(INSPIRE_GRID_SET_NAME), notNullValue()); assertThat(gwc.isInternalGridSet(INSPIRE_GRID_SET_NAME), is(true)); }

Target:
public void testGridSetLoading() throws Exception { GWC gwc = GWC.get(); // let's see if the inspire grid set has been correctly registered assertThat(gwc.getGridSetBroker().get(INSPIRE_GRID_SET_NAME), notNullValue()); assertThat(gwc.isInternalGridSet(INSPIRE_GRID_SET_NAME), is(true)); }
Source:
protected void setUpTestData(SystemTestData testData) throws Exception { testData.setUpSecurity(); System.setProperty("DefaultCatalogStore", "org.geoserver.csw.store.simple.GeoServerSimpleCatalogStore"); System.setProperty("ALLOW_ENV_PARAMETRIZATION", "true"); // copy all records into the data directory File root = testData.getDataDirectoryRoot(); File catalog = new File(root, "catalog"); File records = new File("./src/test/resources/org/geoserver/csw/records"); FileUtils.copyDirectory(records, catalog); }

Target:
protected void setUpTestData(SystemTestData testData) throws Exception { testData.setUpSecurity(); System.setProperty("DefaultCatalogStore", "org.geoserver.csw.store.simple.GeoServerSimpleCatalogStore"); // copy all records into the data directory File root = testData.getDataDirectoryRoot(); File catalog = new File(root, "catalog"); File records = new File("./src/test/resources/org/geoserver/csw/records"); FileUtils.copyDirectory(records, catalog); }
Source:
public void testMapResult() throws Exception { String ext = getExtension(); String xml = "<wps:Execute service='WPS' version='1.0.0' xmlns:wps='http://www.opengis.net/wps/1.0.0' " + "xmlns:ows='http://www.opengis.net/ows/1.1'>" + "<ows:Identifier>" + ext + ":map</ows:Identifier>" + "<wps:DataInputs>" + "</wps:DataInputs>" + "<wps:ResponseForm>" + "<wps:RawDataOutput mimeType=\"text/xml\">" + "<ows:Identifier>result</ows:Identifier>" + "</wps:RawDataOutput>" + "</wps:ResponseForm>" + "</wps:Execute>"; Document doc = postAsDOM("wps", xml); print(doc); assertEquals("map", doc.getDocumentElement().getLocalName()); assertXpathEvaluatesTo("widget", "/map/name", doc); assertXpathEvaluatesTo("12.99", "/map/price", doc); }

Target:
public void testMapResult() throws Exception { String ext = getExtension(); String xml = "<wps:Execute service='WPS' version='1.0.0' xmlns:wps='http://www.opengis.net/wps/1.0.0' " + "xmlns:ows='http://www.opengis.net/ows/1.1'>" + "<ows:Identifier>" + ext + ":map</ows:Identifier>" + "<wps:DataInputs>" + "</wps:DataInputs>" + "<wps:ResponseForm>" + "<wps:RawDataOutput mimeType=\"text/xml\">" + "<ows:Identifier>result</ows:Identifier>" + "</wps:RawDataOutput>" + "</wps:ResponseForm>" + "</wps:Execute>"; Document doc = postAsDOM("wps", xml); //print(doc); assertEquals("map", doc.getDocumentElement().getLocalName()); assertXpathEvaluatesTo("widget", "/map/name", doc); assertXpathEvaluatesTo("12.99", "/map/price", doc); }
Source:
public static @Nullable LoggingInfo getLogging(GeoServerResourceLoader loader) throws IOException { // Exposing this is a hack to provide JDBCConfig with the information it needs to compute // the "change" between logging.xml and the versions stored in JDBC. KS // TODO find a better solution than re-initializing on JDBCCOnfig startup. Resource f= loader.get( "logging.xml" ); if ( f != null ) { XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister(); BufferedInputStream in = new BufferedInputStream( f.in() ); try { LoggingInfo loginfo = xp.load(in,LoggingInfo.class); return loginfo; } finally { in.close(); } } else { return null; } }

Target:
public static @Nullable LoggingInfo getLogging(GeoServerResourceLoader loader) throws IOException { // Exposing this is a hack to provide JDBCConfig with the information it needs to compute // the "change" between logging.xml and the versions stored in JDBC. KS // TODO find a better solution than re-initializing on JDBCCOnfig startup. Resource f= loader.get( "logging.xml" ); if ( f != null ) { XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister(); try (BufferedInputStream in = new BufferedInputStream(f.in())) { LoggingInfo loginfo = xp.load(in,LoggingInfo.class); return loginfo; } } else { return null; } }
Source:
public void storeKeyStore() throws IOException{ // store away the keystore assertActivatedKeyStore(); OutputStream fos = getResource().out(); char[] passwd = securityManager.getMasterPassword(); try { ks.store(fos, passwd); } catch (Exception e) { throw new IOException(e); } finally { securityManager.disposePassword(passwd); } fos.close(); }

Target:
public void storeKeyStore() throws IOException{ // store away the keystore assertActivatedKeyStore(); try (OutputStream fos = getResource().out()) { char[] passwd = securityManager.getMasterPassword(); try { ks.store(fos, passwd); } catch (Exception e) { throw new IOException(e); } finally { securityManager.disposePassword(passwd); } } }
Source:
public synchronized void addListener(File file, String path, ResourceListener listener) { if( watcher == null ){ // Would be better if we could make FileSystemResource a DisposableBean instead Disposer disposer = GeoServerExtensions.bean(Disposer.class); watcher = new FileSystemWatcher(); if(disposer!=null) { disposer.register(watcher); } else { LOGGER.warning("Disposer not available to register for disposal. FileSystemWatcher may not be closed at application shutdown."); } } watcher.addListener( file, path, listener ); }

Target:
public synchronized void addListener(File file, String path, ResourceListener listener) { if( watcher == null ){ watcher = new FileSystemWatcher(); } watcher.addListener( file, path, listener ); }
Source:
public DefaultControlFlowConfigurator() { GeoServerResourceLoader loader = (GeoServerResourceLoader) GeoServerExtensions.bean( "resourceLoader"); Resource controlflow = loader.get(PROPERTYFILENAME); configFile = new PropertyFileWatcher(controlflow); //configFile = new PropertyFileWatcher(new File(GeoserverDataDirectory.getGeoserverDataDirectory(), PROPERTYFILENAME)); }

Target:
public DefaultControlFlowConfigurator() { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource controlflow = loader.get(PROPERTYFILENAME); configFile = new PropertyFileWatcher(controlflow); }
Source:
Resource getConfigFile(String configFileLocation ) throws IOException { File file = new File(configFileLocation); Resource resource; if( file.isAbsolute() ){ if( file.canRead() ){ return Files.asResource(file); // used by test cases } else { throw new IOException("Cannot read file: "+file.getCanonicalPath()); } } return null; }

Target:
Resource getConfigFile(String configFileLocation) throws IOException { File file = new File(configFileLocation); if (file.isAbsolute()) { if (file.canRead()) { return Files.asResource(file); // used by test cases } else { throw new IOException("Cannot read file: " + file.getCanonicalPath()); } } return null; }
Source:
protected void mergeOptions(FieldMapper other, List<String> conflicts) { // TODO we should ban updating analyzers as well if (this.enablePositionIncrements != ((TokenCountFieldMapper)other).enablePositionIncrements) { conflicts.add("mapper [" + name() + "] has a different [enable_position_increments] setting"); } if (Objects.equals(this.nullValue, ((TokenCountFieldMapper)other).nullValue) == false) { conflicts.add("mapper [" + name() + "] has a different [null_value] setting"); } this.analyzer = ((TokenCountFieldMapper)other).analyzer; }

Target:
protected void mergeOptions(FieldMapper other, List<String> conflicts) { // TODO we should ban updating analyzers and null values as well if (this.enablePositionIncrements != ((TokenCountFieldMapper)other).enablePositionIncrements) { conflicts.add("mapper [" + name() + "] has a different [enable_position_increments] setting"); } this.analyzer = ((TokenCountFieldMapper)other).analyzer; }
Source:
public static String javaVersion(final String def) { final String javaVersionProperty = SafePropertyAccessor.getProperty("java.version", def); if (javaVersionProperty.equals("0")) return "1.7.0"; // Android return javaVersionProperty; }

Target:
public static String javaVersion(final String def) { final String javaVersionProperty = SafePropertyAccessor.getProperty("java.version", def); if ("0".equals(javaVersionProperty)) return "1.7.0"; // Android return javaVersionProperty; }
Source:
private VideoAttributesType generateVideoAttributes(Encoding encoding) { VideoAttributesType videoAttributes = new VideoAttributesType(); videoAttributes.setHorizontalSize(Optional.fromNullable(encoding.getVideoHorizontalSize()) .or(DEFAULT_HORIZONTAL_SIZE)); videoAttributes.setVerticalSize(Optional.fromNullable(encoding.getVideoVerticalSize()) .or(DEFAULT_VERTICAL_SIZE)); AspectRatioType aspectRatio = new AspectRatioType(); aspectRatio.setValue(Objects.firstNonNull(encoding.getVideoAspectRatio(), DEFAULT_ASPECT_RATIO)); videoAttributes.getAspectRatio().add(aspectRatio); return videoAttributes; }

Target:
private VideoAttributesType generateVideoAttributes(Encoding encoding) { VideoAttributesType videoAttributes = new VideoAttributesType(); videoAttributes.setHorizontalSize(Objects.firstNonNull(encoding.getVideoHorizontalSize(), DEFAULT_HORIZONTAL_SIZE)); videoAttributes.setVerticalSize(Objects.firstNonNull(encoding.getVideoVerticalSize(), DEFAULT_VERTICAL_SIZE)); AspectRatioType aspectRatio = new AspectRatioType(); aspectRatio.setValue(Objects.firstNonNull(encoding.getVideoAspectRatio(), DEFAULT_ASPECT_RATIO)); videoAttributes.getAspectRatio().add(aspectRatio); return videoAttributes; }
Source:
public void onResume() { super.onResume(); // Must disconnectAll before setting closeOnDisconnectAll to know whether to keep the // activity open after disconnecting. if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 && getIntent().getAction() == DISCONNECT_ACTION) { Log.d(TAG, "Got disconnect all request"); disconnectAll(); } // Still close on disconnect if waiting for a disconnect. closeOnDisconnectAll = waitingForDisconnectAll && closeOnDisconnectAll; }

Target:
public void onResume() { super.onResume(); // Must disconnectAll before setting closeOnDisconnectAll to know whether to keep the // activity open after disconnecting. if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 && DISCONNECT_ACTION.equals(getIntent().getAction())) { Log.d(TAG, "Got disconnect all request"); disconnectAll(); } // Still close on disconnect if waiting for a disconnect. closeOnDisconnectAll = waitingForDisconnectAll && closeOnDisconnectAll; }
Source:
public static void listVolumes(ServerContext context) throws Exception { try { listTable(Ample.DataLevel.ROOT, context); } catch (UnsupportedOperationException ex) { // print nothing if no table name exists } System.out.println(); listTable(Ample.DataLevel.METADATA, context); System.out.println(); listTable(Ample.DataLevel.USER, context); }

Target:
public static void listVolumes(ServerContext context) throws Exception { listTable(Ample.DataLevel.ROOT, context); System.out.println(); listTable(Ample.DataLevel.METADATA, context); System.out.println(); listTable(Ample.DataLevel.USER, context); }
Source:
private static boolean checkNoCrypto(byte[] params) { byte[] noCryptoBytes = NO_CRYPTO_VERSION.getBytes(StandardCharsets.UTF_8); return Arrays.equals(params, noCryptoBytes); }

Target:
private static boolean checkNoCrypto(byte[] params) { byte[] noCryptoBytes = NO_CRYPTO_VERSION.getBytes(UTF_8); return Arrays.equals(params, noCryptoBytes); }
Source:
protected void prepareMetrics() { metricsValuesLock.lock(); try { long now = System.currentTimeMillis(); if ((lastUpdate + minimumRefreshDelay) < now) { metricValues = updateFromZookeeper(); lastUpdate = now; } recordValues(); } finally { metricsValuesLock.unlock(); } }

Target:
protected void prepareMetrics() { metricsValuesLock.lock(); try { long now = System.currentTimeMillis(); if ((lastUpdate + minimumRefreshDelay) < now) { metricValues = updateFromZookeeper(); lastUpdate = now; recordValues(); } } finally { metricsValuesLock.unlock(); } }
Source:
public String toJson() { GSonData gd = new GSonData(); gd.candidates = candidates; // replace two space indentation with one space to save bytes in ZK while still leaving it human // readable return GSON.toJson(gd).replaceAll(" ", " "); }

Target:
public String toJson() { GSonData gd = new GSonData(); gd.candidates = candidates; return GSON.toJson(gd); }
Source:
public void testInputFormatBuilderImplTest_ExecuteHints() { SortedMap<String,String> hints = new TreeMap<>(); hints.put("key1", "value1"); hints.put("key2", "value2"); hints.put("key3", "value3"); formatBuilderTest.executionHints(hints); SortedMap<String,String> executionHints = formatBuilderTest.getExecutionHints(); assertEquals(executionHints.toString(), hints.toString()); }

Target:
public void testInputFormatBuilderImplTest_ExecuteHints() { SortedMap<String,String> hints = new TreeMap<>(); hints.put("key1", "value1"); hints.put("key2", "value2"); hints.put("key3", "value3"); formatBuilderTest.executionHints(hints); SortedMap<String,String> executionHints = formatBuilderTest.getExecutionHints(); assertEquals(hints.toString(), executionHints.toString()); }
Source:
public void close() { try { for (RFileSource source : opts.in.getSources()) { source.getInputStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } try { if (this.blockCacheManager != null) { this.blockCacheManager.stop(); } } catch (UnsupportedOperationException e1) { throw new UnsupportedOperationException(e1); } }

Target:
public void close() { try { for (RFileSource source : opts.in.getSources()) { source.getInputStream().close(); } } catch (IOException e) { throw new RuntimeException(e); } if (this.blockCacheManager != null) { this.blockCacheManager.stop(); } }
Source:
public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); // no escaped bytes found so returns the input byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); // incomplete bytes would cause an ArrayIndexOutOfBounds in the past exception.expect(IllegalArgumentException.class); byte[] errorBytes = {0x01}; assertArrayEquals(errorBytes, ByteUtils.unescape(errorBytes)); }

Target:
public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); // no escaped bytes found so returns the input byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); }
Source:
public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); // set logical time type so we can set time on bulk import newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); aconf = getCluster().getServerContext().getConfiguration(); fs = getCluster().getFileSystem(); rootPath = cluster.getTemporaryPath().toString(); testSingleTabletSingleFile(client, false, true); } }

Target:
public void testSetTime() throws Exception { try (AccumuloClient client = createAccumuloClient()) { tableName = "testSetTime_table1"; NewTableConfiguration newTableConf = new NewTableConfiguration(); // set logical time type so we can set time on bulk import newTableConf.setTimeType(TimeType.LOGICAL); client.tableOperations().create(tableName, newTableConf); testSingleTabletSingleFile(client, false, true); } }
Source:
public InputFormatBuilder.InputFormatOptions<T> addIterator(IteratorSetting cfg) { // store iterators by name to prevent duplicates Objects.requireNonNull(cfg, "IteratorSetting must not be null."); this.iterators.put(cfg.getName(), cfg); tableConfigMap.get(currentTable).setIterators(new ArrayList<>(this.iterators.values())); return this; }

Target:
public InputFormatBuilder.InputFormatOptions<T> addIterator(IteratorSetting cfg) { // store iterators by name to prevent duplicates Objects.requireNonNull(cfg, "IteratorSetting must not be null."); tableConfigMap.get(currentTable).addIterator(cfg); return this; }
Source:
public boolean createIfNotExists(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException { try { if (!exists(tableName)) { create(tableName, ntc); return true; } else { return false; } } catch (TableExistsException e) { // should not happen throw new AssertionError(e); } }

Target:
public boolean createIfNotExists(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException { try { create(tableName, ntc); return true; } catch (TableExistsException e) { return false; } }
Source:
public synchronized String getPropertiesPath() { if (propsPath == null) { URL propLocation = SiteConfiguration.getAccumuloPropsLocation(); propsPath = propLocation.getFile(); } return propsPath; }

Target:
public synchronized String getPropertiesPath() { if (propsPath == null) { propsPath = SiteConfiguration.getAccumuloPropsLocation().getFile(); } return propsPath; }
Source:
public Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return (Connector) impl.getAccumuloClient(user, new PasswordToken(passwd)); }

Target:
public Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException { return Connector.from(impl.getAccumuloClient(user, new PasswordToken(passwd))); }
Source:
public void turnCryptoOnInSiteConfig() { SiteConfiguration.clearInstance(); SiteConfiguration siteConfig = SiteConfiguration.getInstance(); siteConfig.set(Property.INSTANCE_CRYPTO_SERVICE, AESCryptoService.class.getName()); siteConfig.set("instance.crypto.opts.kekId", "file:///tmp/testAESFile"); siteConfig.set("instance.crypto.opts.keyManager", "uri"); CryptoServiceFactory.resetInstance(); }

Target:
public void turnCryptoOnInSiteConfig() { SiteConfiguration.clearInstance(); SiteConfiguration siteConfig = SiteConfiguration.create(); siteConfig.set(Property.INSTANCE_CRYPTO_SERVICE, AESCryptoService.class.getName()); siteConfig.set("instance.crypto.opts.kekId", "file:///tmp/testAESFile"); siteConfig.set("instance.crypto.opts.keyManager", "uri"); CryptoServiceFactory.resetInstance(); }
Source:
private boolean switchSource() throws IOException { if (!source.isCurrent()) { source = source.getNewDataSource(); // if our source actually changed, then attempt to close the previous iterator try { if (iter != null) { iter.close(); } } catch (Exception e) { throw new IOException(e); } iter = source.iterator(); return true; } return false; }

Target:
private boolean switchSource() throws IOException { if (!source.isCurrent()) { source = source.getNewDataSource(); iter = source.iterator(); return true; } return false; }
Source:
public DataSource getNewDataSource() { if (switched) throw new IllegalStateException(); if (!isCurrent()) { switched = true; try { if (iter != null) { iter.close(); } iter = null; // ensure files are referenced even if iterator was never seeked before iterator(); } catch (Exception e) { throw new RuntimeException(e); } } return this; }

Target:
public DataSource getNewDataSource() { if (switched) throw new IllegalStateException(); if (!isCurrent()) { switched = true; iter = null; try { // ensure files are referenced even if iterator was never seeked before iterator(); } catch (IOException e) { throw new RuntimeException(); } } return this; }
Source:
public int available() throws IOException { final FSDataInputStream inLocal = in; synchronized (inLocal) { int avail = inLocal.available(); if (pos + avail > end) { avail = (int) (end - pos); } return avail; } }

Target:
public int available() throws IOException { return (int) (end - pos); }
Source:
public void finish() throws IOException { if (!closed) { synchronized (in) { if (!closed) { try { in.close(); } finally { closed = true; if (decompressor != null) { try { compressAlgo.returnDecompressor(decompressor); } finally { decompressor = null; } } } } } } }

Target:
public void finish() throws IOException { synchronized (in) { if (!closed) { try { in.close(); } finally { closed = true; if (decompressor != null) { try { compressAlgo.returnDecompressor(decompressor); } finally { decompressor = null; } } } } } }
Source:
private List<String> getJavaBuildPathLibraries(PropertyDialog pd) { pd.select("Java Build Path"); BuildPathsPropertyPage bppp = new BuildPathsPropertyPage(pd); bppp.activateLibrariesTab(); List<String> libs = new ArrayList<String>(); libs.addAll(bppp.getLibraries()); log.debug("Libraries found after conversion:"); for (String i : libs) { log.debug(" " + i); } return libs; }

Target:
private List<String> getJavaBuildPathLibraries(PropertyDialog pd) { pd.select(new BuildPathsPropertyPage(pd)); BuildPathsPropertyPage bppp = new BuildPathsPropertyPage(pd); bppp.activateLibrariesTab(); List<String> libs = new ArrayList<String>(); libs.addAll(bppp.getLibraries()); log.debug("Libraries found after conversion:"); for (String i : libs) { log.debug(" " + i); } return libs; }
Source:
public static void setup() { WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); preferenceDialog.open(); MavenSettingsPreferencePage prefPage = new MavenSettingsPreferencePage(preferenceDialog); preferenceDialog.select(prefPage); preferenceDialog.ok(); new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); // activate central editor new DefaultEditor(CENTRAL_LABEL); }

Target:
public static void setup() { new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); // activate central editor new DefaultEditor(CENTRAL_LABEL); }
Source:
private Token finishToken(Token token) { _currentToken = token; if (_currentToken == START_OBJECT) { if (_currComplexObjTokenSize > 0) { _complexObjTokenSizeStack.push(_currComplexObjTokenSize); } _currComplexObjTokenSize = _intValue << 1; } else if (_currentToken == START_ARRAY) { if (_currComplexObjTokenSize > 0) { _complexObjTokenSizeStack.push(_currComplexObjTokenSize); } _currComplexObjTokenSize = _intValue; } else if (_currentToken != NOT_AVAILABLE) { _currComplexObjTokenSize--; } return _currentToken; }

Target:
private Token finishToken(Token token) { _currentToken = token; switch (_currentToken) { case START_OBJECT: if (_currComplexObjTokenSize > 0) { _complexObjTokenSizeStack.push(_currComplexObjTokenSize); } // Stores map size as 2*size since map is serialized as list of key-value (2 tokens) pairs _currComplexObjTokenSize = _intValue << 1; break; case START_ARRAY: if (_currComplexObjTokenSize > 0) { _complexObjTokenSizeStack.push(_currComplexObjTokenSize); } _currComplexObjTokenSize = _intValue; break; case NOT_AVAILABLE: break; default: _currComplexObjTokenSize--; } return _currentToken; }
Source:
private static DataSchema backfillSchemaIfPossible(Class<?> type) { // These are all the classes used for type specs that are "schema-less". if (type == CompoundKey.class || type == ComplexResourceKey.class || type == Void.class || (!DataSchemaUtil.isPrimitiveClass(type) && DataTemplateUtil.hasCoercer(type))) { return null; } try { return DataTemplateUtil.getSchema(type); // could be a primitive, DataTemplate, TyperefInfo, or enum } catch (TemplateRuntimeException e) { // can happen in case of custom types return null; } }

Target:
private static DataSchema backfillSchemaIfPossible(Class<?> type) { // These are all the classes used for type specs that are "schema-less". if (type == CompoundKey.class || type == ComplexResourceKey.class || type == Void.class) { return null; } try { return DataTemplateUtil.getSchema(type); // could be a primitive, DataTemplate, TyperefInfo, or enum } catch (TemplateRuntimeException e) { // can happen in case of custom types return null; } }
Source:
public void testConstructorWithUnparseablePath() throws IOException { Path unparseablePath = (new File(".")).toPath().resolve("UnparseableTagFolderName"); try { Tag tag = new ConfigurationTag(unparseablePath); } catch (ParseException e) { //This exception is expected to be thrown; Assert.assertTrue(true); return; } Assert.assertTrue("Error: ParseException has not been thrown!", false); }

Target:
public void testConstructorWithUnparseablePath() throws IOException, ParseException { Path unparseablePath = (new File(".")).toPath().resolve("UnparseableTagFolderName"); Tag tag = new ConfigurationTag(unparseablePath); }
Source:
public Boolean connectorExists(String id) { try { List<ConnectorConfiguration> list = configPersistence.load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id)); if (list.isEmpty()) { return false; } return true; } catch (PersistenceException e) { throw new RuntimeException(e); } }

Target:
public Boolean connectorExists(String id) { try { List<ConnectorConfiguration> list = configPersistence.load(ImmutableMap.of(Constants.CONNECTOR_PERSISTENT_ID, id)); return !list.isEmpty(); } catch (PersistenceException e) { throw new RuntimeException(e); } }
Source:
void shouldReturnEmptyPropertyString() { final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "", Function.identity()); String actualProperty = statistics.getProperty(); assertThat(actualProperty).isEmpty(); }

Target:
void shouldReturnEmptyPropertyString() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "", Function.identity()); String actualProperty = statistics.getProperty(); assertThat(actualProperty).isEmpty(); }
Source:
void shouldReturnCountEmpty() { //Given final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); assertThrows(NullPointerException.class, ()->statistics.getCount("key")); }

Target:
void shouldReturnCountEmpty() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); assertThrows(NullPointerException.class, ()->statistics.getCount("key")); }
Source:
void shouldReturnUnmodifiedOutputForEmptyInput() { final EnvironmentResolver environmentResolver = new EnvironmentResolver(); final String expanded = environmentResolver.expandEnvironmentVariables(new EnvVars(), ""); assertThat(expanded).isEmpty(); }

Target:
void shouldReturnUnmodifiedOutputForEmptyInput() { EnvironmentResolver environmentResolver = new EnvironmentResolver(); String expanded = environmentResolver.expandEnvironmentVariables(new EnvVars(), ""); assertThat(expanded).isEmpty(); }
Source:
void shouldReturnAdjustedOutputForAGivenInputBasedOnDollarSigns() { final EnvironmentResolver environmentResolver = new EnvironmentResolver(); final EnvVars envVars = new EnvVars(); envVars.put(KEY, VALUE); final String previous = "$$Test$$Testing$TestString$$Testing$Test"; final String expanded = environmentResolver.expandEnvironmentVariables(envVars, previous); final String expected = "$Test$Testing$TestString$Testing$Test"; assertThat(expanded).isEqualTo(expected); }

Target:
void shouldReturnAdjustedOutputForAGivenInputBasedOnDollarSigns() { EnvironmentResolver environmentResolver = new EnvironmentResolver(); EnvVars envVars = new EnvVars(); envVars.put(KEY, VALUE); String previous = "$$Test$$Testing$TestString$$Testing$Test"; String expanded = environmentResolver.expandEnvironmentVariables(envVars, previous); String expected = "$Test$Testing$TestString$Testing$Test"; assertThat(expanded).isEqualTo(expected); }
Source:
void shouldReturnTheExpectedIdNameForAListContainingTheExpectedId() { applyGetMethodAndCheckResult(ID_NAME_1, 0, ID_NAME_1, ID_NAME_2, ID_NAME_3); applyGetMethodAndCheckResult(ID_NAME_1, 1, ID_NAME_2, ID_NAME_1, ID_NAME_3); applyGetMethodAndCheckResult(ID_NAME_1, 2, ID_NAME_3, ID_NAME_2, ID_NAME_1); }

Target:
void shouldReturnTheExpectedIdNameForAListContainingTheExpectedId() { applyGetMethodAndCheckResult(ID_NAME_1, 0, ID_NAME_1, ID_NAME_2); applyGetMethodAndCheckResult(ID_NAME_1, 1, ID_NAME_2, ID_NAME_1); }
Source:
void shouldReturnCorrectStringRepresentationForAGivenIdBasedOnAHardcodedClassname() { final ByIdResultSelector byIdResultSelector = new ByIdResultSelector("ID-Name"); assertThat(byIdResultSelector.toString()).isEqualTo( "io.jenkins.plugins.analysis.core.views.ResultAction with ID ID-Name"); }

Target:
void shouldReturnCorrectStringRepresentationForAGivenIdBasedOnAHardcodedClassname() { ByIdResultSelector byIdResultSelector = new ByIdResultSelector("ID-Name"); assertThat(byIdResultSelector.toString()).contains("ID-Name"); }