auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRetriesWhenRetryableError() { String nonRetryable = "{\"error\":{\"code\":\"RetryableError\",\"message\":\"Resource busy\"}}"; HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://localhost").build()); HttpResponse response = HttpResponse.builder().statusCode(429).payload(nonRetryable).build(); assertTrue(handler.shouldRetryRequest(command, response)); }

Target:
public void testRetriesWhenRetryableError() { String retryable = "{\"error\":{\"code\":\"RetryableError\",\"message\":\"Resource busy\"}}"; HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://localhost").build()); HttpResponse response = HttpResponse.builder().statusCode(429).payload(retryable).build(); assertTrue(handler.shouldRetryRequest(command, response)); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getDateHeader("If-Modified-Since") > startupTime) { resp.setStatus(304); return; } String category = getCategory(req); Format format = getFormat(req); String state = getState(req); String iconSetId = getIconSetId(req); IconProvider topProvider = null; int maxPrio = Integer.MIN_VALUE; for (IconProvider provider : iconProvider) { Integer prio = provider.hasIcon(category, iconSetId, format); if (prio != null && prio > maxPrio) { maxPrio = prio; topProvider = provider; } } if (topProvider == null) { logger.debug( "Requested icon category provided by no icon provider; try to failback to category \"none\"", category); category = "none"; for (IconProvider provider : iconProvider) { Integer prio = provider.hasIcon(category, iconSetId, format); if (prio != null && prio > maxPrio) { maxPrio = prio; topProvider = provider; } } } if (topProvider != null) { if (format.equals(Format.SVG)) { resp.setContentType("image/svg+xml"); } else { resp.setContentType("image/png"); } resp.setDateHeader("Last-Modified", new Date().getTime()); ServletOutputStream os = resp.getOutputStream(); try (InputStream is = topProvider.getIcon(category, iconSetId, state, format)) { IOUtils.copy(is, os); resp.flushBuffer(); } catch (IOException e) { logger.error("Failed sending the icon byte stream as a response: {}", e.getMessage()); resp.sendError(500, e.getMessage()); } } else { resp.sendError(404); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getDateHeader("If-Modified-Since") > startupTime) { resp.setStatus(304); return; } String category = getCategory(req); Format format = getFormat(req); String state = getState(req); String iconSetId = getIconSetId(req); IconProvider topProvider = getIconProvider(category, iconSetId, format); if (topProvider == null) { logger.debug( "Requested icon category provided by no icon provider; try to failback to category \"none\"", category); category = "none"; topProvider = getIconProvider(category, iconSetId, format); } if (topProvider != null) { if (format.equals(Format.SVG)) { resp.setContentType("image/svg+xml"); } else { resp.setContentType("image/png"); } resp.setDateHeader("Last-Modified", new Date().getTime()); ServletOutputStream os = resp.getOutputStream(); try (InputStream is = topProvider.getIcon(category, iconSetId, state, format)) { IOUtils.copy(is, os); resp.flushBuffer(); } catch (IOException e) { logger.error("Failed sending the icon byte stream as a response: {}", e.getMessage()); resp.sendError(500, e.getMessage()); } } else { resp.sendError(404); } }
Source:
private void addComponent(Map<String, String> flatConfigurations, Service service, String componentName, List<String> hosts) { Component component = environmentService.initializeComponent(service, componentName); List<ComponentProcess> componentProcesses = hosts.stream().map(host -> { ComponentProcess cp = new ComponentProcess(); cp.setHost(host); return cp; }).collect(toList()); environmentService.injectProtocolAndPortToComponent(flatConfigurations, component, componentProcesses); if (componentName.equals(ServiceConfigurations.KAFKA.name())) { final String brokerSecurityProtocol = flatConfigurations.get(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL); for (ComponentProcess componentProcess : componentProcesses) { KafkaBrokerListeners.Protocol protocol = KafkaBrokerListeners.Protocol.SASL_PLAINTEXT.hasAlias(brokerSecurityProtocol) ? KafkaBrokerListeners.Protocol.SASL_PLAINTEXT : KafkaBrokerListeners.Protocol.find(componentProcess.getProtocol()); componentProcess.setProtocol(protocol.name()); } } final Component storedComponent = environmentService.addComponent(component); componentProcesses.forEach(cp -> { cp.setComponentId(storedComponent.getId()); environmentService.addComponentProcess(cp); }); }

Target:
private void addComponent(Map<String, String> flatConfigurations, Service service, String componentName, List<String> hosts) { Component component = environmentService.createComponent(service, componentName); List<ComponentProcess> componentProcesses = hosts.stream().map(host -> { ComponentProcess cp = new ComponentProcess(); cp.setHost(host); return cp; }).collect(toList()); environmentService.injectProtocolAndPortToComponent(flatConfigurations, component, componentProcesses); if (componentName.equals(ServiceConfigurations.KAFKA.name())) { setKafkaProtocol(flatConfigurations, componentProcesses); } final Component storedComponent = environmentService.addComponent(component); componentProcesses.forEach(cp -> { cp.setComponentId(storedComponent.getId()); environmentService.addComponentProcess(cp); }); }
Source:
public void install() { final VDS host = getSelectedItem(); InstallModel model = new InstallModel(); model.setVds(host); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().installHostTitle()); model.setHelpTag(HelpTag.install_host); model.setHashName("install_host"); model.getOVirtISO().setIsAvailable(false); model.getOverrideIpTables().setIsAvailable(false); model.getHostVersion().setEntity(host.getHostOs()); model.getHostVersion().setIsAvailable(false); getWindow().startProgress(); model.getUserPassword().setIsAvailable(true); model.getUserPassword().setIsChangeable(true); model.getOverrideIpTables().setIsAvailable(true); model.getOverrideIpTables().setEntity(true); model.getActivateHostAfterInstall().setEntity(true); model.getReconfigureGluster().setIsAvailable(true); model.getReconfigureGluster().setEntity(true); addInstallCommands(model, host, false); getWindow().stopProgress(); }

Target:
public void install() { final VDS host = getSelectedItem(); InstallModel model = new InstallModel(); model.setVds(host); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().installHostTitle()); model.setHelpTag(HelpTag.install_host); model.setHashName("install_host"); model.getOVirtISO().setIsAvailable(false); model.getOverrideIpTables().setIsAvailable(false); model.getHostVersion().setEntity(host.getHostOs()); model.getHostVersion().setIsAvailable(false); getWindow().startProgress(); model.getUserPassword().setIsAvailable(true); model.getUserPassword().setIsChangeable(true); model.getOverrideIpTables().setIsAvailable(true); model.getOverrideIpTables().setEntity(true); model.getActivateHostAfterInstall().setEntity(true); if(host.getClusterSupportsGlusterService()) { model.getReconfigureGluster().setIsAvailable(true); } else { model.getReconfigureGluster().setIsAvailable(false); } model.getReconfigureGluster().setEntity(model.getReconfigureGluster().getEntity()); addInstallCommands(model, host, false); getWindow().stopProgress(); }
Source:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PAUSE); }

