auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setupSnackBar() { snackbar = Snackbar.make(root, "", Snackbar.LENGTH_INDEFINITE); View customSnackBarView = getLayoutInflater().inflate(R.layout.snackbar, null); Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) snackbar.getView(); snackBarLayout.setPadding(0, 0, 0, 0); TextView noticeField = customSnackBarView.findViewById(R.id.snackbar_text); noticeField.setText(R.string.snackbar_empty_visit_list); TextView dismiss_button = customSnackBarView.findViewById(R.id.snackbar_action_button); dismiss_button.setText(R.string.snackbar_select); Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto/Roboto-Medium.ttf"); dismiss_button.setTypeface(typeface); dismiss_button.setOnClickListener(v -> mPresenter.fillForm()); snackBarLayout.addView(customSnackBarView, 0); }

Target:
private void setupSnackBar() { snackbar = Snackbar.make(root, ApplicationConstants.EMPTY_STRING, Snackbar.LENGTH_INDEFINITE); View customSnackBarView = getLayoutInflater().inflate(R.layout.snackbar, null); Snackbar.SnackbarLayout snackBarLayout = (Snackbar.SnackbarLayout) snackbar.getView(); snackBarLayout.setPadding(0, 0, 0, 0); TextView noticeField = customSnackBarView.findViewById(R.id.snackbar_text); noticeField.setText(R.string.snackbar_empty_visit_list); TextView dismissButton = customSnackBarView.findViewById(R.id.snackbar_action_button); dismissButton.setText(R.string.snackbar_select); Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), ApplicationConstants.TypeFacePathConstants.ROBOTO_MEDIUM); dismissButton.setTypeface(typeface); dismissButton.setOnClickListener(v -> mPresenter.fillForm()); snackBarLayout.addView(customSnackBarView, 0); }
Source:
public void testListRegionsReturns404() { server.enqueue(response404()); List<Region> regions = api.regionAndZoneApi().describeRegions(); assertTrue(isEmpty(regions)); assertEquals(server.getRequestCount(), 1); }

Target:
public void testListRegionsReturns404() throws InterruptedException { server.enqueue(response404()); List<Region> regions = api.regionAndZoneApi().describeRegions(); assertTrue(isEmpty(regions)); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "DescribeRegions"); }
Source:
public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (input.isEmpty()) { return context.getSparkContext().emptyRDD(); } outputSchema = outputSchema != null ? outputSchema : config.getOutputSchema(input.first().getSchema()); final Map<String, String> mapping = SparkUtils.getFeatureListMapping(config.outputColumnMapping); return input.map(new Function<StructuredRecord, StructuredRecord>() { @Override public StructuredRecord call(StructuredRecord input) throws Exception { splitter = splitter == null ? Splitter.on(Pattern.compile(config.pattern)) : splitter; StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : input.getSchema().getFields()) { String fieldName = field.getName(); builder.set(fieldName, input.get(fieldName)); } for (Map.Entry<String, String> mapEntry : mapping.entrySet()) { String inputField = mapEntry.getKey(); String outputField = mapEntry.getValue(); List<String> text = SparkUtils.getInputFieldValue(input, inputField, splitter); Vector vector = text == null ? Vectors.sparse(0, new int[0], new double[0]) : hashingTF.transform(text); builder.set(outputField, VectorUtils.asRecord((SparseVector) vector)); } return builder.build(); } }); }

Target:
public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (input.isEmpty()) { return context.getSparkContext().emptyRDD(); } outputSchema = outputSchema != null ? outputSchema : config.getOutputSchema(input.first().getSchema()); final Map<String, String> mapping = config.getFeatureListMapping(config.outputColumnMapping); return input.map(new Function<StructuredRecord, StructuredRecord>() { @Override public StructuredRecord call(StructuredRecord input) throws Exception { splitter = splitter == null ? Splitter.on(pattern) : splitter; StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : input.getSchema().getFields()) { String fieldName = field.getName(); builder.set(fieldName, input.get(fieldName)); } for (Map.Entry<String, String> mapEntry : mapping.entrySet()) { String inputField = mapEntry.getKey(); String outputField = mapEntry.getValue(); List<String> text = SparkUtils.getInputFieldValue(input, inputField, splitter); Vector vector = text == null ? Vectors.sparse(0, new int[0], new double[0]) : hashingTF.transform(text); builder.set(outputField, VectorUtils.asRecord((SparseVector) vector)); } return builder.build(); } }); }
Source:
public ListResolver( Class clazz, Field fieldIfPresent, Class[] genericArgumentsIfPresent, Container parentContainerIfPresent ) { super(clazz, fieldIfPresent, genericArgumentsIfPresent, parentContainerIfPresent); if (fieldIfPresent != null) { genericArgumentsIfPresent = getGenericArgs(fieldIfPresent); } valuesResolver = new Resolver(genericArgumentsIfPresent[0], null, null, null); }

Target:
public ListResolver( Class clazz, Field fieldIfPresent, Class[] genericArgumentsIfPresent, Container parentContainerIfPresent ) { super(clazz, fieldIfPresent, genericArgumentsIfPresent, parentContainerIfPresent); if (fieldIfPresent != null) { genericArgumentsIfPresent = getGenericArgs(fieldIfPresent); } if(genericArgumentsIfPresent.length != 1) { throw new BadGenericsConfigurationException( "List type requires 1 generic argument, provided through a field declaration or through configuration." ); } valuesResolver = new Resolver(genericArgumentsIfPresent[0], null, null, null); }
Source:
private TransactionMethod<Boolean> updateVdsNetworksInTx() { return new TransactionMethod<Boolean>() { @Override public Boolean runInTransaction() { List<VdsNetworkInterface> ifaces = new ArrayList<VdsNetworkInterface>(getInterfaces()); ifaces.addAll(getRemovedBonds().values()); Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.CollectVdsNetworkData, new CollectHostNetworkDataVdsCommandParameters(getVds(), ifaces)); for (Network net : getNetworks()) { NetworkClusterHelper.setStatus(getVdsGroupId(), net); } return Boolean.TRUE; } }; }

