auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testCreateValidCase() { <START> final String body = "{\"context\":\"CLUSTER\", \"name\":\"test-name\", \"cluster\":\"test-cluster\", " <END> + "\"metric\":\"test-metric\", \"service\":\"test-service\", \"statistic\": \"test-statistic\", " + "\"period\": 1000, \"operator\":\"EQUAL_TO\", \"value\":{\"value\":12.0, \"unit\":\"MEGABYTE\"}, " + "\"nagiosExtension\":{\"severity\":\"CRITICAL\", \"notify\":\"abc@example.com\", " + "\"maxCheckAttempts\":3, \"freshnessThresholdInSeconds\":300}}"; Http.RequestBuilder request = new Http.RequestBuilder() .method("POST") .bodyJson(Json.parse(body)) .header("Content-Type", "application/json") .uri("/v1/alerts"); Result result = Helpers.route(request); Assert.assertEquals(Http.Status.OK, result.status()); }</code><technical_language>get rid of inline Json please</technical_language>

Target:
public void testCreateValidCase() throws IOException { Http.RequestBuilder request = new Http.RequestBuilder() .method("PUT") .bodyJson(readTree("testCreateValidCase")) .header("Content-Type", "application/json") .uri("/v1/alerts"); Result result = Helpers.route(request); Assert.assertEquals(Http.Status.OK, result.status()); }
Source:
<code>public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { if (originalViewItem instanceof HostNetworkInterfaceListViewItem) { HostNetworkInterfaceListViewItem original = (HostNetworkInterfaceListViewItem) originalViewItem; <START> setLogicalNetworkExpanded(original.getLogicalNetworkState()); <END> } }</code><technical_language>Nit-pick: in HostNetworkInterfaceBondedListViewItem.java, typecast inlined here</technical_language>