Target:
protected void setActionMessageParameters() { super.setActionMessageParameters(); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PAUSE); }
Source:
public boolean start() { String oldVersion = manager.getVersion(extractionNamespace.getNamespace()); if (manager.scheduleOrUpdateIndividual(extractionNamespace)) { String newVersion = manager.getVersion(extractionNamespace.getNamespace()); while(newVersion == null || newVersion.equals(oldVersion)) { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } newVersion = manager.getVersion(extractionNamespace.getNamespace()); } } return true; }

Target:
public boolean start() { final Lock writeLock = startStopSync.writeLock(); writeLock.lock(); try { if (!started.compareAndSet(false, true)) { LOG.warn("Already started!"); return false; } if (!manager.scheduleAndWait(extractorID, extractionNamespace, SCHEDULE_TIMEOUT)) { LOG.warn("Failed to schedule lookup [%s]", extractorID); return false; } LOG.debug("NamespaceLookupExtractorFactory[%s] started", extractorID); return true; } finally { writeLock.unlock(); } }
Source:
public Builder withGoogleId(String googleId) { profileAttributes.googleId = googleId; return this; }

Target:
public Builder withGoogleId(String googleId) { if (googleId != null) { profileAttributes.googleId = googleId; } return this; }
Source:
public void start() { startStopLock.writeLock().lock(); try { if (!started) { LOG.info("LookupReferencesManager is starting."); if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { LookupExtractorFactoryContainer container = lookupBean.getContainer(); if (container.getLookupExtractorFactory().start()) { lookupMap.put(lookupBean.getName(), container); } else { throw new ISE("Failed to start lookup [%s]:[%s]", lookupBean.getName(), container); } } } if (exec == null && !testMode) { exec = Execs.singleThreaded("lookup-reference-manager-%d"); exec.execute( new Runnable() { @Override public void run() { try { while (started && !Thread.currentThread().isInterrupted()) { try { queue.take().handle(); } catch (InterruptedException ex) { LOG.warn("interrupted, going down... lookups are not managed anymore"); Thread.currentThread().interrupt(); } catch (Exception ex) { LOG.makeAlert(ex, "Exception occured while lookup notice handling.").emit(); } catch (Throwable t) { LOG.makeAlert(t, "Fatal error occured while lookup notice handling.").emit(); throw t; } } } finally { LOG.info("Lookup Mgmt loop exited, Lookup notices are not handled anymore."); } } } ); } started = true; LOG.info("LookupReferencesManager is started."); } } finally { startStopLock.writeLock().unlock(); } }

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } try { LOG.info("LookupReferencesManager is starting."); loadSnapshotAndInitStateRef(); if (!testMode) { mainThread = Execs.makeThread( "LookupReferencesManager-MainThread", new Runnable() { @Override public void run() { try { if (!lifecycleLock.awaitStarted()) { LOG.error("WTF! lifecycle not started, lookup update notices will not be handled."); return; } while (!Thread.interrupted() && lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)) { try { handlePendingNotices(); LockSupport.parkNanos(LookupReferencesManager.this, TimeUnit.MINUTES.toNanos(1)); } catch (Throwable t) { LOG.makeAlert(t, "Error occured while lookup notice handling.").emit(); } } } catch (Throwable t) { LOG.error(t, "Error while waiting for lifecycle start. lookup updates notices will not be handled"); } finally { LOG.info("Lookup Management loop exited, Lookup notices are not handled anymore."); } } }, true ); mainThread.start(); } LOG.info("LookupReferencesManager is started."); lifecycleLock.started(); } finally { lifecycleLock.exitStart(); } }
Source:
protected void configure() { super.configure(); install(new GlacierParserModule()); bind(RequestAuthorizeSignature.class).in(Scopes.SINGLETON); }

Target:
protected void configure() { super.configure(); bind(RequestAuthorizeSignature.class).in(Scopes.SINGLETON); }
Source:
public ManifestIdentifier identify(Config config) { FsFile manifestFile = getFsFileFromProperty("android_merged_manifest"); FsFile resourcesDir = getFsFileFromProperty("android_merged_resources"); FsFile assetsDir = getFsFileFromProperty("android_merged_assets"); FsFile apkFile = getFsFileFromProperty("android_resources_apk"); String packageName = properties.getProperty("android_custom_package"); String manifestConfig = config.manifest(); if (Config.NONE.equals(manifestConfig)) { Logger.info("@Config(manifest = Config.NONE) specified while using Build System API, ignoring"); } else if (!Config.DEFAULT_MANIFEST_NAME.equals(manifestConfig)) { manifestFile = resolveFile(manifestConfig); } if (!Config.DEFAULT_RES_FOLDER.equals(config.resourceDir())) { resourcesDir = resolveFile(config.resourceDir()); } if (!Config.DEFAULT_ASSET_FOLDER.equals(config.assetDir())) { assetsDir = resolveFile(config.assetDir()); } if (!Config.DEFAULT_PACKAGE_NAME.equals(config.packageName())) { packageName = config.packageName(); } List<ManifestIdentifier> libraryDirs = emptyList(); if (config.libraries().length > 0) { Logger.info("@Config(libraries) specified while using Build System API, ignoring"); } return new ManifestIdentifier(packageName, manifestFile, resourcesDir, assetsDir, libraryDirs, apkFile); }