Target:
private TransactionMethod<Boolean> updateVdsNetworksInTx() { return new TransactionMethod<Boolean>() { @Override public Boolean runInTransaction() { List<VdsNetworkInterface> ifaces = new ArrayList<>(getInterfaces()); ifaces.addAll(getRemovedBonds().values()); Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.CollectVdsNetworkData, new CollectHostNetworkDataVdsCommandParameters(getVds(), ifaces)); for (Network net : getNetworks()) { NetworkClusterHelper.setStatus(getVdsGroupId(), net); } return Boolean.TRUE; } }; }
Source:
public void testUserTermination() throws ApiException { ApiClient adminWebClient = getWebClient(ADMIN_USERNAME, testingPostgres); ApiClient userWebClient = getWebClient(USER_2_USERNAME,testingPostgres ); UsersApi userUserWebClient = new UsersApi(userWebClient); final User user = userUserWebClient.getUser(); assertFalse(user.getUsername().isEmpty()); UsersApi adminAdminWebClient = new UsersApi(adminWebClient); final Boolean aBoolean = adminAdminWebClient.terminateUser(user.getId()); assertTrue(aBoolean); boolean shouldFail = false; try { userUserWebClient.getUser(); } catch (ApiException e) { shouldFail = true; } assertTrue(shouldFail); }

Target:
public void testUserTermination() throws ApiException { ApiClient adminWebClient = getWebClient(ADMIN_USERNAME, testingPostgres); ApiClient userWebClient = getWebClient(USER_2_USERNAME,testingPostgres ); UsersApi userUserWebClient = new UsersApi(userWebClient); final User user = userUserWebClient.getUser(); assertFalse(user.getUsername().isEmpty()); UsersApi adminAdminWebClient = new UsersApi(adminWebClient); final Boolean aBoolean = adminAdminWebClient.terminateUser(user.getId()); assertTrue(aBoolean); try { userUserWebClient.getUser(); fail("should be unreachable, user must not have been banned properly"); } catch (ApiException e) { assertEquals(e.getCode(), HttpStatus.SC_UNAUTHORIZED); } }
Source:
private static URL[] fileToURL(List<File> files) throws IOException { List<URL> urlList = new ArrayList<>(); for (File f : files) { addFileURLs(urlList, f.toURI().toURL()); } return urlList.toArray(new URL[urlList.size()]); }

Target:
private static URL[] fileToURL(List<File> files) throws IOException { List<URL> urlList = new ArrayList<>(); for (File f : files) { urlList.add(f.toURI().toURL()); } return urlList.toArray(new URL[0]); }
Source:
public int hashCode() { int result = this.args.hashCode(); result = 31 * result + this.executor.hashCode(); result = 31 * result + (this.description != null ? this.description.hashCode() : 0); result = 31 * result + (this.extendedDescription != null ? this.extendedDescription.hashCode() : 0); result = 31 * result + (this.permission != null ? this.permission.hashCode() : 0); result = 31 * result + this.argumentParser.hashCode(); return result; }

Target:
public int hashCode() { return Objects.hashCode(this.args, this.executor, this.description, this.extendedDescription, this.permission, this.argumentParser); }
Source:
private void onFragmentLoaded(final boolean restoreScrollPosition) { if (recyclerAdapter == null) { MainActivity activity = (MainActivity) getActivity(); recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess, new DefaultActionButtonCallback(activity), itemTouchHelper); recyclerAdapter.setHasStableIds(true); recyclerView.setAdapter(recyclerAdapter); } if(queue == null || queue.size() == 0) { recyclerView.setVisibility(View.GONE); layoutEmpty.setVisibility(View.VISIBLE); } else { layoutEmpty.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } if (restoreScrollPosition) { restoreScrollPosition(); } getActivity().supportInvalidateOptionsMenu(); refreshInfoBar(); }

Target:
private void onFragmentLoaded(final boolean restoreScrollPosition) { if (recyclerAdapter == null) { MainActivity activity = (MainActivity) getActivity(); recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess, new DefaultActionButtonCallback(activity), itemTouchHelper); recyclerAdapter.setHasStableIds(true); recyclerView.setAdapter(recyclerAdapter); } if(queue == null || queue.size() == 0) { recyclerView.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); } else { emptyView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } if (restoreScrollPosition) { restoreScrollPosition(); } getActivity().supportInvalidateOptionsMenu(); refreshInfoBar(); }
Source:
public PermissionBlueprintDTO populate(ModelTranslator translator, PermissionBlueprint source, PermissionBlueprintDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } PermissionType type = source.getType(); Access access = source.getAccess(); dest.id(source.getId()) .type(type != null ? type.name() : null) .access(access != null ? access.name() : null); if (translator != null) { dest.setOwner(translator.translate(source.getOwner(), NestedOwnerDTO.class)); } else { dest.setOwner(null); } return dest; }

Target:
public PermissionBlueprintDTO populate(ModelTranslator translator, PermissionBlueprint source, PermissionBlueprintDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("destination is null"); } PermissionType type = source.getType(); Access access = source.getAccess(); dest.created(source.getCreated() != null ? source.getCreated().toInstant().atOffset(ZoneOffset.UTC) : null) .updated(source.getUpdated() != null ? source.getUpdated().toInstant().atOffset(ZoneOffset.UTC) : null) .id(source.getId()) .type(type != null ? type.name() : null) .access(access != null ? access.name() : null); if (translator != null) { dest.setOwner(translator.translate(source.getOwner(), NestedOwnerDTO.class)); } else { dest.setOwner(null); } return dest; }
Source:
static void validateDatasourceName(String dataSource) { Preconditions.checkArgument( !Strings.isNullOrEmpty(dataSource), "dataSource cannot be null or empty. Please provide a dataSource." ); Preconditions.checkArgument(!dataSource.contains("/"), "dataSource cannot contain the '/' character."); Preconditions.checkArgument( !dataSource.matches("(?s)(.*)\\s(.*)"), "dataSource cannot contain whitespace character." ); }