Target:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { if (originalViewItem instanceof HostNetworkInterfaceListViewItem) { setLogicalNetworkExpanded(((HostNetworkInterfaceListViewItem) originalViewItem).getLogicalNetworkState()); } }
Source:
<code>private String resolveVariantClassification(String variant, String variantType, Boolean isInframe) { String defaultValue = "Targeted_Region"; <START> if ((variant == null || variantType == null) && !variant.contains("splice")) { <END> return defaultValue; } else { variant = variant.toLowerCase(); } if ((variant.equals("frameshift_variant") || variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && !isInframe) { if (variantType.equals("DEL")) { return "Frame_Shift_Del"; } else if (variantType.equals("INS")) { return "Frame_Shift_Ins"; } } else if ((variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && isInframe) { if (variantType.equals("DEL")) { return "In_Frame_Del"; } else if (variantType.equals("INS")) { return "In_Frame_Ins"; } } return VARIANT_MAP.getOrDefault(variant, defaultValue); }</code><technical_language>This produce a null pointer exception variant is null. Do want return null if variant != null && variant.contains("splice")? do want return null if variant == null || variantType == null || variant.contains("splice")? is else? :)</technical_language>

Target:
private String resolveVariantClassification(String variant, String variantType, Boolean isInframe) { String defaultValue = "Targeted_Region"; if (variant == null || (variantType == null && !variant.contains("splice"))) { return defaultValue; } else { variant = variant.toLowerCase(); } if ((variant.equals("frameshift_variant") || variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && !isInframe) { if (variantType.equals("DEL")) { return "Frame_Shift_Del"; } else if (variantType.equals("INS")) { return "Frame_Shift_Ins"; } } else if ((variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && isInframe) { if (variantType.equals("DEL")) { return "In_Frame_Del"; } else if (variantType.equals("INS")) { return "In_Frame_Ins"; } } return VARIANT_MAP.getOrDefault(variant, defaultValue); }
Source:
<code>private void onEvent(final Set<Method> onEventMethods, final Object sink, final Object payload, final IEvent<?> event) { try { for (Method method : onEventMethods) { if (canCallListenerInterface(sink, method)) { OnEvent onEvent = method.getAnnotation(OnEvent.class); if (isPayloadApplicableToHandler(onEvent, payload)) { Object result = method.invoke(sink, payload); if (result instanceof Visit<?>) { Visit<?> visit = (Visit<?>) result; if (visit.isDontGoDeeper()) { event.dontBroadcastDeeper(); } else if (visit.isStopped()) { event.stop(); break; } } else if (onEvent.stop()) { event.stop(); break; } } } } } catch (InvocationTargetException e) { <START> if (e.getCause() != null && e.getCause() instanceof ReplaceHandlerException) <END> { throw ((ReplaceHandlerException)e.getCause()); } else { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } } catch (IllegalAccessException e) { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } }</code><technical_language>need check for null. instanceof this</technical_language>

Target:
private void onEvent(final Set<Method> onEventMethods, final Object sink, final Object payload, final IEvent<?> event) { try { for (Method method : onEventMethods) { if (canCallListenerInterface(sink, method)) { OnEvent onEvent = method.getAnnotation(OnEvent.class); if (isPayloadApplicableToHandler(onEvent, payload)) { Object result = method.invoke(sink, payload); if (result instanceof Visit<?>) { Visit<?> visit = (Visit<?>) result; if (visit.isDontGoDeeper()) { event.dontBroadcastDeeper(); } else if (visit.isStopped()) { event.stop(); break; } } else if (onEvent.stop()) { event.stop(); break; } } } } } catch (InvocationTargetException e) { if (e.getCause() instanceof ReplaceHandlerException) { throw ((ReplaceHandlerException)e.getCause()); } else { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } } catch (IllegalAccessException e) { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } }
Source:
<code>private CopyNumberTriStateSegment composeSegment(final List<Target> targets, final CopyNumberTriState call, final Target precedingTarget, final Target followingTarget, final ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState> fbResult, final List<Double> inputValues) { final int length = targets.size(); final Target firstTarget = targets.get(0); <START> final double mean = inputValues.stream().mapToDouble(d -> d).sum() / length; <END> final double stdev = inputValues.size() <= 1 ? 0 : Math.sqrt(inputValues.stream().mapToDouble(d -> (d - mean) * (d - mean)).sum() / (length - 1)); final double logExactProbability = logExactProbability(firstTarget, length, call, fbResult); final double logSomeProbability = logSomeProbability(firstTarget, length, call, fbResult); final double logStartProbability = logStartProbability(precedingTarget, firstTarget, call, fbResult); final double logEndProbability = logEndProbability(targets.get(length - 1), followingTarget, call, fbResult); final double logNeutralProbability = fbResult.logProbability(firstTarget, Collections.nCopies(targets.size(), CopyNumberTriState.NEUTRAL)); return new CopyNumberTriStateSegment(targets, mean, stdev, call, logToPhredScore(logExactProbability, true), logToPhredScore(logSomeProbability, true), logToPhredScore(logStartProbability, true), logToPhredScore(logEndProbability, true), logToPhredScore(logNeutralProbability, false)); }</code><technical_language>average().getAsDouble() annoying unboxing OptionalDouble IMO preferable conveys point of calculation more directly</technical_language>

Target:
private CopyNumberTriStateSegment composeSegment(final List<Target> targets, final CopyNumberTriState call, final Target precedingTarget, final Target followingTarget, final ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState> fbResult, final List<Double> inputValues) { final int length = targets.size(); final Target firstTarget = targets.get(0); final double mean = inputValues.stream().mapToDouble(d -> d).average().getAsDouble(); final double stdev = inputValues.size() <= 1 ? 0 : Math.sqrt(inputValues.stream().mapToDouble(d -> (d - mean) * (d - mean)).sum() / (length - 1)); final double logExactProbability = logExactProbability(firstTarget, length, call, fbResult); final double logSomeProbability = logSomeProbability(firstTarget, length, call, fbResult); final double logStartProbability = logStartProbability(precedingTarget, firstTarget, call, fbResult); final double logEndProbability = logEndProbability(targets.get(length - 1), followingTarget, call, fbResult); final double logNeutralProbability = fbResult.logProbability(firstTarget, Collections.nCopies(targets.size(), CopyNumberTriState.NEUTRAL)); return new CopyNumberTriStateSegment(targets, mean, stdev, call, logToPhredScore(logExactProbability, true), logToPhredScore(logSomeProbability, true), logToPhredScore(logStartProbability, true), logToPhredScore(logEndProbability, true), logToPhredScore(logNeutralProbability, false)); }
Source:
<code>public InvocationContext createSingleKeyNonTxInvocationContext() { <START> InvocationContext ctx = new SingleKeyNonTxInvocationContext(true, keyEq); <END> return ctx; }</code><technical_language>need variable. inline</technical_language>

Target:
public InvocationContext createSingleKeyNonTxInvocationContext() { return new SingleKeyNonTxInvocationContext(true, keyEq); }
Source:
<code>public void anonymizedUserProfilePageRemoved() { <START> <END> Credentials credentials = new Credentials(); String timestamp = Long.toString(DateTime.now().getMillis()); String qanon = "QAanon" + timestamp; String passw = "makak"; SignUpUser user = new SignUpUser(qanon, credentials.emailAnonymousUserTestWikia, passw, LocalDate.of(1990, 3, 19)); UserRegistration.registerUserEmailConfirmed(user); SpecialAnonymizationUserPage anonymizationStaff = new SpecialAnonymizationUserPage().open(); anonymizationStaff.loginAs(User.STAFF); anonymizationStaff.fillFutureAnon(qanon) .submitAnonymization(); Assertion.assertStringContains(anonymizationStaff.getAnonConfirmation(), qanon); UserProfilePage userProfilePage = new UserProfilePage().open(qanon); Assertion.assertTrue(userProfilePage.getUserNotExists().equals(String.format("User account \"%s\" does not exist or has never logged in on this wiki.", qanon))); }</code><technical_language>new lines</technical_language>

Target:
public void anonymizedUserProfilePageRemoved() { Credentials credentials = new Credentials(); String timestamp = Long.toString(DateTime.now().getMillis()); String qanon = "QAanon" + timestamp; String passw = "makak"; SignUpUser user = new SignUpUser(qanon, credentials.emailAnonymousUserTestWikia, passw, LocalDate.of(1990, 3, 19)); UserRegistration.registerUserEmailConfirmed(user); SpecialAnonymizationUserPage anonymizationStaff = new SpecialAnonymizationUserPage().open(); anonymizationStaff.loginAs(User.STAFF); anonymizationStaff.fillFutureAnon(qanon) .submitAnonymization(); Assertion.assertStringContains(anonymizationStaff.getAnonConfirmation(), qanon); UserProfilePage userProfilePage = new UserProfilePage().open(qanon); Assertion.assertTrue(userProfilePage.getNotExistsMessage().equals(String.format("User account \"%s\" does not exist or has never logged in on this wiki.", qanon))); }
Source:
<code>private void postProcessAbstractEndpoint(Object bean) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); <START> if (handler instanceof AbstractMessageHandler) { <END> MessageHandler monitor = (MessageHandler) extractTarget(handler); if (monitor instanceof IntegrationManagement) { registerHandler((IntegrationManagement) monitor); this.handlers.put(((IntegrationManagement) monitor).getComponentName(), (IntegrationManagement) monitor); this.runtimeBeans.add(monitor); } return; } } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof IntegrationInboundManagement) { IntegrationInboundManagement monitor = (IntegrationInboundManagement) extractTarget(messageSource); registerSource(monitor); this.sourceLifecycles.put(monitor, pollingChannelAdapter); this.runtimeBeans.add(monitor); return; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); }</code><technical_language>I need this if. logic covers needed. a MessageHandler a proxy give a positive match this if anyway</technical_language>