Target:
public ManifestIdentifier identify(Config config) { FsFile manifestFile = getFsFileFromProperty("android_merged_manifest"); FsFile resourcesDir = getFsFileFromProperty("android_merged_resources"); FsFile assetsDir = getFsFileFromProperty("android_merged_assets"); FsFile apkFile = getFsFileFromProperty("android_resource_apk"); String packageName = properties.getProperty("android_custom_package"); String manifestConfig = config.manifest(); if (Config.NONE.equals(manifestConfig)) { Logger.info("@Config(manifest = Config.NONE) specified while using Build System API, ignoring"); } else if (!Config.DEFAULT_MANIFEST_NAME.equals(manifestConfig)) { manifestFile = resolveFile(manifestConfig); } if (!Config.DEFAULT_RES_FOLDER.equals(config.resourceDir())) { resourcesDir = resolveFile(config.resourceDir()); } if (!Config.DEFAULT_ASSET_FOLDER.equals(config.assetDir())) { assetsDir = resolveFile(config.assetDir()); } if (!Config.DEFAULT_PACKAGE_NAME.equals(config.packageName())) { packageName = config.packageName(); } List<ManifestIdentifier> libraryDirs = emptyList(); if (config.libraries().length > 0) { Logger.info("@Config(libraries) specified while using Build System API, ignoring"); } return new ManifestIdentifier(packageName, manifestFile, resourcesDir, assetsDir, libraryDirs, apkFile); }
Source:
public Void visit(GenContext state, Fn ast) { return null; }

Target:
public Void visit(GenContext state, Fn ast) { ast.getBody().acceptVisitor(this, state); return null; }
Source:
public void tesDuplicatedReturnLogicalSlotFails() { CompletableFuture<PhysicalSlot> slotContextFuture = CompletableFuture .completedFuture(new TestingPhysicalSlot(RP, new AllocationID())); AtomicInteger released = new AtomicInteger(0); SharedSlot sharedSlot = SharedSlotBuilder .newBuilder() .withSlotContextFuture(slotContextFuture) .withReleaseCallback(g -> released.incrementAndGet()) .build(); LogicalSlot logicalSlot = sharedSlot.allocateLogicalSlot(EV1).join(); sharedSlot.returnLogicalSlot(logicalSlot); try { sharedSlot.returnLogicalSlot(logicalSlot); fail("Duplicated 'returnLogicalSlot' call should fail with IllegalStateException"); } catch (IllegalStateException e) { } }

Target:
public void tesDuplicatedReturnLogicalSlotFails() { CompletableFuture<PhysicalSlot> slotContextFuture = CompletableFuture .completedFuture(new TestingPhysicalSlot(RP, new AllocationID())); AtomicInteger released = new AtomicInteger(0); SharedSlot sharedSlot = SharedSlotBuilder .newBuilder() .withSlotContextFuture(slotContextFuture) .withExternalReleaseCallback(g -> released.incrementAndGet()) .build(); LogicalSlot logicalSlot = sharedSlot.allocateLogicalSlot(EV1).join(); sharedSlot.returnLogicalSlot(logicalSlot); try { sharedSlot.returnLogicalSlot(logicalSlot); fail("Duplicated 'returnLogicalSlot' call should fail with IllegalStateException"); } catch (IllegalStateException e) { } }
Source:
public void setup() { retrieveDocumentSetRequestType = mock(RetrieveDocumentSetRequestType.class); retrieveDocumentSetResponseType = mock(RetrieveDocumentSetResponseType.class); webContextProp = mock(Properties.class); nhinTargetSystemType = mock(NhinTargetSystemType.class); assertionType = mock(AssertionType.class); }

Target:
public void setup() { logger = mock(DocRetrieveAuditLogger.class); }
Source:
@Override protected void setUp() throws Exception { productFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "sample.product").toString(); noLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "noLauncherFlag.product").toString()); falseLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "falseLauncherFlag.product").toString()); trueLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "trueLauncherFlag.product").toString()); productFile = new ProductFile(productFileLocation); uidProductFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "uidproduct.product").toString(); uidProductFile = new ProductFile(uidProductFileLocation); rootFeaturesProduct = new ProductFile(TestData.getFile("ProductActionTest", "rootFeatures.product").toString()); }

Target:
protected void setUp() throws Exception { productFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "sample.product").toString(); noLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "noLauncherFlag.product").toString()); falseLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "falseLauncherFlag.product").toString()); trueLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "trueLauncherFlag.product").toString()); productFile = new ProductFile(productFileLocation); uidProductFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "uidproduct.product").toString(); uidProductFile = new ProductFile(uidProductFileLocation); rootFeaturesProduct = new ProductFile(TestData.getFile("ProductActionTest", "rootFeatures.product").toString()); }
Source:
protected void streamResponseToFile(HttpResponse response, String destination) { try { int status = checkResponseCode(response); org.apache.http.HttpEntity entity = response.getEntity(); InputStream responseStream = entity.getContent(); FileOutputStream fos = new FileOutputStream(destination); IOUtils.copy(responseStream, fos); if (status == 200) { logger.log(SystemProperties.DIAG, "File was retrieved and saved to disk.", destination); } else{ logger.log(SystemProperties.DIAG, "File was retrieved and saved to disk with errors.", destination); } } catch (Exception e) { logger.error("Error processing response", e); } }