Target:
static void validateDatasourceName(String dataSource) { Preconditions.checkArgument( !Strings.isNullOrEmpty(dataSource), "dataSource cannot be null or empty. Please provide a dataSource." ); Matcher m = INVALIDCHARS.matcher(dataSource); Preconditions.checkArgument( !m.matches(), "dataSource cannot contain whitespace character except space." ); Preconditions.checkArgument(!dataSource.contains("/"), "dataSource cannot contain the '/' character."); }
Source:
public List<Long> getDurationList(String path, TimeUnit unit) { List<Long> l = new ArrayList<Long>(); List<? extends ConfigValue> list = getList(path); for (ConfigValue v : list) { if (v.valueType() == ConfigValueType.NUMBER) { Long n = unit.convert( ((Number) v.unwrapped()).longValue(), TimeUnit.MILLISECONDS); l.add(n); } else if (v.valueType() == ConfigValueType.STRING) { String s = (String) v.unwrapped(); Long n = unit.convert( parseDuration(s, v.origin(), path), TimeUnit.NANOSECONDS); l.add(n); } else { throw new ConfigException.WrongType(v.origin(), path, "duration string or number of " + unit.name(), v.valueType().name()); } } return l; }

Target:
public List<Long> getDurationList(String path, TimeUnit unit) { List<Long> l = new ArrayList<Long>(); List<? extends ConfigValue> list = getList(path); for (ConfigValue v : list) { if (v.valueType() == ConfigValueType.NUMBER) { Long n = unit.convert( ((Number) v.unwrapped()).longValue(), TimeUnit.MILLISECONDS); l.add(n); } else if (v.valueType() == ConfigValueType.STRING) { String s = (String) v.unwrapped(); Long n = unit.convert( parseDuration(s, v.origin(), path), TimeUnit.NANOSECONDS); l.add(n); } else { throw new ConfigException.WrongType(v.origin(), path, "duration string or number of milliseconds", v.valueType().name()); } } return l; }
Source:
public void processQueuedQueries() { synchronized (getRoot()) { internalRefreshStats(); while (internalStartNext()) { } } }

Target:
public void processQueuedQueries() { synchronized (super.root) { internalRefreshStats(); while (internalStartNext()) { } } }
Source:
public String idFromValue (Object o) { if (o instanceof CustomModification) { Object r5type = ((CustomModification)o).getFreeformProperties().get("r5type"); if (r5type instanceof String) { return (String)r5type; } } return modificationTypes.inverse().get(o.getClass()); }

Target:
public String idFromValue (Object o) { if (o instanceof CustomModificationHolder) { Object r5type = ((CustomModificationHolder) o).getFreeformProperties().get("r5type"); if (r5type instanceof String) { return (String)r5type; } else { LOG.error("The r5type property of a custom modification was not a String. " + "The R5 worker will not be able to deserialize and use the resulting R5 modification."); return null; } } return modificationTypes.inverse().get(o.getClass()); }
Source:
public String waitForUpdatedStringInLog(String regexp, long timeout, File outputFile, int previousOccurrences) { int waited = 0; final int waitIncrement = 500; log(MessageFormat.format(messages.getString("info.search.string"), regexp, outputFile.getAbsolutePath(), timeout / 1000)); try { while (waited <= timeout) { List<String> matches = findStringsInFileCommon(regexp, false, -1, outputFile, Project.MSG_VERBOSE); if (matches == null || matches.size() <= previousOccurrences) { try { Thread.sleep(waitIncrement); } catch (InterruptedException e) { } waited += waitIncrement; } else { String line = matches.get(matches.size() - 1); log(MessageFormat.format(messages.getString("info.match.string"), matches.size(), line), Project.MSG_INFO); return line; } } log(MessageFormat.format(messages.getString("error.serch.string.timeout"), regexp, outputFile.getAbsolutePath())); } catch (Exception e) { throw new BuildException(e); } return null; }

Target:
public String waitForUpdatedStringInLog(String regexp, long timeout, File outputFile, int previousOccurrences) { long waited = 0; final long waitIncrement = 500; log(MessageFormat.format(messages.getString("info.search.string"), regexp, outputFile.getAbsolutePath(), timeout / 1000)); while (waited <= timeout) { List<String> matches = findStringsInFileCommon(regexp, false, -1, outputFile, Project.MSG_VERBOSE); if (matches == null || matches.size() <= previousOccurrences) { try { Thread.sleep(waitIncrement); } catch (InterruptedException e) { } waited += waitIncrement; } else { String line = matches.get(matches.size() - 1); log(MessageFormat.format(messages.getString("info.match.string"), matches.size(), line), Project.MSG_INFO); return line; } } log(MessageFormat.format(messages.getString("error.serch.string.timeout"), regexp, outputFile.getAbsolutePath())); return null; }
Source:
public String getQuestionResultStatisticsHtml( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(100); Map<String, List<Integer>> optionRanks = generateOptionRanksMapping(responses); DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, List<Integer>> entry : optionRanks.entrySet()) { List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); String ranksReceived = getListOfRanksReceivedAsString(ranks); String option = entry.getKey(); fragments.append(Templates.populateTemplate(FormTemplates.RANK_RESULT_STATS_OPTIONFRAGMENT, Slots.RANK_OPTION_VALUE, Sanitizer.sanitizeForHtml(option), "${ranksReceived}", ranksReceived, "${averageRank}", df.format(average))); } return Templates.populateTemplate(FormTemplates.RANK_RESULT_OPTION_STATS, Slots.OPTION_RECIPIENT_DISPLAY_NAME, "Option", "${fragments}", fragments.toString()); }