Target:
private void postProcessAbstractEndpoint(Object bean) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); MessageHandler monitor = (MessageHandler) extractTarget(handler); if (monitor instanceof IntegrationManagement) { registerHandler((IntegrationManagement) monitor); this.handlers.put(((IntegrationManagement) monitor).getComponentName(), (IntegrationManagement) monitor); this.runtimeBeans.add(monitor); } return; } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof IntegrationInboundManagement) { IntegrationInboundManagement monitor = (IntegrationInboundManagement) extractTarget(messageSource); registerSource(monitor); this.sourceLifecycles.put(monitor, pollingChannelAdapter); this.runtimeBeans.add(monitor); return; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); }
Source:
<code>private void assertsForRemoveObjectAsLeftSibling(JsonNodeReadOnlyTrx rtx) { assertFalse(rtx.hasNode(17)); assertFalse(rtx.hasNode(18)); assertFalse(rtx.hasNode(19)); rtx.moveTo(16); assertEquals(4, rtx.getChildCount()); assertEquals(6, rtx.getDescendantCount()); assertEquals(20, rtx.getFirstChildKey()); rtx.moveTo(20); <START> assertEquals(-1, rtx.getLeftSiblingKey()); <END> }</code><technical_language>Fixed.NULL_NODE_KEY.getStandardProperty() :-)</technical_language>

Target:
private void assertsForRemoveObjectAsLeftSibling(JsonNodeReadOnlyTrx rtx) { assertFalse(rtx.hasNode(17)); assertFalse(rtx.hasNode(18)); assertFalse(rtx.hasNode(19)); rtx.moveTo(16); assertEquals(4, rtx.getChildCount()); assertEquals(6, rtx.getDescendantCount()); assertEquals(20, rtx.getFirstChildKey()); rtx.moveTo(20); assertEquals(Fixed.NULL_NODE_KEY.getStandardProperty(), rtx.getLeftSiblingKey()); }
Source:
<code>public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); setVmQuotaPercentage(to, vm); if (dpdkHelper.isDpdkvHostUserModeSettingOnServiceOffering(vm)) { dpdkHelper.setDpdkVhostUserMode(to, vm); } if (to.getType() == VirtualMachine.Type.User && MapUtils.isNotEmpty(to.getExtraConfig()) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_NUMA) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_HUGE_PAGES)) { for (final NicTO nic : to.getNics()) { nic.setDpdkEnabled(true); } } GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { <START> to.setPlatformEmulator(guestOS.getDisplayName()); <END> } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }</code><technical_language>@ustcweizhou check fallback "Other" in case guestOS.getDisplayName() is null empty (unlikely code more defensive)</technical_language>

Target:
public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); setVmQuotaPercentage(to, vm); if (dpdkHelper.isDpdkvHostUserModeSettingOnServiceOffering(vm)) { dpdkHelper.setDpdkVhostUserMode(to, vm); } if (to.getType() == VirtualMachine.Type.User && MapUtils.isNotEmpty(to.getExtraConfig()) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_NUMA) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_HUGE_PAGES)) { for (final NicTO nic : to.getNics()) { nic.setDpdkEnabled(true); } } GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { to.setPlatformEmulator(guestOS.getDisplayName() == null ? "Other" : guestOS.getDisplayName()); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }
Source:
<code>public static Collection<String> listAllTargets(@NotNull String projectPath) throws PantsException { GeneralCommandLine cmd = PantsUtil.defaultCommandLine(projectPath); try (TempFile tempFile = TempFile.create("list", ".out")) { cmd.addParameters( "list", Paths.get(projectPath).getParent().toString() + ':', String.format("%s=%s", PantsConstants.PANTS_CLI_OPTION_LIST_OUTPUT_FILE, tempFile.getFile().getPath()) ); final ProcessOutput processOutput = PantsUtil.getCmdOutput(cmd, null); final String listOutput = FileUtil.loadFile(tempFile.getFile()); if (processOutput.checkSuccess(LOG)) { return Arrays.asList(listOutput.split("\n")); } else { final String errorDescription = String.format("could not list targets: pants exited with status %d\n", processOutput.getExitCode()) + String.format("argv: '%s'\n", cmd.getCommandLineString()) + String.format("stdout:\n%s\n", listOutput) + <START> String.format("warnings:\n%s\n", processOutput.getStdout()) + <END> String.format("stderr:\n%s\n", processOutput.getStderr()); LOG.warn(errorDescription); throw new PantsException(errorDescription); } } catch (IOException | ExecutionException e) { final String noProcessErrMsg = String.format("could not execute command: '%s' due to error: '%s'", cmd.getCommandLineString(), e.getMessage()); LOG.warn(noProcessErrMsg, e); throw new PantsException(noProcessErrMsg); } }</code><technical_language>if command fails, in listOutput. stdout processOutput.getStdout() stderr processOutput.getStderr()</technical_language>