Target:
protected void streamResponseToFile(HttpResponse response, String destination) { try(FileOutputStream fos = new FileOutputStream(destination)) { int status = checkResponseCode(response); org.apache.http.HttpEntity entity = response.getEntity(); InputStream responseStream = entity.getContent(); IOUtils.copy(responseStream, fos); if (status == 200) { logger.log(SystemProperties.DIAG, "File was retrieved and saved to disk.", destination); } else { logger.log(SystemProperties.DIAG, "File was retrieved and saved to disk with errors.", destination); } } catch (Exception e) { logger.error("Error processing response", e); } }
Source:
public List<PerunPolicy> loadPerunPolicies() { List<PerunPolicy> policies = new ArrayList<>(); JsonNode rootNode = loadConfigurationFile(); JsonNode policiesNode = rootNode.get("perun_policies"); Iterator<String> policyNames = policiesNode.fieldNames(); while(policyNames.hasNext()) { String policyName = policyNames.next(); JsonNode policyNode = policiesNode.get(policyName); List<Map<String, String>> perunRoles = new ArrayList<>(); JsonNode perunRolesNode = policyNode.get("policy_roles"); for (JsonNode perunRoleNode : perunRolesNode) { Map<String, String> innerRoleMap = new HashMap<>(); Iterator<String> roleArrayKeys = perunRoleNode.fieldNames(); while (roleArrayKeys.hasNext()) { String role = roleArrayKeys.next(); JsonNode roleObjectNode = perunRoleNode.get(role); String object = roleObjectNode.isNull() ? null : roleObjectNode.textValue(); innerRoleMap.put(role, object); } perunRoles.add(innerRoleMap); } List<String> includePolicies = new ArrayList<>(new ObjectMapper().convertValue(policyNode.get("include_policies"), new TypeReference<List<String>>() {})); policies.add(new PerunPolicy(policyName, perunRoles, includePolicies)); } return policies; }

Target:
public List<PerunPolicy> loadPerunPolicies() { List<PerunPolicy> policies = new ArrayList<>(); JsonNode rootNode = loadConfigurationFile(); JsonNode policiesNode = rootNode.get("perun_policies"); Iterator<String> policyNames = policiesNode.fieldNames(); while(policyNames.hasNext()) { String policyName = policyNames.next(); JsonNode policyNode = policiesNode.get(policyName); List<Map<String, String>> perunRoles = new ArrayList<>(); JsonNode perunRolesNode = policyNode.get("policy_roles"); for (JsonNode perunRoleNode : perunRolesNode) { Map<String, String> innerRoleMap = new HashMap<>(); Iterator<String> roleArrayKeys = perunRoleNode.fieldNames(); while (roleArrayKeys.hasNext()) { String role = roleArrayKeys.next(); JsonNode roleObjectNode = perunRoleNode.get(role); String object = roleObjectNode.isNull() ? null : roleObjectNode.textValue(); innerRoleMap.put(role, object); } perunRoles.add(innerRoleMap); } List<String> includePolicies = new ArrayList<>(objectMapper.convertValue(policyNode.get("include_policies"), new TypeReference<List<String>>() {})); policies.add(new PerunPolicy(policyName, perunRoles, includePolicies)); } return policies; }
Source:
private FactHandle[] insertFacts(KieSession ksession, int n) { FactHandle[] fhs = new FactHandle[n]; for (int i = 0; i < n; i++) { fhs[i] = ksession.insert(i); ksession.insert("" + String.valueOf(i)); } return fhs; }

Target:
private FactHandle[] insertFacts(KieSession ksession, int n) { FactHandle[] fhs = new FactHandle[n]; for (int i = 0; i < n; i++) { fhs[i] = ksession.insert(i); ksession.insert(String.valueOf(i)); } return fhs; }
Source:
public void doNotExpireDynamicConfigWithCustomExpirationUsedBySource() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamicWithCustomExpirationForSource", "heisenbergWithCustomExpirationForSource", "Walter Blanco"); try { assertExpired(config, 10000, 1000); fail("Config should not have been expired"); } catch (AssertionError e) { assertThat(e.getMessage(), is(not("Config should not have been expired"))); } assertInitialised(config); sourceWithDynamicConfig.stop(); assertExpired(config, 6000, 100); }

Target:
public void doNotExpireDynamicConfigWithCustomExpirationUsedBySource() throws Exception { HeisenbergExtension config = invokeDynamicConfig("dynamicWithCustomExpirationForSource", "heisenbergWithCustomExpirationForSource", "Walter Blanco"); try { assertExpired(config, 10000, 1000); throw new IllegalStateException("Config should not have been expired"); } catch (AssertionError e) { } assertInitialised(config); sourceWithDynamicConfig.stop(); assertExpired(config, 6000, 100); }
Source:
public JsonObject getClientOfAccount(String deploymentUrl, JsonObject account) { String url = getClientUrl(deploymentUrl, account); JsonObject jsonResponse = null; String authToken = getAuthorizationToken(account.get("email_address").toString(), account.get("auth_token").toString()); System.out.println("***************************************************************"); System.out.println("*** URL: " + url); System.out.println("Auth Token: " + authToken); System.out.println("Account Auth: " + account.get("auth_token")); System.out.println("Account Sid: " + account.get("sid")); System.out.println("***************************************************************"); try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); httpGet.addHeader("Authorization", "Basic " + authToken); HttpResponse response = httpclient.execute(httpGet); if (response.getStatusLine().getStatusCode() == 200) { HttpEntity entity = response.getEntity(); String res = EntityUtils.toString(entity); JsonParser parser = new JsonParser(); jsonResponse = parser.parse(res).getAsJsonObject(); } httpGet.releaseConnection(); }catch (ClientProtocolException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); } return jsonResponse; }