Target:
public String getQuestionResultStatisticsHtml( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle, String view) { if ("student".equals(view) || responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(100); Map<String, List<Integer>> optionRanks = generateOptionRanksMapping(responses); DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, List<Integer>> entry : optionRanks.entrySet()) { List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); String ranksReceived = getListOfRanksReceivedAsString(ranks); String option = entry.getKey(); fragments.append(Templates.populateTemplate(FormTemplates.RANK_RESULT_STATS_OPTIONFRAGMENT, Slots.RANK_OPTION_VALUE, Sanitizer.sanitizeForHtml(option), Slots.RANK_RECIEVED, ranksReceived, Slots.RANK_AVERAGE, df.format(average))); } return Templates.populateTemplate(FormTemplates.RANK_RESULT_OPTION_STATS, Slots.OPTION_RECIPIENT_DISPLAY_NAME, "Option", Slots.FRAGMENTS, fragments.toString()); }
Source:
public void testComparator() throws Exception { final Comparator<String> comparator = AlphaNumericTopNMetricSpec.comparator; Assert.assertEquals(0, comparator.compare("", "")); Assert.assertEquals(0, comparator.compare("abc", "abc")); Assert.assertEquals(0, comparator.compare("123", "123")); Assert.assertEquals(0, comparator.compare("abc123", "abc123")); Assert.assertTrue(comparator.compare("", "abc") < 0); Assert.assertTrue(comparator.compare("abc", "") > 0); Assert.assertTrue(comparator.compare("123", "abc") < 0); Assert.assertTrue(comparator.compare("abc", "123") > 0); Assert.assertTrue(comparator.compare("2", "11") < 0); Assert.assertTrue(comparator.compare("a2", "a11") < 0); Assert.assertTrue(comparator.compare("02", "11") < 0); Assert.assertTrue(comparator.compare("02", "002") < 0); Assert.assertTrue(comparator.compare("1.3", "1.5") < 0); Assert.assertTrue(comparator.compare("1.3", "1.15") < 0); List<String> sorted = Lists.newArrayList("1-5", "11-15", "16-20", "21-25", "26-30", "6-10", "Other"); sorted.sort(comparator); Assert.assertEquals( ImmutableList.of("1-5", "6-10", "11-15", "16-20", "21-25", "26-30", "Other"), sorted ); List<String> sortedFixedDecimal = Lists.newArrayList( "Other", "[0.00-0.05)", "[0.05-0.10)", "[0.10-0.50)", "[0.50-1.00)", "[1.00-5.00)", "[5.00-10.00)", "[10.00-20.00)" ); sortedFixedDecimal.sort(comparator); Assert.assertEquals( ImmutableList.of( "[0.00-0.05)", "[0.05-0.10)", "[0.10-0.50)", "[0.50-1.00)", "[1.00-5.00)", "[5.00-10.00)", "[10.00-20.00)", "Other" ), sortedFixedDecimal ); }

Target:
public void testComparator() throws Exception { final Comparator<String> comparator = AlphaNumericTopNMetricSpec.comparator; Assert.assertEquals(0, comparator.compare("", "")); Assert.assertEquals(0, comparator.compare("abc", "abc")); Assert.assertEquals(0, comparator.compare("123", "123")); Assert.assertEquals(0, comparator.compare("abc123", "abc123")); Assert.assertTrue(comparator.compare("", "abc") < 0); Assert.assertTrue(comparator.compare("abc", "") > 0); Assert.assertTrue(comparator.compare("123", "abc") < 0); Assert.assertTrue(comparator.compare("abc", "123") > 0); Assert.assertTrue(comparator.compare("2", "11") < 0); Assert.assertTrue(comparator.compare("a2", "a11") < 0); Assert.assertTrue(comparator.compare("02", "11") < 0); Assert.assertTrue(comparator.compare("02", "002") < 0); Assert.assertTrue(comparator.compare("1.3", "1.5") < 0); Assert.assertTrue(comparator.compare("1.3", "1.15") < 0); List<String> sorted = Lists.newArrayList("1-5", "11-15", "16-20", "21-25", "26-30", "6-10", "Other"); Collections.sort(sorted, comparator); Assert.assertEquals( ImmutableList.of("1-5", "6-10", "11-15", "16-20", "21-25", "26-30", "Other"), sorted ); List<String> sortedFixedDecimal = Lists.newArrayList( "Other", "[0.00-0.05)", "[0.05-0.10)", "[0.10-0.50)", "[0.50-1.00)", "[1.00-5.00)", "[5.00-10.00)", "[10.00-20.00)" ); Collections.sort(sortedFixedDecimal, comparator); Assert.assertEquals( ImmutableList.of( "[0.00-0.05)", "[0.05-0.10)", "[0.10-0.50)", "[0.50-1.00)", "[1.00-5.00)", "[5.00-10.00)", "[10.00-20.00)", "Other" ), sortedFixedDecimal ); }
Source:
static void assertAccountInAccountService(Account account, AccountService accountService) { Objects.requireNonNull(account, "account cannot be null"); Objects.requireNonNull(accountService, "accountService cannot be null"); Account accountFoundById = accountService.getAccountById(account.getId()); Account accountFoundByName = accountService.getAccountByName(account.getName()); assertEquals("Account got by id from accountService does not match account got by name.", accountFoundById, accountFoundByName); assertEquals("Account got by id from accountService does not match the assert to assert", accountFoundById, account); assertEquals("The number of containers in the account is wrong.", accountFoundById.getAllContainers().size(), account.getAllContainers().size()); for (Container container : account.getAllContainers()) { assertContainerInAccountService(container, accountService); } }

Target:
static void assertAccountInAccountService(Account account, AccountService accountService) { Account accountFoundById = accountService.getAccountById(account.getId()); Account accountFoundByName = accountService.getAccountByName(account.getName()); assertEquals("Account got by id from accountService does not match account got by name.", accountFoundById, accountFoundByName); assertEquals("Account got by id from accountService does not match the assert to assert", accountFoundById, account); assertEquals("The number of containers in the account is wrong.", accountFoundById.getAllContainers().size(), account.getAllContainers().size()); for (Container container : account.getAllContainers()) { assertContainerInAccountService(container, accountService); } }
Source:
protected void releaseLock( @Nonnull final String sessionId ) { try { if ( _log.isDebugEnabled() ) { _log.debug( "Releasing lock for session " + sessionId ); } final long start = System.currentTimeMillis(); _memcached.delete( _sessionIdFormat.createLockName( sessionId ) ); _stats.registerSince( RELEASE_LOCK, start ); } catch ( final IOException e ) { _log.warn( "Caught exception when trying to release lock for session " + sessionId, e ); } }