Target:
public static Collection<String> listAllTargets(@NotNull String projectPath) throws PantsException { if (!PantsUtil.isBUILDFilePath(projectPath)) { return Lists.newArrayList(); } GeneralCommandLine cmd = PantsUtil.defaultCommandLine(projectPath); try (TempFile tempFile = TempFile.create("list", ".out")) { cmd.addParameters( "list", Paths.get(projectPath).getParent().toString() + ':', String.format("%s=%s", PantsConstants.PANTS_CLI_OPTION_LIST_OUTPUT_FILE, tempFile.getFile().getPath() ) ); final ProcessOutput processOutput = PantsUtil.getCmdOutput(cmd, null); if (processOutput.checkSuccess(LOG)) { final String output = FileUtil.loadFile(tempFile.getFile()); return Arrays.asList(output.split("\n")); } else { List<String> errorLogs = Lists.newArrayList( String.format("Could not list targets: Pants exited with status %d", processOutput.getExitCode()), String.format("argv: '%s'", cmd.getCommandLineString()), "stdout:", processOutput.getStdout(), "stderr:", processOutput.getStderr()); final String errorMessage = String.join("\n", errorLogs); LOG.warn(errorMessage); throw new PantsException(errorMessage); } } catch (IOException | ExecutionException e) { final String processCreationFailureMessage = String.format("Could not execute command: '%s' due to error: '%s'", cmd.getCommandLineString(), e.getMessage()); LOG.warn(processCreationFailureMessage, e); throw new PantsException(processCreationFailureMessage); } }
Source:
<code>public void clientId() throws IOException { <START> Stripe.clientId = "ca_test"; <END> chargeBody = resource("charge.json"); }</code><technical_language>tests rely Stripe.clientId all, remove this line, rename method, get rid of tearDownMockAndClientId() entirely</technical_language>

Target:
public void clientId() throws IOException { chargeBody = resource("charge.json"); }
Source:
<code>ConfigurationDialog(ConfigurationDialogForm form, ConfigurationPanel confPanel) { this.form = form; this.confPanel = confPanel; if (!confPanel.isEmpty()) form.enableClearAll(); confPanel.onChange(() -> { if (!confPanel.getConfiguration().isEmpty()) form.enableClearAll(); else form.disableClearAll(); <START> if (true) <END> form.enableOK(); else form.disableOK(); }); }</code><technical_language>This wrong... :P</technical_language>