Target:
public JsonObject getClientOfAccount(String deploymentUrl, JsonObject account) { String url = getClientUrl(deploymentUrl, account); JsonObject jsonResponse = null; String authToken = getAuthorizationToken(account.get("email_address").toString(), account.get("auth_token").toString()); try { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); httpGet.addHeader("Authorization", "Basic " + authToken); HttpResponse response = httpclient.execute(httpGet); if (response.getStatusLine().getStatusCode() == 200) { HttpEntity entity = response.getEntity(); String res = EntityUtils.toString(entity); JsonParser parser = new JsonParser(); jsonResponse = parser.parse(res).getAsJsonObject(); } httpGet.releaseConnection(); }catch (ClientProtocolException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); } return jsonResponse; }
Source:
public T nextRecord() { byte[] blob = c.getBlob(c.getColumnIndexOrThrow(DatabaseHelper.DATA_COL)); if (blob != null) { return storage.newObject(blob, nextID()); } else { String filename = c.getString(c.getColumnIndexOrThrow(DatabaseHelper.FILE_COL)); byte[] aesKeyBlob = c.getBlob(c.getColumnIndexOrThrow(DatabaseHelper.AES_COL)); InputStream fileInputStream = ((HybridFileBackedSqlStorage<T>)storage).getInputStreamFromFile(filename, aesKeyBlob); return storage.newObject(fileInputStream, nextID()); } }