Target:
protected void releaseLock( @Nonnull final String sessionId ) { try { if ( _log.isDebugEnabled() ) { _log.debug( "Releasing lock for session " + sessionId ); } final long start = System.currentTimeMillis(); _memcached.delete( _sessionIdFormat.createLockName( sessionId ) ).get(); _stats.registerSince( RELEASE_LOCK, start ); } catch ( final Exception e ) { _log.warn( "Caught exception when trying to release lock for session " + sessionId, e ); } }
Source:
public static Object codeLogger(int code) { return new CodeLogFormatter(code); }

Target:
public static Object codeLogger(int code) { return logMessagePool.get(code); }
Source:
protected String getTextTransform(String text, CSSValue value, String defaultText) { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; String textTransform = primitiveValue.getStringValue(); if ("capitalize".equals(textTransform)) { return StringUtils.capitalize(text); } if ("uppercase".equals(textTransform)) { if (text != null) { return text.toUpperCase(); } } if ("lowercase".equals(textTransform)) { if (text != null) { return text.toLowerCase(); } } if ("inherit".equals(textTransform)) { return text; } } if (defaultText != null) { return defaultText; } return text; }

Target:
protected String getTextTransform(String text, CSSValue value, String defaultText) { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { CSSPrimitiveValue primitiveValue = (CSSPrimitiveValue) value; String textTransform = primitiveValue.getStringValue(); if ("capitalize".equals(textTransform)) { return StringUtils.capitalize(text); } if ("uppercase".equals(textTransform) && text != null) { return text.toUpperCase(); } if ("lowercase".equals(textTransform) && text != null) { return text.toLowerCase(); } if ("inherit".equals(textTransform)) { return text; } } if (defaultText != null) { return defaultText; } return text; }
Source:
public void toStream(@NonNull JsonStream writer) throws IOException { writer.beginArray(); for (int k = 0; k < stacktrace.length && k < STACKTRACE_TRIM_LENGTH; k++) { StackTraceElement el = stacktrace[k]; try { writer.beginObject(); writer.name("method").value(el.getClassName() + "." + el.getMethodName()); writer.name("file").value(el.getFileName() == null ? "Unknown" : el.getFileName()); writer.name("lineNumber").value(el.getLineNumber()); if (config.inProject(el.getClassName())) { writer.name("inProject").value(true); } writer.endObject(); } catch (Exception lineEx) { Logger.warn("Failed to serialise stacktrace", lineEx); } } writer.endArray(); }

Target:
public void toStream(@NonNull JsonStream writer) throws IOException { writer.beginArray(); for (int k = 0; k < stacktrace.length && k < STACKTRACE_TRIM_LENGTH; k++) { StackTraceElement el = stacktrace[k]; try { writer.beginObject(); writer.name("method").value(el.getClassName() + "." + el.getMethodName()); writer.name("file").value(el.getFileName() == null ? "Unknown" : el.getFileName()); writer.name("lineNumber").value(el.getLineNumber()); if (config.inProject(el.getClassName())) { writer.name("inProject").value(true); } writer.endObject(); } catch (Exception lineEx) { Logger.warn("Failed to serialize stacktrace", lineEx); } } writer.endArray(); }
Source:
public Object[][] dataArgumentValidation() { return new Object[][]{ {new String[]{"--" + SITE_FREQUENCY_LONG_NAME, "0"}}, {new String[]{"--" + SITE_FREQUENCY_LONG_NAME, "10"}}, {new String[]{"--" + SITE_FREQUENCY_LONG_NAME, "-1"}} }; }