Target:
ConfigurationDialog(ConfigurationDialogForm form, ConfigurationPanel confPanel) { this.form = form; this.confPanel = confPanel; if (!confPanel.isEmpty()) form.enableClearAll(); confPanel.onChange(() -> { if (!confPanel.getConfiguration().isEmpty()) form.enableClearAll(); else form.disableClearAll(); if (confPanel.getConfiguration().isValidAsCustomConf()) form.enableOK(); else form.disableOK(); }); }
Source:
<code>public void testEmulator() { <START> Map<String, String> oldEnv = System.getenv();` <END> Map<String, String> testEnv = new HashMap<>(); testEnv.put(BigtableOptions.BIGTABLE_EMULATOR_HOST_ENV_VAR, "localhost:1234"); setTestEnv(testEnv); BigtableOptions options = new BigtableOptions.Builder() .setPort(443) .setDataHost("xxx") .build(); Assert.assertEquals(1234, options.getPort()); Assert.assertEquals("localhost", options.getDataHost()); Assert.assertEquals("localhost", options.getAdminHost()); Assert.assertTrue(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.nullCredential(), options.getCredentialOptions()); setTestEnv(oldEnv); options = new BigtableOptions.Builder() .setDataHost("override") .build(); Assert.assertEquals(BigtableOptions.BIGTABLE_PORT_DEFAULT, options.getPort()); Assert.assertEquals("override", options.getDataHost()); Assert.assertEquals(BigtableOptions.BIGTABLE_ADMIN_HOST_DEFAULT, options.getAdminHost()); Assert.assertFalse(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.defaultCredentials(), options.getCredentialOptions()); }</code><technical_language>is extra tick causing build failure</technical_language>

Target:
public void testEmulator() { Map<String, String> oldEnv = System.getenv(); Map<String, String> testEnv = new HashMap<>(); testEnv.put(BigtableOptions.BIGTABLE_EMULATOR_HOST_ENV_VAR, "localhost:1234"); setTestEnv(testEnv); BigtableOptions options = new BigtableOptions.Builder() .setPort(443) .setDataHost("xxx") .build(); Assert.assertEquals(1234, options.getPort()); Assert.assertEquals("localhost", options.getDataHost()); Assert.assertEquals("localhost", options.getAdminHost()); Assert.assertTrue(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.nullCredential(), options.getCredentialOptions()); setTestEnv(oldEnv); options = new BigtableOptions.Builder() .setDataHost("override") .build(); Assert.assertEquals(BigtableOptions.BIGTABLE_PORT_DEFAULT, options.getPort()); Assert.assertEquals("override", options.getDataHost()); Assert.assertEquals(BigtableOptions.BIGTABLE_ADMIN_HOST_DEFAULT, options.getAdminHost()); Assert.assertFalse(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.defaultCredentials(), options.getCredentialOptions()); }
Source:
<code>public int getPid() { ITmfEventField pidContext = this.getContent().getField("context._pid"); if (null != pidContext) { return ((Integer) pidContext.getValue()).intValue(); } <START> CtfKernelTrace trace = (CtfKernelTrace) this.getTrace(); <END> ITmfStateSystem ss = trace.getStateSystem(CtfKernelTrace.STATE_ID); int retVal = -1; try { int threadNode = ss.getQuarkAbsolute(Attributes.CPUS, String.valueOf(getCPU()), Attributes.CURRENT_THREAD); ITmfStateValue sv = ss.querySingleState(this.getTimestamp().getValue(), threadNode).getStateValue(); retVal = Math.max(0, sv.unboxInt()); } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (TimeRangeException e) { e.printStackTrace(); } catch (StateSystemDisposedException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return retVal; }</code><technical_language>return type for .getTrace() overriden in CtfKernelEvent too</technical_language>

Target:
public int getPid() { ITmfEventField pidContext = this.getContent().getField("context._pid"); if (null != pidContext) { return ((Integer) pidContext.getValue()).intValue(); } ITmfStateSystem ss = getTrace().getStateSystem(CtfKernelTrace.STATE_ID); int retVal = -1; try { int threadNode = ss.getQuarkAbsolute(Attributes.CPUS, String.valueOf(getCPU()), Attributes.CURRENT_THREAD); ITmfStateValue sv = ss.querySingleState(this.getTimestamp().getValue(), threadNode).getStateValue(); retVal = Math.max(0, sv.unboxInt()); } catch (AttributeNotFoundException e) { } catch (TimeRangeException e) { e.printStackTrace(); } catch (StateSystemDisposedException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return retVal; }
Source:
<code>private RemoteEMTask(final MemoryStore memorystore, final OperationRouter router, final AggregationSlave aggregationSlave, final EvalSideMsgHandler msgHandler, final SerializableCodec<String> codec, @Parameter(TaskConfigurationOptions.Identifier.class) final String taskId) { this.memoryStore = memorystore; this.router = router; this.aggregationSlave = aggregationSlave; this.msgHandler = msgHandler; this.codec = codec; this.taskId = taskId; <START> LOG.log(Level.INFO, "taskId: {0}", taskId); <END> }</code><technical_language>log task id in constructor</technical_language>

Target:
private RemoteEMTask(final MemoryStore memorystore, final OperationRouter router, final AggregationSlave aggregationSlave, final EvalSideMsgHandler msgHandler, final SerializableCodec<String> codec, @Parameter(TaskConfigurationOptions.Identifier.class) final String taskId) { this.memoryStore = memorystore; this.router = router; this.aggregationSlave = aggregationSlave; this.msgHandler = msgHandler; this.codec = codec; this.taskId = taskId; }
Source:
<code>public SecretStoreAuthzModule(Context context) { this.context = context.getApplicationContext(); <START> sessionStore = openSessionStore(); <END> }</code><technical_language>Personally I prefer set fields this. in constructors, call shots</technical_language>

Target:
public SecretStoreAuthzModule(Context context) { this.context = context.getApplicationContext(); this.sessionStore = openSessionStore(); sessionStore.openSync(); }
Source:
<code>void reset(boolean isShutdown) { logger.info("Resetting CallbackHandler: {}. Is resetting for shutdown: {}.", _uid, isShutdown); try { _ready = false; <START> CallbackProcessor callbackProcessorRef = _batchCallbackProcessor.get(); <END> if (callbackProcessorRef != null) { if (isShutdown) { if (_batchCallbackProcessor.compareAndSet(callbackProcessorRef, null)) { callbackProcessorRef.shutdown(); } } else { callbackProcessorRef.resetEventQueue(); } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }</code><technical_language>do getAndSet(null). shutdown returned value</technical_language>

Target:
void reset(boolean isShutdown) { logger.info("Resetting CallbackHandler: {}. Is resetting for shutdown: {}.", _uid, isShutdown); try { _ready = false; CallbackProcessor callbackProcessor = _batchCallbackProcessorRef.get(); if (callbackProcessor != null) { if (isShutdown) { if (_batchCallbackProcessorRef.compareAndSet(callbackProcessor, null)) { callbackProcessor.shutdown(); } } else { callbackProcessor.resetEventQueue(); } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }
Source:
<code>public void testProcessInstanceStatus_timedOut() throws Exception { <START> b.setInputFeedDataPath("/samarthData/timedoutStatus/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); <END> b.setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:11Z"); b.setProcessPeriodicity(5, TimeUnit.minutes); b.setProcessTimeOut(2, TimeUnit.minutes); b.setOutputFeedPeriodicity(5, TimeUnit.minutes); b.setOutputFeedLocationData("/examples/samarth/output-data/aggregator/aggregatedLogs/${YEAR}/${MONTH}/$" + "{DAY}/${HOUR}/${MINUTE}"); b.setProcessConcurrency(3); b.submitAndScheduleBundle(prism); Status status = null; while (status != Status.TIMEDOUT) { status = InstanceUtil .getInstanceStatus(server1, Util.readEntityName(b.getProcessData()), 0, 0); Thread.sleep(15000); } ProcessInstancesResult r = prism.getProcessHelper() .getProcessInstanceStatus(Util.readEntityName(b.getProcessData()), "?start=2010-01-02T01:00Z&end=2010-01-02T01:11Z"); InstanceUtil.validateSuccessWithStatusCode(r, 2); }</code><technical_language>baseTestDir here</technical_language>

Target:
public void testProcessInstanceStatus_timedOut() throws Exception { b.setInputFeedDataPath(feedInputTimedOutPath); b.setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:11Z"); b.setProcessPeriodicity(5, TimeUnit.minutes); b.setProcessTimeOut(2, TimeUnit.minutes); b.setOutputFeedPeriodicity(5, TimeUnit.minutes); b.setOutputFeedLocationData(feedOutputTimedOutPath); b.setProcessConcurrency(3); b.submitAndScheduleBundle(prism); Status status = null; while (status != Status.TIMEDOUT) { status = InstanceUtil .getInstanceStatus(server1, Util.readEntityName(b.getProcessData()), 0, 0); Thread.sleep(15000); } ProcessInstancesResult r = prism.getProcessHelper() .getProcessInstanceStatus(Util.readEntityName(b.getProcessData()), "?start=2010-01-02T01:00Z&end=2010-01-02T01:11Z"); InstanceUtil.validateSuccessWithStatusCode(r, 2); }
Source:
<code>public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } else { <START> s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); <END> } if (rules != null) { s_logger.debug("Handling applyNetworkACLs for network " + config.getName() + " with " + rules.size() + " Network ACLs"); applyACLRules(config, rules, true, null, rules.isEmpty()); } return true; }</code><technical_language>Wrap in a if (s_logger.isDebugEnabled()) { ... } block avoid unnecessary pressure string pool debug logging is enabled</technical_language>

Target:
public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { if (s_logger.isDebugEnabled()) { s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } } else { if (s_logger.isDebugEnabled()) { s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } } if (rules != null) { s_logger.info("Applying " + rules.size() + " Network ACLs for network " + config.getName()); applyACLRules(config, rules, true, null, rules.isEmpty()); } return true; }
Source:
<code>public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CREFormatException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() > 1) { throw new CRECastException("Got " + text + " instead of expected character.", t); } char check = text.charAt(0); <START> if(Character.isUpperCase(check)) { <END> return CBoolean.get(true); } else { return CBoolean.get(false); } }</code><technical_language>return CBoolean.get(Character.isUpperCase(check)); need this 6 lines</technical_language>

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CRECastException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() != 1) { throw new CREFormatException("Got \"" + text + "\" instead of expected character.", t); } char check = text.charAt(0); if(!Character.isLetter(check)) { throw new CRECastException("Got \"" + text + "\" instead of alphabetical character.", t); } return CBoolean.get(Character.isUpperCase(check)); }
Source:
<code><START> private FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, <END> @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); }</code><technical_language>I prefer leave this package-private avoid a synthetic accessor</technical_language>

Target:
FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); }
Source:
<code>private boolean isMatchingAttributeFilter(Element element) { if(attributeValueFilterPattern == null){ <START> attributeValueFilterPattern = Pattern.compile(attributeValueFilter, attributeValueFilterFlags); <END> } String attributeValue = element.getAttributeValue(attributeNameFilter); if(attributeValue == null){ return false; } Matcher matcher = attributeValueFilterPattern.matcher(attributeValue); return matcher.matches(); }</code><technical_language>cases (wrong flags wrong regex)</technical_language>

Target:
private boolean isMatchingAttributeFilter(Element element) throws ZestAssignFailException { if(attributeValueFilterPattern == null){ try { attributeValueFilterPattern = Pattern.compile(attributeValueFilter, attributeValueFilterFlags); }catch (IllegalArgumentException ex){ throw new ZestAssignFailException(this, ex.getMessage() + "\r\nRegEx:'" + attributeValueFilter + "' with Flags:'" + attributeValueFilterFlags + "' can not be compiled to pattern."); } } String attributeValue = element.getAttributeValue(attributeNameFilter); if(attributeValue == null){ return false; } Matcher matcher = attributeValueFilterPattern.matcher(attributeValue); return matcher.matches(); }
Source:
<code>protected void configure() { bind(SnapshotDao.class).to(DummySnapshotDao.class); bind(MachineService.class); Multibinder<String> exposedPortsMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_exposed_ports")); Multibinder<String> volumesMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_volumes")); install(new FactoryModuleBuilder() .implement(Instance.class, DockerInstance.class) .implement(InstanceProcess.class, DockerProcess.class) .implement(DockerNode.class, LocalDockerNode.class) .build(DockerMachineFactory.class)); Multibinder.newSetBinder(binder(), InstanceProvider.class).addBinding().to(DockerInstanceProvider.class); if (SystemInfo.isWindows()) { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderWinOS.class); } else { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderUnix.class); } bind(org.eclipse.che.plugin.docker.machine.node.WorkspaceFolderPathProvider.class) <START> .to(LocalWorkspaceFolderPathProvider.class); <END> }</code><technical_language>full FQN</technical_language>

Target:
protected void configure() { bind(SnapshotDao.class).to(DummySnapshotDao.class); bind(MachineService.class); Multibinder<String> exposedPortsMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_exposed_ports")); Multibinder<String> volumesMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_volumes")); install(new FactoryModuleBuilder() .implement(Instance.class, DockerInstance.class) .implement(InstanceProcess.class, DockerProcess.class) .implement(DockerNode.class, LocalDockerNode.class) .build(DockerMachineFactory.class)); Multibinder.newSetBinder(binder(), InstanceProvider.class).addBinding().to(DockerInstanceProvider.class); if (SystemInfo.isWindows()) { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderWinOS.class); } else { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderUnix.class); } bind(org.eclipse.che.plugin.docker.machine.node.WorkspaceFolderPathProvider.class) .to(org.eclipse.che.plugin.docker.machine.local.node.LocalWorkspaceFolderPathProvider.class); }
Source:
<code>public void successfulExecuteStormTuple() throws MCSException, URISyntaxException { StormTaskTuple tuple = new StormTaskTuple(TASK_ID, TASK_NAME, SOURCE_VERSION_URL, FILE_DATA, prepareStormTaskTupleParameters(SOURCE_DATASET_URL)); Representation representation = prepareRepresentation(SOURCE + CLOUD_ID, SOURCE + REPRESENTATION_NAME, SOURCE + VERSION, SOURCE_VERSION_URL, DATA_PROVIDER, false, date); when(datasetClient.getRepresentationIterator(anyString(), anyString())).thenReturn(representationIterator); when(representationIterator.hasNext()).thenReturn(true, false); when(representationIterator.next()).thenReturn(representation); when(oc.emit(any(Tuple.class), anyList())).thenReturn(null); instance.emitSingleRepresentationFromDataSet(tuple, datasetClient, recordServiceClient); Representation expectedRepresentation = representation; verify(oc, times(1)).emit(any(Tuple.class), captor.capture()); assertThat(captor.getAllValues().size(), is(1)); List<Values> allValues = captor.getAllValues(); <START> assertRepresentation(expectedRepresentation, ((Map<String, String>) allValues.get(0).get(4)).get(PluginParameterKeys.REPRESENTATION)); <END> verifyNoMoreInteractions(oc); }</code><technical_language>allValues.get(0) is size is checked get(4) is called this object - do this object a reason of a test crash</technical_language>

Target:
public void successfulExecuteStormTuple() throws MCSException, URISyntaxException { StormTaskTuple tuple = new StormTaskTuple(TASK_ID, TASK_NAME, SOURCE_VERSION_URL, FILE_DATA, prepareStormTaskTupleParameters(SOURCE_DATASET_URL)); Representation representation = testHelper.prepareRepresentation(SOURCE + CLOUD_ID, SOURCE + REPRESENTATION_NAME, SOURCE + VERSION, SOURCE_VERSION_URL, DATA_PROVIDER, false, date); List<Representation> representations = new ArrayList<>(); representations.add(representation); when(datasetClient.getRepresentationIterator(anyString(), anyString())).thenReturn(representationIterator); when(representationIterator.hasNext()).thenReturn(true, false); when(representationIterator.next()).thenReturn(representation); assertBoltExecutionResults(tuple, representations); }
Source:
<code>private void handleActivationKeyServiceLevel(Consumer consumer, String level, Owner owner) { <START> if (level != null) { <END> serviceLevelValidator.validate(owner, level); consumer.setServiceLevel(level); } }</code><technical_language>If level is set "" in activation key, unset consumers (from a prior activation key)</technical_language>

Target:
private void handleActivationKeyServiceLevel(Consumer consumer, String level, Owner owner) { if (!StringUtils.isBlank(level)) { serviceLevelValidator.validate(owner, level); consumer.setServiceLevel(level); } }
Source:
<code>RexNode simplifyAnd(RexCall e, RexUnknownAs unknownAs) { List<RexNode> operands = RelOptUtil.conjunctions(e); if (unknownAs == FALSE && predicateElimination) { simplifyAndTerms(operands, FALSE); } else { simplifyList(operands, unknownAs); } final List<RexNode> terms = new ArrayList<>(); final List<RexNode> notTerms = new ArrayList<>(); final SargCollector sargCollector = new SargCollector(rexBuilder, true); operands.forEach(t -> sargCollector.accept(t, terms)); <START> if (sargCollector.needToFix(terms.size())) { <END> operands.clear(); terms.forEach(t -> operands.add(sargCollector.fix(rexBuilder, t))); } terms.clear(); for (RexNode o : operands) { RelOptUtil.decomposeConjunction(o, terms, notTerms); } switch (unknownAs) { case FALSE: return simplifyAnd2ForUnknownAsFalse(terms, notTerms, Comparable.class); default: break; } return simplifyAnd2(terms, notTerms); }</code><technical_language>if convert sarg format? drawbacks</technical_language>

Target:
RexNode simplifyAnd(RexCall e, RexUnknownAs unknownAs) { List<RexNode> operands = RelOptUtil.conjunctions(e); if (unknownAs == FALSE && predicateElimination) { simplifyAndTerms(operands, FALSE); } else { simplifyList(operands, unknownAs); } final List<RexNode> terms = new ArrayList<>(); final List<RexNode> notTerms = new ArrayList<>(); final SargCollector sargCollector = new SargCollector(rexBuilder, true); operands.forEach(t -> sargCollector.accept(t, terms)); if (sargCollector.needToFix(unknownAs)) { operands.clear(); terms.forEach(t -> operands.add(sargCollector.fix(rexBuilder, t))); } terms.clear(); for (RexNode o : operands) { RelOptUtil.decomposeConjunction(o, terms, notTerms); } switch (unknownAs) { case FALSE: return simplifyAnd2ForUnknownAsFalse(terms, notTerms, Comparable.class); default: break; } return simplifyAnd2(terms, notTerms); }
Source:
<code>private void setUpGCExpectations(final int gcAfter) { ReferenceQueue<Integer> queue = mock(ReferenceQueue.class); map = new ReapedMap<String, Integer>(10000, false, queue); final IdAwareReference ref = mock(IdAwareReference.class); <START> when(ref.getKey()).thenReturn("three", new Object[] { null }); <END> when(queue.poll()).thenAnswer(new Answer<Reference<Integer>>() { private int times = 0; @Override public Reference<Integer> answer(InvocationOnMock invocation) throws Throwable { if (times == gcAfter) { ++times; return ref; } ++times; return null; } }); }</code><technical_language>pass null in parameter? Alternatively, ongoing stubbing write as: when(ref.getKey()).thenReturn("three").thenReturn(null);</technical_language>

Target:
private void setUpGCExpectations(final int gcAfter) { ReferenceQueue<Integer> queue = mock(ReferenceQueue.class); map = new ReapedMap<String, Integer>(10000, false, queue); final IdAwareReference ref = mock(IdAwareReference.class); when(ref.getKey()).thenReturn("three").thenReturn(null); when(queue.poll()).thenAnswer(new Answer<Reference<Integer>>() { private int times = 0; @Override public Reference<Integer> answer(InvocationOnMock invocation) throws Throwable { if (times == gcAfter) { ++times; return ref; } ++times; return null; } }); }
Source:
<code>public String toString() { StringBuilder tableBuilder = new StringBuilder(); tableBuilder.append( "<script>$('head').append('<link rel=\"stylesheet\" type=\"text/css\" href=\"<LINK_1>\">');</script>"); tableBuilder.append( <START> "<script src='<LINK_0>'></script>"); <END> for (Entry<String, ModelUsageData> injectorEntry : report.getStatistics().entrySet()) { String header = injectorEntry.getKey(); String id = header.replaceAll(" > ", "-").replaceAll(" ", "_"); renderFlatTable(tableBuilder, id, header, injectorEntry.getValue()); renderTreeTable(tableBuilder, id, header , injectorEntry.getValue()); tableBuilder.append("<hr style='margin-bottom: 20px'>"); } tableBuilder.append("<hr><hr>"); tableBuilder.append( "<form action='' method='get'><input type='hidden' name='reset'><button type='submit'>RESET</button></form>"); tableBuilder.append( "<script>$(document).ready(function() {$(\"tr\").find(\"td:first\").find(\"span[style='padding-left: 0px;']\").remove();});</script>"); return tableBuilder.toString(); }</code><technical_language>avoid hardcoding links external JS</technical_language>

Target:
public String toString() { StringBuilder tableBuilder = new StringBuilder(); tableBuilder.append("<style type='text/css'>" + getResourceAsString("jquery.treetable.css") + "</style>"); for (Entry<String, ModelUsageData> injectorEntry : injectorsStatistics.entrySet()) { String header = injectorEntry.getKey(); String id = header.replaceAll(" > ", "-").replaceAll(" ", "_"); renderFlatTable(tableBuilder, id, header, injectorEntry.getValue()); renderTreeTable(tableBuilder, id, header, injectorEntry.getValue()); tableBuilder.append("<hr style='margin-bottom: 20px'>"); } tableBuilder.append("<hr><hr>"); tableBuilder.append( "<form action='' method='get'><input type='hidden' name='reset'><button type='submit'>RESET</button></form>"); tableBuilder.append( "<script>$(document).ready(function() {$(\"tr\").find(\"td:first\").find(\"span[style='padding-left: 0px;']\").remove();});</script>"); tableBuilder .append("<script type='text/javascript'>" + getResourceAsString("jquery.treetable.js") + "</script>"); return tableBuilder.toString(); }
Source:
<code>private void writeInterfaceInheritedMembers(MemberSpecification memberSpecification, String title) throws IOException { Map<TypeDeclaration, List<Declaration>> inheritedMembers = interfaceInheritedMembers.get(memberSpecification); for (TypeDeclaration superInterface : inheritedMembers.keySet()) { List<Declaration> members = inheritedMembers.get(superInterface); if (members == null || members.isEmpty()) continue; makeSureInheritedSectionIsOpen(); open("table"); open("tr class='TableHeadingColor'"); open("th"); write(title); open("code"); <START> linkRenderer().to(superInterface).write(); <END> close("code"); close("th"); close("tr"); open("tr class='TableRowColor'"); open("td", "code"); boolean first = true; for (Declaration member : members) { if (!first) { write(", "); } else { first = false; } linkRenderer().to(member).write(); } close("code", "td", "tr", "table"); } }</code><technical_language>I get a shortcut form link(model) calls linkRenderer().to(model).write()</technical_language>

Target:
private void writeInterfaceInheritedMembers(MemberSpecification memberSpecification, String title) throws IOException { Map<TypeDeclaration, List<Declaration>> inheritedMembers = interfaceInheritedMembers.get(memberSpecification); for (TypeDeclaration superInterface : inheritedMembers.keySet()) { List<Declaration> members = inheritedMembers.get(superInterface); if (members == null || members.isEmpty()) continue; makeSureInheritedSectionIsOpen(); open("table"); open("tr class='TableHeadingColor'"); open("th"); write(title); open("code"); linkToDeclaration(superInterface); close("code"); close("th"); close("tr"); open("tr class='TableRowColor'"); open("td", "code"); boolean first = true; for (Declaration member : members) { if (!first) { write(", "); } else { first = false; } linkToDeclaration(member); } close("code", "td", "tr", "table"); } }
Source:
<code>public void happyPath() throws Exception { context.checking(new Expectations() {{ <START> oneOf(catalog).isSupported(NOT_AVAILABLE.name()); <END> will(returnValue(true)); never(validatorContext).buildConstraintViolationWithTemplate(with(any(String.class))); }}); boolean isValid = validator.isValid(NOT_AVAILABLE.name(), validatorContext); assertTrue(isValid); }</code><technical_language>pass a simple string? if delete NOT_AVAILABLE in future</technical_language>

Target:
public void happyPath() throws Exception { context.checking(new Expectations() {{ oneOf(catalog).isSupported("NOT_AVAILABLE"); will(returnValue(true)); never(validatorContext).buildConstraintViolationWithTemplate(with(any(String.class))); }}); boolean isValid = validator.isValid("NOT_AVAILABLE", validatorContext); assertTrue(isValid); }