Target:
public T nextRecord() { byte[] blob = c.getBlob(c.getColumnIndexOrThrow(DatabaseHelper.DATA_COL)); if (blob != null) { return storage.newObject(blob, nextID()); } else { String filename = c.getString(c.getColumnIndexOrThrow(DatabaseHelper.FILE_COL)); byte[] aesKeyBlob = c.getBlob(c.getColumnIndexOrThrow(DatabaseHelper.AES_COL)); try { InputStream fileInputStream = ((HybridFileBackedSqlStorage<T>)storage).getInputStreamFromFile(filename, aesKeyBlob); return storage.newObject(fileInputStream, nextID()); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } }
Source:
protected Number calculateHorizontalDiff(final ILayerCell cell, final int toRow, final IConfigRegistry configRegistry) { Number diff = super.calculateHorizontalDiff(cell, toRow, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { if ((command.direction == MoveDirectionEnum.UP && !((PapyrusFillHandlePasteCommand) command).isIncrement()) || (command.direction == MoveDirectionEnum.DOWN && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }

Target:
protected Number calculateHorizontalDiff(final ILayerCell cell, final int toRow, final IConfigRegistry configRegistry) { Number diff = super.calculateHorizontalDiff(cell, toRow, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { if ((MoveDirectionEnum.UP == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement()) || (MoveDirectionEnum.DOWN == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }
Source:
protected Event doExecute(final RequestContext requestContext) { val auth = WebUtils.getAuthentication(requestContext); val uid = auth.getPrincipal().getId(); val keyUriFmt = "otpauth://totp/" + this.label + ":" + uid + "?secret=%s&issuer=" + this.issuer; if (auth.getAttributes().containsKey("isNewOtpRegistration")) { LOGGER.debug("Arrrived back at registration check with isNewOtpRegistration set; returning register"); return new EventFactorySupport().event(this, "register"); } val acct = repository.get(uid); if (acct == null || StringUtils.isBlank(acct.getSecretKey())) { val keyAccount = this.repository.create(uid); val keyUri = String.format(keyUriFmt, keyAccount.getSecretKey()); requestContext.getFlowScope().put("key", keyAccount); requestContext.getFlowScope().put("keyUri", keyUri); LOGGER.debug("Registration key URI is [{}]", keyUri); auth.addAttribute("isNewOtpRegistration", true); return new EventFactorySupport().event(this, "register"); } return success(); }

Target:
protected Event doExecute(final RequestContext requestContext) { val uid = WebUtils.getAuthentication(requestContext).getPrincipal().getId(); val acct = repository.get(uid); if (acct == null || StringUtils.isBlank(acct.getSecretKey())) { val keyAccount = this.repository.create(uid); val keyUri = "otpauth://totp/" + this.label + ':' + uid + "?secret=" + keyAccount.getSecretKey() + "&issuer=" + this.issuer; val flowScope = requestContext.getFlowScope(); flowScope.put(FLOW_SCOPE_ATTR_ACCOUNT, keyAccount); flowScope.put(FLOW_SCOPE_ATTR_ACCOUNT_URI, keyUri); LOGGER.debug("Registration key URI is [{}]", keyUri); return new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_REGISTER); } return success(); }
Source:
protected void verify_internal_effects() { verify(comparables).assertEqual(getInfo(assertions), getActual(assertions), "A and 8"); }

Target:
protected void verify_internal_effects() { verify(objects).assertEqual(getInfo(assertions), getActual(assertions), "A and 8"); }
Source:
public ActiveMQBuffer toActiveMQBuffer() throws Exception { if (buffer == null) { if (bytesBody != null) { buffer = ActiveMQBuffers.dynamicBuffer(bytesBody.length + 512); } else { buffer = ActiveMQBuffers.dynamicBuffer(512); } if (isPing()) { buffer.writeByte((byte) 10); return buffer; } StringBuilder head = new StringBuilder(512); head.append(command); head.append(Stomp.NEWLINE); encodeHeaders(head); if (bytesBody != null && bytesBody.length > 0 && !hasHeader(Stomp.Headers.CONTENT_LENGTH) && !(this instanceof StompFrameV10)) { head.append(Stomp.Headers.CONTENT_LENGTH); head.append(Stomp.Headers.SEPARATOR); head.append(bytesBody.length); head.append(Stomp.NEWLINE); } head.append(Stomp.NEWLINE); buffer.writeBytes(head.toString().getBytes(StandardCharsets.UTF_8)); if (bytesBody != null) { buffer.writeBytes(bytesBody); } buffer.writeBytes(END_OF_FRAME); size = buffer.writerIndex(); } else { buffer.readerIndex(0); } return buffer; }

Target:
public ActiveMQBuffer toActiveMQBuffer() throws Exception { if (buffer == null) { if (isPing()) { buffer = ActiveMQBuffers.fixedBuffer(1); buffer.writeByte((byte)10); size = buffer.writerIndex(); return buffer; } StringBuilder head = new StringBuilder(512); head.append(command); head.append(Stomp.NEWLINE); encodeHeaders(head); if (bytesBody != null && bytesBody.length > 0 && !hasHeader(Stomp.Headers.CONTENT_LENGTH) && !(this instanceof StompFrameV10)) { head.append(Stomp.Headers.CONTENT_LENGTH); head.append(Stomp.Headers.SEPARATOR); head.append(bytesBody.length); head.append(Stomp.NEWLINE); } head.append(Stomp.NEWLINE); byte[] headBytes = head.toString().getBytes(StandardCharsets.UTF_8); int bodyLength = (bytesBody == null) ? 0 : bytesBody.length; buffer = ActiveMQBuffers.fixedBuffer(headBytes.length + bodyLength + END_OF_FRAME.length); buffer.writeBytes(headBytes); if (bytesBody != null) { buffer.writeBytes(bytesBody); } buffer.writeBytes(END_OF_FRAME); size = buffer.writerIndex(); } else { buffer.readerIndex(0); } return buffer; }
Source:
public String execute(Connection<?> connection) { User user = userHelper.createUser(connection); AccountRequest accountRequest = new AccountRequest(); accountRequest.setUsername(user.getUserName()); accountRequest.setName( user.getName()); accountRequest.setEmail(user.getEmail()); accountRequest.setSocialSignIn(true); accountRequest.setProvider(user.getProvider()); accountRequest.setUserIdOfProvider(user.getUserIdOfProvider()); try { userManager.addNewUser(accountRequest); } catch (QuadrigaStorageException | QuadrigaNotificationException | UsernameExistsException e) { logger.error("Could not store user.", e); return null; } return user.getUserName(); }

Target:
public String execute(Connection<?> connection) { try { return userHelper.createUserName(connection); } catch (QuadrigaStorageException e) { logger.error("Error while creating username", e); return null; } }
Source:
private boolean checkExpressionsUnique(List<SortEntry> sortList){ List<String> list = new ArrayList<>(); for(SortEntry elm: sortList){ list.add(elm.match.expression.getRegex()); } return new HashSet<>(list).size() == list.size(); }

Target:
private boolean checkExpressionsUnique(List<SortEntry> sortList){ Set<String> regexps = new HashSet<>(); for(SortEntry elm: sortList){ regexps.add(elm.match.expression.getRegex()); } return regexps.size() == sortList.size(); }
Source:
public boolean validate(Context context, HttpServletRequest request, List<String> uriList, Class clazz) throws AuthorizeException { if (uriList.size() > 1) { return false; } if (clazz != Item.class) { return false; } String owningCollectionString = request.getParameter("owningCollection"); if (StringUtils.isBlank(owningCollectionString)) { return false; } try { Collection collection = collectionService.find(context, UUID.fromString(owningCollectionString)); if (collection == null) { return false; } if (!authorizeService.isAdmin(context)) { throw new AuthorizeException("Only admins are allowed to create items using external data"); } } catch (SQLException e) { log.error(e.getMessage(), e); return false; } return true; }

Target:
public boolean validate(Context context, HttpServletRequest request, List<String> uriList, Class clazz) throws AuthorizeException { if (uriList.size() > 1) { return false; } if (clazz != Item.class) { return false; } String owningCollectionString = request.getParameter("owningCollection"); if (StringUtils.isBlank(owningCollectionString)) { return false; } try { if (!authorizeService.isAdmin(context)) { throw new AuthorizeException("Only admins are allowed to create items using external data"); } Collection collection = collectionService.find(context, UUID.fromString(owningCollectionString)); if (collection == null) { return false; } } catch (SQLException e) { log.error("Search for owningCollection with UUID:" + owningCollectionString + " resulted in an error", e); return false; } return true; }
Source:
public void send(byte[] message) { outbox.addFirst(ByteBuffer.wrap(message)); LOG.debug("Message sent: " + new String(message, UTF8)); final ReactorClient client = this; scheduleTask(new Callable<Void>() { @Override public Void call() throws ClientConnectionException { client.updateInterestedOps(); return null; } }); }

Target:
public void send(byte[] message) { outbox.addFirst(ByteBuffer.wrap(message)); if (LOG.isDebugEnabled()) { LOG.debug("Message sent: " + new String(message, UTF8)); } final ReactorClient client = this; scheduleTask(new Callable<Void>() { @Override public Void call() throws ClientConnectionException { client.updateInterestedOps(); return null; } }); }
Source:
public void failWithNotConcurrentModificationException() { final String container = randomKey(); final String key = randomKey(); final CustomObjectBigIntegerNumberGeneratorConfig config = CustomObjectBigIntegerNumberGeneratorConfigBuilder.of(getSphereClient(getBadRequestHttpClient()), key) .container(container) .build(); final BigIntegerNumberGenerator generator = CustomObjectBigIntegerNumberGenerator.of(config); try { generator.getNextNumber().toCompletableFuture().join(); } catch (Exception e) { assertThat(e.getCause() instanceof NotFoundException).isTrue(); } }

Target:
public void failWithNotConcurrentModificationException() { final String container = randomKey(); final String key = randomKey(); final ErrorResponseHttpClient notFoundRequestClient = new ErrorResponseHttpClient(NOT_FOUND_404); final CustomObjectBigIntegerNumberGeneratorConfig config = CustomObjectBigIntegerNumberGeneratorConfigBuilder.of(getSphereClient(notFoundRequestClient), key) .container(container) .build(); final BigIntegerNumberGenerator generator = CustomObjectBigIntegerNumberGenerator.of(config); Throwable thrown = catchThrowable(() -> { generator.getNextNumber().toCompletableFuture().join(); }); assertThat(thrown).isNotNull(); assertThat(notFoundRequestClient.getGetRequestsCount()).isEqualTo(1); final ErrorResponseHttpClient concurrentRequestClient = new ErrorResponseHttpClient(CONFLICT_409); final CustomObjectBigIntegerNumberGeneratorConfig config2 = CustomObjectBigIntegerNumberGeneratorConfigBuilder.of(getSphereClient(concurrentRequestClient), key) .container(container) .build(); final BigIntegerNumberGenerator generator2 = CustomObjectBigIntegerNumberGenerator.of(config2); catchThrowable(() -> { generator2.getNextNumber().toCompletableFuture().join(); }); assertThat(concurrentRequestClient.getGetRequestsCount()).isEqualTo(config2.getMaxRetryAttempts()); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + remoteCommit.hashCode(); result = prime * result + baseCommit.hashCode(); result = prime * result + getLocation().hashCode(); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getLocation().hashCode(); result = prime * result + remoteCommit.hashCode(); if (baseCommit != null) result = prime * result + baseCommit.hashCode(); return result; }
Source:
private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) { SuiteRunner result = new SuiteRunner(getConfiguration(), xmlSuite, m_outputDir, m_testRunnerFactory, m_useDefaultListeners, m_methodInterceptors, m_invokedMethodListeners.values(), m_testListeners.values(), m_classListeners.values()); for (ISuiteListener isl : m_suiteListeners.values()) { result.addListener(isl); } for (IReporter r : result.getReporters()) { if (!m_reporters.containsKey(r.getClass())) { addListener(r); } } for (IConfigurationListener cl : m_configuration.getConfigurationListeners()) { result.addConfigurationListener(cl); } return result; }

Target:
private SuiteRunner createSuiteRunner(XmlSuite xmlSuite) { SuiteRunner result = new SuiteRunner(getConfiguration(), xmlSuite, m_outputDir, m_testRunnerFactory, m_useDefaultListeners, m_methodInterceptors, m_invokedMethodListeners.values(), m_testListeners.values(), m_classListeners.values()); for (ISuiteListener isl : m_suiteListeners.values()) { result.addListener(isl); } for (IReporter r : result.getReporters()) { maybeAddListener(m_reporters, r.getClass(), r, true); } for (IConfigurationListener cl : m_configuration.getConfigurationListeners()) { result.addConfigurationListener(cl); } return result; }
Source:
public void init() throws KalturaManagerException { KalturaEventsManager.registerEventConsumer(this, KalturaEventType.STREAM_PUBLISHED, KalturaEventType.STREAM_UNPUBLISHED, KalturaMediaEventType.APPLICATION_INSTANCE_STARTED); liveManager = KalturaServer.getManager(ILiveManager.class); setInitialized(); }

Target:
public void init() throws KalturaManagerException { super.init(); KalturaEventsManager.registerEventConsumer(this, KalturaEventType.STREAM_PUBLISHED, KalturaEventType.STREAM_UNPUBLISHED, KalturaMediaEventType.APPLICATION_INSTANCE_STARTED); liveManager = KalturaServer.getManager(ILiveManager.class); setInitialized(); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("PartitionResponseInfo["); sb.append("PartitionId=").append(partitionId); sb.append(" ServerErrorCode=").append(errorCode); sb.append(" MessageInfoAndMetadataListSize=").append(messageInfoAndMetadataListSize); if (errorCode == ServerErrorCode.No_Error) { sb.append(" MessageInfoList=").append(messageInfoAndMetadataListSerde.getMessageInfoList()); } sb.append("]"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("PartitionResponseInfo["); sb.append("PartitionId=").append(partitionId); sb.append(" ServerErrorCode=").append(errorCode); sb.append(" MessageInfoAndMetadataListSize=").append(messageInfoAndMetadataListSize); sb.append("]"); return sb.toString(); }
Source:
private boolean doDrag(DragDropEventBase<?> event, boolean isDrop) { String dragDropEventData = PolicyUnitPanel.getDragDropEventData(event, isDrop); String[] split = dragDropEventData.split(" "); if (split != null && split.length == 3) { if (!type.equals(split[0])) { return false; } else if (Boolean.valueOf(split[2]).equals(used)) { return false; } } PolicyUnit policyUnit = model.getPolicyUnitsMap().get(Guid.createGuidFromString(split[1])); if (PolicyUnitPanel.FILTER.equals(split[0])) { if (used) { model.addFilter(policyUnit, false, 0); } else { model.removeFilter(policyUnit); } } else if (FunctionPolicyUnitPanel.FUNCTION.equals(split[0])) { if (used) { model.addFunction(policyUnit); } else { model.removeFunction(policyUnit); } } return true; }

Target:
private boolean doDrag(DragDropEventBase<?> event, boolean isDrop) { String dragDropEventData = PolicyUnitPanel.getDragDropEventData(event, isDrop); String[] split = dragDropEventData.split(" "); if (split != null && split.length == EVENT_DATA_COUNT) { if (!type.equals(split[0])) { return false; } else if (Boolean.valueOf(split[2]).equals(used)) { return false; } } PolicyUnit policyUnit = model.getPolicyUnitsMap().get(Guid.createGuidFromString(split[1])); if (PolicyUnitPanel.FILTER.equals(split[0])) { if (used) { model.addFilter(policyUnit, false, 0); } else { model.removeFilter(policyUnit); } } else if (FunctionPolicyUnitPanel.FUNCTION.equals(split[0])) { if (used) { model.addFunction(policyUnit); } else { model.removeFunction(policyUnit); } } return true; }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SearchRequest that = (SearchRequest) o; if (this.requestId != that.requestId) { return false; } if (this.parameters != null ? !this.parameters.equals(that.parameters) : that.parameters != null) { return false; } return true; }

Target:
public boolean equals(final Object o) { return Pojomatic.equals(this, o); }
Source:
public void editNoFilenameTest() { String label = "a brand-new title too!"; service.editLabel(agent, pid, label); verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), any(Resource.class)); verify(premisLogger).buildEvent(eq(Premis.FilenameChange)); verify(eventBuilder).addEventDetail(labelCaptor.capture()); assertEquals(labelCaptor.getValue(), "Object renamed from no ebucore:filename to " + label); verify(eventBuilder).writeAndClose(); verify(messageSender).sendUpdateDescriptionOperation(anyString(), pidCaptor.capture()); assertEquals(pid, pidCaptor.getValue().get(0)); }

Target:
public void editNoFilenameTest() { String label = "a brand-new title too!"; service.editLabel(agent, pid, label); verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), eq(label)); verify(premisLogger).buildEvent(eq(Premis.FilenameChange)); verify(eventBuilder).addEventDetail(labelCaptor.capture()); assertEquals(labelCaptor.getValue(), "Object renamed from no ebucore:filename to " + label); verify(eventBuilder).writeAndClose(); verify(messageSender).sendUpdateDescriptionOperation(anyString(), pidCaptor.capture()); assertEquals(pid, pidCaptor.getValue().get(0)); }
Source:
public void testDeadlock() { boolean interrupted = Thread.interrupted(); if (interrupted) { fail("Thread was interrupted at start of test"); } final ILock lock = Job.getJobManager().newLock(); final boolean[] blocked = new boolean[] {false}; final boolean[] lockAcquired= new boolean[] {false}; Thread locking = new Thread("SyncExecWhileUIThreadWaitsForLock") { @Override public void run() { try { lock.acquire(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { blocked[0] = true; lock.acquire(); lock.release(); blocked[0] = false; } }); while (!blocked[0]) { try { Thread.sleep(100); } catch (InterruptedException e) { } } Display.getDefault().syncExec(new Runnable() { @Override public void run() { try { if (lock.acquire(60000)) { lockAcquired[0] = true; lock.release(); } } catch (InterruptedException e) { } } }); } finally { lock.release(); } } }; locking.start(); long waitStart = System.currentTimeMillis(); Display display = Display.getDefault(); while (!lockAcquired[0]) { if (!display.readAndDispatch()) { display.sleep(); } if (System.currentTimeMillis()-waitStart > 60000) { assertTrue("Deadlock occurred", false); } } interrupted = Thread.interrupted(); if (interrupted) { } }

Target:
public void testDeadlock() { if (Thread.interrupted()) { fail("Thread was interrupted at start of test"); } final ILock lock = Job.getJobManager().newLock(); final boolean[] blocked = new boolean[] {false}; final boolean[] lockAcquired= new boolean[] {false}; Thread locking = new Thread("SyncExecWhileUIThreadWaitsForLock") { @Override public void run() { try { lock.acquire(); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { blocked[0] = true; lock.acquire(); lock.release(); blocked[0] = false; } }); while (!blocked[0]) { try { Thread.sleep(100); } catch (InterruptedException e) { } } Display.getDefault().syncExec(new Runnable() { @Override public void run() { try { if (lock.acquire(60000)) { lockAcquired[0] = true; lock.release(); } } catch (InterruptedException e) { } } }); } finally { lock.release(); } } }; locking.start(); long waitStart = System.currentTimeMillis(); Display display = Display.getDefault(); while (!lockAcquired[0]) { if (!display.readAndDispatch()) { display.sleep(); } if (System.currentTimeMillis()-waitStart > 60000) { assertTrue("Deadlock occurred", false); } } assertEquals("Unexpected error count reported: " + reportedErrors, 1, reportedErrors.size()); MultiStatus status = (MultiStatus) reportedErrors.get(0); assertEquals("Unexpected child status count reported: " + Arrays.toString(status.getChildren()), 2, status.getChildren().length); if (Thread.interrupted()) { } }
Source:
public void testClose_drainsBytesOnClose() throws IOException { MockInputStream mockInputStream = new MockInputStream("abc123".getBytes()); InputStream consumingInputStream = new ConsumingInputStream(mockInputStream); assertEquals(6, mockInputStream.getBytesToRead()); consumingInputStream.read(); assertEquals(5, mockInputStream.getBytesToRead()); consumingInputStream.close(); assertEquals(0, mockInputStream.getBytesToRead()); }

Target:
public void testClose_drainsBytesOnClose() throws IOException { MockInputStream mockInputStream = new MockInputStream("abc123".getBytes(StandardCharsets.UTF_8)); InputStream consumingInputStream = new ConsumingInputStream(mockInputStream); assertEquals(6, mockInputStream.getBytesToRead()); consumingInputStream.read(); assertEquals(5, mockInputStream.getBytesToRead()); consumingInputStream.close(); assertEquals(0, mockInputStream.getBytesToRead()); }
Source:
public String getKeyForInstructor(String courseId, String email) throws EntityDoesNotExistException { verifyIsInstructorEmailOfCourse(email, courseId); InstructorAttributes instructor = getInstructorForEmail(courseId, email); return instructor.key; }

Target:
public String getKeyForInstructor(String courseId, String email) throws EntityDoesNotExistException { verifyIsEmailOfInstructorOfCourse(email, courseId); InstructorAttributes instructor = getInstructorForEmail(courseId, email); return instructor.key; }