Target:
public Object[][] dataArgumentValidation() { return new Object[][]{ {new String[]{"--" + SITE_FREQUENCY_THRESHOLD_LONG_NAME, "0"}}, {new String[]{"--" + SITE_FREQUENCY_THRESHOLD_LONG_NAME, "10"}}, {new String[]{"--" + SITE_FREQUENCY_THRESHOLD_LONG_NAME, "-1"}} }; }
Source:
public static Map<String,String> getOverrides(List<String> args) { Map<String,String> config = new HashMap<>(); List<String> allproperties = ListUtils.union(args, deprecated_overrides); for (String prop : allproperties) { String[] propArgs = prop.split("=", 2); String key = propArgs[0].trim(); String value = ""; if (propArgs.length == 2) { value = propArgs[1].trim(); } else { value = String.valueOf(Property.isValidBooleanPropertyKey(key)); } if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid command line -o option: " + prop); } else { config.put(key, value); } } return config; }

Target:
public static Map<String,String> getOverrides(List<String> args) { Map<String,String> config = new HashMap<>(); for (String prop : args) { String[] propArgs = prop.split("=", 2); String key = propArgs[0].trim(); String value; if (propArgs.length == 2) { value = propArgs[1].trim(); } else { value = Property.isValidBooleanPropertyKey(key) ? "true" : ""; } if (key.isEmpty() || value.isEmpty()) { throw new IllegalArgumentException("Invalid command line -o option: " + prop); } config.put(key, value); } return config; }
Source:
protected void setValue(T value) { currentError = null; if (value != null) { this.value = value; for (Observer<T> observer : observers) observer.onValue(value); } }

Target:
protected void setValue(T value) { currentError = null; if (value != null) { this.value = value; for (Observer<T> observer : observers) { observer.onValue(value); } } }
Source:
public RecipeBrew read(@Nonnull Identifier id, @Nonnull JsonObject json) { String brewStr = JsonHelper.getString(json, "brew"); Identifier brewId = Identifier.tryParse(brewStr); if (brewId == null || BotaniaAPI.instance().getBrewRegistry().get(brewId) == ModBrews.fallbackBrew) { throw new JsonParseException("Unknown brew " + brewStr); } Brew brew = BotaniaAPI.instance().getBrewRegistry().get(brewId); JsonArray ingrs = JsonHelper.getArray(json, "ingredients"); List<Ingredient> inputs = new ArrayList<>(); for (JsonElement e : ingrs) { inputs.add(Ingredient.fromJson(e)); } return new RecipeBrew(id, brew, inputs.toArray(new Ingredient[0])); }

Target:
public RecipeBrew read(@Nonnull Identifier id, @Nonnull JsonObject json) { String brewStr = JsonHelper.getString(json, "brew"); Identifier brewId = Identifier.tryParse(brewStr); if (brewId == null || !BotaniaAPI.instance().getBrewRegistry().getOrEmpty(brewId).isPresent()) { throw new JsonParseException("Unknown brew " + brewStr); } Brew brew = BotaniaAPI.instance().getBrewRegistry().get(brewId); JsonArray ingrs = JsonHelper.getArray(json, "ingredients"); List<Ingredient> inputs = new ArrayList<>(); for (JsonElement e : ingrs) { inputs.add(Ingredient.fromJson(e)); } return new RecipeBrew(id, brew, inputs.toArray(new Ingredient[0])); }
Source:
public void draw(GameDrawer drawer, SolGame game) { SolCam cam = game.getCam(); float iconSz = getIconRadius(cam) * 2; float starNodeW = cam.getViewHeight(zoom) * STAR_NODE_SZ; float viewDist = cam.getViewDistance(zoom); FactionManager factionManager = game.getFactionMan(); Hero hero = game.getHero(); Planet np = game.getPlanetManager().getNearestPlanet(); Vector2 camPos = cam.getPosition(); float camAngle = cam.getAngle(); float heroDmgCap = hero.isTranscendent() ? Float.MAX_VALUE : HardnessCalc.getShipDmgCap(hero.getShip()); drawer.updateMatrix(game); game.getGridDrawer().draw(drawer, game, GRID_SZ, lineTexture); drawPlanets(drawer, game, viewDist, np, camPos, heroDmgCap, camAngle); drawMazes(drawer, game, viewDist, np, camPos, heroDmgCap, camAngle); drawStarNodes(drawer, game, viewDist, camPos, starNodeW); drawWaypoints(drawer, game, iconSz, viewDist); drawIcons(drawer, game, iconSz, viewDist, factionManager, hero, camPos, heroDmgCap); }

Target:
public void draw(GameDrawer drawer, SolGame game) { SolCam cam = game.getCam(); float iconSz = getIconRadius(cam) * 2; float starNodeW = cam.getViewHeight(zoom) * STAR_NODE_SZ; float viewDist = cam.getViewDistance(zoom); FactionManager factionManager = game.getFactionMan(); Hero hero = game.getHero(); Planet np = game.getPlanetManager().getNearestPlanet(); Vector2 camPos = cam.getPosition(); float camAngle = cam.getAngle(); float heroDmgCap = hero.isTranscendent() ? Float.MAX_VALUE : HardnessCalc.getShipDmgCap(hero.getShip()); drawer.updateMatrix(game); game.getGridDrawer().draw(drawer, game, GRID_SZ, lineTexture); drawPlanets(drawer, game, viewDist, np, camPos, heroDmgCap, camAngle); drawMazes(drawer, game, viewDist, np, camPos, heroDmgCap, camAngle); drawStarNodes(drawer, game, viewDist, camPos, starNodeW); drawWaypoints(drawer, game, iconSz, viewDist); drawIcons(drawer, game, iconSz, viewDist, factionManager, hero, camPos, heroDmgCap); if (game.getScreens().mapScreen.isPickingWaypointSpot()) { drawer.drawString("Click a spot for the new waypoint", hero.getPosition().x, hero.getPosition().y + (zoom* 1.5f), 0.125f * zoom, true, Color.RED); } if (game.getScreens().mapScreen.isPickingWaypointToRemove()) { drawer.drawString("Click a waypoint to remove", hero.getPosition().x, hero.getPosition().y + (zoom* 1.5f), 0.125f * zoom, true, Color.RED); } }
Source:
Tracing.Builder tracingBuilder(Sampler sampler) { return Tracing.newBuilder() .spanReporter(spans::add) .currentTraceContext(ThreadLocalCurrentTraceContext.create()) .sampler(sampler); }

Target:
Tracing.Builder tracingBuilder(Sampler sampler) { return Tracing.newBuilder() .spanReporter(spans::add) .currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder() .addScopeDecorator(StrictScopeDecorator.create()) .build()) .sampler(sampler); }
Source:
public void listPartitionSpliterator() { IterableView<List<String>> view = IterableView.of(ImmutableList.of("a", "b", "c")).partition(1); Spliterator<List<String>> spliterator = view.spliterator(); assertThat(spliterator.estimateSize()).isEqualTo(3); int characteristics = spliterator.characteristics(); assertThat(characteristics).isNotEqualTo(0); assertThat(characteristics & Spliterator.CONCURRENT).isEqualTo(0); assertThat(characteristics & Spliterator.DISTINCT).isEqualTo(0); assertThat(characteristics & Spliterator.IMMUTABLE).isEqualTo(0); assertThat(characteristics & Spliterator.NONNULL).isEqualTo(0); assertThat(characteristics & Spliterator.SIZED).isEqualTo(Spliterator.SIZED); assertThat(characteristics & Spliterator.SORTED).isEqualTo(0); assertThat(characteristics & Spliterator.SUBSIZED).isEqualTo(Spliterator.SUBSIZED); }

Target:
public void listPartitionSpliterator() { ImmutableList<String> delegate = ImmutableList.of("a", "b", "c"); IterableView<List<String>> view = IterableView.of(delegate).partition(1); Spliterator<List<String>> spliterator = view.spliterator(); assertThat(spliterator.estimateSize()).isEqualTo(3); assertThat(spliterator.characteristics()).isNotZero(); assertThat(spliterator.hasCharacteristics(Spliterator.SIZED)).isTrue(); assertThat(spliterator.hasCharacteristics(Spliterator.SUBSIZED)).isTrue(); assertThat(StreamSupport.stream(spliterator, false)).containsExactly( ImmutableList.of("a"), ImmutableList.of("b"), ImmutableList.of("c")); }
Source:
public void testRegisterPositionProvider() { final GuidedTourCustomSelectorPositionProvider positionProvider = mock(GuidedTourCustomSelectorPositionProvider.class); final PositionProviderFunction positionProviderFunction = mock(PositionProviderFunction.class); final String type = "type"; doReturn(positionProvider).when(bridge).getPositionProviderInstance(); bridge.registerPositionProvider(type, positionProviderFunction); verify(bridge).registerPositionProvider(type, positionProviderFunction); }

Target:
public void testRegisterPositionProvider() { final GuidedTourCustomSelectorPositionProvider positionProvider = mock(GuidedTourCustomSelectorPositionProvider.class); final PositionProviderFunction positionProviderFunction = mock(PositionProviderFunction.class); final String type = "type"; doReturn(positionProvider).when(bridge).getPositionProviderInstance(); bridge.registerPositionProvider(type, positionProviderFunction); verify(positionProvider).registerPositionProvider(type, positionProviderFunction); }
Source:
private static int zzUnpackAttribute() { int[] result = new int[184]; int offset = 0; zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; }

Target:
private static int zzUnpackAttribute() { int result = new int[184]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; }
Source:
public void start() { INSTANCE = this; }

Target:
public void start() { instance = this; }
Source:
private void checkCacheReload() { if (nextLoadTime > System.currentTimeMillis()) { return; } if (nextLoadTime > 0) { LOG.info("Lookup join cache has expired after minute(s), reloading", getCacheTTL().toMinutes()); } else { LOG.info("Populating lookup join cache"); } int numRetry = 0; while (true) { cache.clear(); try { T[] inputSplits = inputFormat.createInputSplits(1); GenericRowData reuse = new GenericRowData(producedNames.length); long count = 0; for (T split : inputSplits) { inputFormat.open(split); while (!inputFormat.reachedEnd()) { RowData row = inputFormat.nextRecord(reuse); count++; Row key = extractKey(row); List<RowData> rows = cache.computeIfAbsent(key, k -> new ArrayList<>()); rows.add(serializer.copy(row)); } inputFormat.close(); } nextLoadTime = System.currentTimeMillis() + getCacheTTL().toMillis(); LOG.info("Loaded row(s) into lookup join cache", count); return; } catch (IOException e) { if (numRetry >= MAX_RETRIES) { throw new FlinkRuntimeException( String.format("Failed to load table into cache after %d retries", numRetry), e); } long toSleep = ++numRetry * RETRY_INTERVAL.toMillis(); LOG.warn(String.format("Failed to load table into cache, will retry in %d seconds", toSleep / 1000), e); try { Thread.sleep(toSleep); } catch (InterruptedException ex) { LOG.warn("Interrupted while waiting to retry failed cache load, aborting"); throw new FlinkRuntimeException(ex); } } } }

Target:
private void checkCacheReload() { if (nextLoadTime > System.currentTimeMillis()) { return; } if (nextLoadTime > 0) { LOG.info("Lookup join cache has expired after minute(s), reloading", getCacheTTL().toMinutes()); } else { LOG.info("Populating lookup join cache"); } int numRetry = 0; while (true) { cache.clear(); try { T[] inputSplits = inputFormat.createInputSplits(1); GenericRowData reuse = new GenericRowData(producedNames.length); long count = 0; for (T split : inputSplits) { inputFormat.open(split); while (!inputFormat.reachedEnd()) { RowData row = inputFormat.nextRecord(reuse); count++; Row key = extractKey(row); List<RowData> rows = cache.computeIfAbsent(key, k -> new ArrayList<>()); rows.add(serializer.copy(row)); } inputFormat.close(); } nextLoadTime = System.currentTimeMillis() + getCacheTTL().toMillis(); LOG.info("Loaded row(s) into lookup join cache", count); return; } catch (IOException e) { if (numRetry >= MAX_RETRIES) { throw new FlinkRuntimeException( String.format("Failed to load table into cache after %d retries", numRetry), e); } numRetry++; long toSleep = numRetry * RETRY_INTERVAL.toMillis(); LOG.warn(String.format("Failed to load table into cache, will retry in %d seconds", toSleep / 1000), e); try { Thread.sleep(toSleep); } catch (InterruptedException ex) { LOG.warn("Interrupted while waiting to retry failed cache load, aborting"); throw new FlinkRuntimeException(ex); } } } }
Source:
protected PerPartitionCategorizationConfig createTestInstance() { boolean enabled = randomBoolean(); return new PerPartitionCategorizationConfig(enabled, enabled && randomBoolean()); }

Target:
protected PerPartitionCategorizationConfig createTestInstance() { boolean enabled = randomBoolean(); return new PerPartitionCategorizationConfig(enabled, randomBoolean() ? null : enabled && randomBoolean()); }
Source:
private VipAddressResolver getVipAddressResolver() { if (resolver == null) { synchronized (this) { if (resolver == null) { try { resolver = (VipAddressResolver) Class.forName( (String) getProperty(CommonClientConfigKey.VipAddressResolverClassName)).newInstance(); } catch (InstantiationException|IllegalAccessException|ClassNotFoundException e) { LOG.error("Cannot instantiate VipAddressResolver", e); } } } } return resolver; }

Target:
private VipAddressResolver getVipAddressResolver() { if (resolver == null) { synchronized (this) { if (resolver == null) { try { resolver = (VipAddressResolver) Class .forName((String) getProperty(CommonClientConfigKey.VipAddressResolverClassName)) .newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new RuntimeException("Cannot instantiate VipAddressResolver", e); } } } } return resolver; }
Source:
int processFilterHits(int inputIndex, int outputIndex, int[] resultRows, int[] resultInputNumbers, int numElementResults) { int filterHits = 0; int count = 0; int initialOutputIndex = outputIndex; if (presentStream != null && !present[inputQualifyingSet.getPositions()[inputIndex] - posInRowGroup]) { return outputIndex; } int[] inputNumbers = innerQualifyingSet.getInputNumbers(); int startOfArray = elementStart[inputIndex]; while (outputIndex < numElementResults && inputNumbers[resultInputNumbers[outputIndex]] == inputIndex) { count++; int posInArray = resultRows[outputIndex] - startOfArray; if (elementFilters[filterOffset + posInArray] != null) { filterHits++; } outputIndex++; } filterOffset += elementLength[inputIndex]; if (filterHits < numElementFilters[inputIndex]) { return outputIndex; } outputQualifyingSet.append(inputQualifyingSet.getPositions()[inputIndex], inputIndex); addArrayToResult(inputIndex, initialOutputIndex, outputIndex); int total = localNumFilters != null ? localNumFilters[inputIndex] : globalNumFilters; if (numElementFilters[inputIndex] < total) { ErrorSet errorSet = outputQualifyingSet.getOrCreateErrorSet(); errorSet.addError(outputQualifyingSet.getPositionCount() - 1, inputQualifyingSet.getPositionCount(), new MissingSubscriptException()); } return outputIndex; }

Target:
private int processFilterHits(int inputIndex, int outputIndex, int[] resultRows, int[] resultInputNumbers, int numElementResults) { int filterHits = 0; int initialOutputIndex = outputIndex; if (presentStream != null && !present[inputQualifyingSet.getPositions()[inputIndex] - posInRowGroup]) { return outputIndex; } int[] inputNumbers = innerQualifyingSet.getInputNumbers(); int startOfArray = elementStart[inputIndex]; while (outputIndex < numElementResults && inputNumbers[resultInputNumbers[outputIndex]] == inputIndex) { int posInArray = resultRows[outputIndex] - startOfArray; if (elementFilters[filterOffset + posInArray] != null) { filterHits++; } outputIndex++; } filterOffset += elementLength[inputIndex]; if (filterHits < numElementFilters[inputIndex]) { return outputIndex; } outputQualifyingSet.append(inputQualifyingSet.getPositions()[inputIndex], inputIndex); addArrayToResult(inputIndex, initialOutputIndex, outputIndex); int total = localNumFilters != null ? localNumFilters[inputIndex] : globalNumFilters; if (numElementFilters[inputIndex] < total) { ErrorSet errorSet = outputQualifyingSet.getOrCreateErrorSet(); errorSet.addError(outputQualifyingSet.getPositionCount() - 1, inputQualifyingSet.getPositionCount(), new MissingSubscriptException()); } return outputIndex; }
Source:
public Collection<String> populatePlatformTypes() throws IOException { Collection<PlatformType> platforms = requestManager.listActivePlatformTypes(); if (platforms.size() > 0) { return PlatformType.platformTypeNames(requestManager.listActivePlatformTypes()); } else { return requestManager.listDistinctPlatformNames(); } }

Target:
public Collection<String> populatePlatformTypes() throws IOException { Collection<PlatformType> platforms = requestManager.listActivePlatformTypes(); if (platforms.size() > 0) { return PlatformType.platformTypeNames(platforms); } else { return requestManager.listDistinctPlatformNames(); } }
Source:
public void testFailOnIncrementInt() throws IOException { Table table = getConnection().getTable(TABLE_NAME); byte[] rowKey = dataHelper.randomData("testrow-"); byte[] qual = dataHelper.randomData("qual-"); int value = new Random().nextInt(); Put put = new Put(rowKey).addColumn(COLUMN_FAMILY, qual, Bytes.toBytes(value)); table.put(put); Increment increment = new Increment(rowKey).addColumn(COLUMN_FAMILY, qual, 1L); expectedException.expect(DoNotRetryIOException.class); ; expectedException.expectMessage( anyOf( containsString("Attempted to increment field that isn't 64 bits wide"), containsString("Field is not a long") ) ); table.increment(increment); }

Target:
public void testFailOnIncrementInt() throws IOException { Table table = getConnection().getTable(TABLE_NAME); byte[] rowKey = dataHelper.randomData("testrow-"); byte[] qual = dataHelper.randomData("qual-"); int value = new Random().nextInt(); Put put = new Put(rowKey).addColumn(COLUMN_FAMILY, qual, Bytes.toBytes(value)); table.put(put); Increment increment = new Increment(rowKey).addColumn(COLUMN_FAMILY, qual, 1L); expectedException.expect(DoNotRetryIOException.class); expectedException.expectMessage( anyOf( containsString("Attempted to increment field that isn't 64 bits wide"), containsString("Field is not a long") ) ); table.increment(increment); }
Source:
public void testPackageInstallerInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.google.android.packageinstaller"); assertTrue(installSource instanceof PackageInstallerInstallSource); assertEquals("Package Installer", installSource.toString()); }

Target:
public void testPackageInstallerInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.google.android.packageinstaller"); assertTrue( "Package name is correctly identified as belonging to the Android Package Installer", installSource instanceof PackageInstallerInstallSource); assertEquals( "Package Installer install source has correct description", "Package Installer", installSource.toString()); }
Source:
@Override public void isEqualTo(Object expected) { if (getSubject() == null) { if(expected != null) { if (expected instanceof String) { failWithRawMessage("Not true that null reference is equal to <%s>", wrap((String) expected)); } else { failWithRawMessage("Not true that null reference is equal to (%s)<%s>", expected.getClass().getName(), expected); } } } else { if(expected == null) { isNull(); } else if (!(expected instanceof String)) { failWithRawMessage("Not true that <\"%s\"> is equal to (%s)<%s>", getSubject(), expected.getClass().getName(), expected); } else if (!getSubject().equals(expected)) { if (expected instanceof String) { failureStrategy.failComparing("", (String) expected, getSubject()); } else { failWithRawMessage("Not true that %s equal to (%s)<%s>", getDisplaySubject(), expected.getClass().getName(), expected); } } } }

Target:
@Override public void isEqualTo(Object expected) { if (getSubject() == null) { if (expected != null) { if (expected instanceof String) { failWithRawMessage("Not true that null reference is equal to <%s>", quote((String) expected)); } else { failWithRawMessage("Not true that null reference is equal to (%s)<%s>", expected.getClass().getName(), expected); } } } else { if (expected == null) { isNull(); } else if (!(expected instanceof String)) { failWithRawMessage("Not true that <\"%s\"> is equal to (%s)<%s>", getSubject(), expected.getClass().getName(), expected); } else if (!getSubject().equals(expected)) { if (expected instanceof String) { failureStrategy.failComparing("", (String) expected, getSubject()); } else { failWithRawMessage("Not true that %s equal to (%s)<%s>", getDisplaySubject(), expected.getClass().getName(), expected); } } } }