auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void updateUser(String acceptHeader, String username) { deleteCreatedUser(username); UserForm test = buildUser(username, "password-update", "my-new-security-token"); given().contentType(MediaType.APPLICATION_JSON_VALUE) .accept(acceptHeader) .body(test) .when() .put(getContextBaseUrl()) .peek() .then() .statusCode(HttpStatus.OK.value()) .body(containsString(SUCCESSFUL_CREATE_USER)) .extract() .asString(); User createdUser = retrieveUserByName(test.getUsername()); assertEquals(username, createdUser.getUsername()); logger.info("Users before update: ->>>>>> "); displayAllUsers(); UserForm updatedUser = buildFromUser(createdUser, u -> u.setEnabled(true)); given().contentType(MediaType.APPLICATION_JSON_VALUE) .accept(acceptHeader) .body(updatedUser) .when() .put(getContextBaseUrl() + "/" + username) .peek() .then() .statusCode(HttpStatus.OK.value()) .body(containsString(SUCCESSFUL_UPDATE_USER)); logger.info("Users after update: ->>>>>> "); displayAllUsers(); createdUser = retrieveUserByName(username); assertTrue(createdUser.isEnabled()); assertEquals("my-new-security-token", createdUser.getSecurityTokenKey()); deleteCreatedUser(username); }

Target:
void updateUser(String acceptHeader, String username) { deleteCreatedUser(username); UserForm test = buildUser(username, "password-update", "my-new-security-token"); given().contentType(MediaType.APPLICATION_JSON_VALUE) .accept(acceptHeader) .body(test) .when() .put(getContextBaseUrl()) .peek() .then() .statusCode(HttpStatus.OK.value()) .body(containsString(SUCCESSFUL_CREATE_USER)) .extract() .asString(); User createdUser = retrieveUserByName(test.getUsername()); assertEquals(username, createdUser.getUsername()); UserForm updatedUser = buildFromUser(createdUser, u -> u.setEnabled(true)); given().contentType(MediaType.APPLICATION_JSON_VALUE) .accept(acceptHeader) .body(updatedUser) .when() .put(getContextBaseUrl() + "/" + username) .peek() .then() .statusCode(HttpStatus.OK.value()) .body(containsString(SUCCESSFUL_UPDATE_USER)); createdUser = retrieveUserByName(username); assertTrue(createdUser.isEnabled()); assertEquals("my-new-security-token", createdUser.getSecurityTokenKey()); deleteCreatedUser(username); }
Source:
public Map<String, String> getLinks() { Map<String, String> links = new HashMap<String, String>(); if (OpenmrsConstants.OPENMRS_VERSION_SHORT.equals(REQUIRED_OPENMRS_VERSION)) { links.put("module/emrapi/MigrateDiagnosis.form", Context.getMessageSourceService().getMessage(MIGRATE_DIAGNOSIS_LINK_CODE)); } return links; }

Target:
public Map<String, String> getLinks() { Map<String, String> links = new HashMap<String, String>(); if (ModuleUtil.compareVersion(OpenmrsConstants.OPENMRS_VERSION, DIAGNOSIS_MIGRATION_LEAST_SUPPORTED_VERSION) >= 0) { links.put("module/emrapi/encounterDiagnosisMigrationDashboard.form", "emrapi.migrateDiagnosis.migrateDiagnosisLink.name"); } return links; }
Source:
private TableStatisticsData addPartitionStats(TableStatisticsData left, TableStatisticsData right, TpchColumn<?> partitionColumn) { Map<String, ColumnStatisticsData> combinedColumnStats = left.getColumns().entrySet().stream().collect(toImmutableMap( Map.Entry::getKey, entry -> { String columnName = entry.getKey(); ColumnStatisticsData leftStats = entry.getValue(); ColumnStatisticsData rightStats = right.getColumns().get(columnName); Optional<Long> ndv = addDistinctValuesCount(partitionColumn, columnName, leftStats, rightStats); Optional<Object> min = combine(leftStats.getMin(), rightStats.getMin(), this::min); Optional<Object> max = combine(leftStats.getMax(), rightStats.getMax(), this::max); return new ColumnStatisticsData(ndv, min, max); })); return new TableStatisticsData( left.getRowCount() + right.getRowCount(), combinedColumnStats); }

Target:
private TableStatisticsData addPartitionStats(TableStatisticsData left, TableStatisticsData right, TpchColumn<?> partitionColumn) { Map<String, ColumnStatisticsData> combinedColumnStats = left.getColumns().entrySet().stream().collect(toImmutableMap( Map.Entry::getKey, entry -> { String columnName = entry.getKey(); ColumnStatisticsData leftStats = entry.getValue(); ColumnStatisticsData rightStats = right.getColumns().get(columnName); Optional<Long> ndv = addDistinctValuesCount(partitionColumn, columnName, leftStats, rightStats); Optional<Object> min = combine(leftStats.getMin(), rightStats.getMin(), this::min); Optional<Object> max = combine(leftStats.getMax(), rightStats.getMax(), this::max); Optional<Long> dataSize = leftStats.getDataSize() .flatMap(leftDataSize -> rightStats.getDataSize().map(rightDataSize -> leftDataSize + rightDataSize)); return new ColumnStatisticsData(ndv, min, max, dataSize); })); return new TableStatisticsData( left.getRowCount() + right.getRowCount(), combinedColumnStats); }
Source:
public ServiceAccountCredentials( String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, Collection<String> scopes, HttpTransportFactory transportFactory, URI tokenServerUri, String serviceAccountUser) { this.clientId = clientId; this.clientEmail = Preconditions.checkNotNull(clientEmail); this.privateKey = Preconditions.checkNotNull(privateKey); this.privateKeyId = privateKeyId; this.scopes = (scopes == null) ? ImmutableSet.<String>of() : ImmutableSet.copyOf(scopes); this.transportFactory = firstNonNull(transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); this.tokenServerUri = (tokenServerUri == null) ? OAuth2Utils.TOKEN_SERVER_URI : tokenServerUri; this.serviceAccountUser = serviceAccountUser; }

Target:
ServiceAccountCredentials( String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, Collection<String> scopes, HttpTransportFactory transportFactory, URI tokenServerUri, String serviceAccountUser) { this.clientId = clientId; this.clientEmail = Preconditions.checkNotNull(clientEmail); this.privateKey = Preconditions.checkNotNull(privateKey); this.privateKeyId = privateKeyId; this.scopes = (scopes == null) ? ImmutableSet.<String>of() : ImmutableSet.copyOf(scopes); this.transportFactory = firstNonNull(transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); this.tokenServerUri = (tokenServerUri == null) ? OAuth2Utils.TOKEN_SERVER_URI : tokenServerUri; this.serviceAccountUser = serviceAccountUser; }
Source:
public List<TmfXmlLocation> getLocations() { return fLocations; }

Target:
public Iterable<TmfXmlLocation> getLocations() { return fLocations; }
Source:
public static Map<String, Set<TestInfo>> getAllTests(File testMappingsDir) { Map<String, Set<TestInfo>> allTests = new HashMap<String, Set<TestInfo>>(); Stream<Path> stream = null; try { Path testMappingsRootPath = Paths.get(testMappingsDir.getAbsolutePath()); stream = Files.walk(testMappingsRootPath, FileVisitOption.FOLLOW_LINKS); stream.filter(path -> path.getFileName().toString().equals(TEST_MAPPING)) .forEach( path -> getAllTests(allTests, path, testMappingsRootPath)); } catch (IOException e) { RuntimeException runtimeException = new RuntimeException( String.format( "IO error (%s) when reading tests from TEST_MAPPING files (%s)", e.getMessage(), testMappingsDir.getAbsolutePath()), e); throw runtimeException; } finally { if (stream != null) { stream.close(); } } return allTests; }

Target:
public static Map<String, Set<TestInfo>> getAllTests(File testMappingsDir) { Map<String, Set<TestInfo>> allTests = new HashMap<String, Set<TestInfo>>(); Stream<Path> stream = null; try { Path testMappingsRootPath = Paths.get(testMappingsDir.getAbsolutePath()); stream = Files.walk(testMappingsRootPath, FileVisitOption.FOLLOW_LINKS); stream.filter(path -> path.getFileName().toString().equals(TEST_MAPPING)) .forEach( path -> getAllTests(allTests, path, testMappingsRootPath)); } catch (IOException e) { throw new RuntimeException( String.format( "IO exception (%s) when reading tests from TEST_MAPPING files (%s)", e.getMessage(), testMappingsDir.getAbsolutePath()), e); } finally { if (stream != null) { stream.close(); } } return allTests; }
Source:
public void testEntrySetStreamRemove() { Map<Object, String> values = putValuesInCache(); final Cache<Object, Object> cache = cache(0, CACHE_NAME); cache.getAdvancedCache().addInterceptor(new BaseCustomInterceptor() { @Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { assertTrue(command.hasAnyFlag(FlagBitSets.SKIP_CACHE_STORE)); return super.visitRemoveCommand(ctx, command); } }, 0); Iterator<Map.Entry<Object, Object>> it = cache(0, CACHE_NAME).getAdvancedCache().withFlags( Flag.SKIP_CACHE_STORE) .entrySet() .stream() .iterator(); assertTrue(it.hasNext()); Map.Entry<Object, Object> entry = it.next(); Object key = entry.getKey(); assertEquals(values.get(key), entry.getValue()); Exceptions.expectException(UnsupportedOperationException.class, it::remove); }

Target:
public void testEntrySetStreamRemove() { Map<Object, String> values = putValuesInCache(); final AdvancedCache<Object, Object> cache = advancedCache(0, CACHE_NAME); cache.addInterceptor(new BaseCustomInterceptor() { @Override public Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command) throws Throwable { assertTrue(command.hasAnyFlag(FlagBitSets.SKIP_CACHE_STORE)); return super.visitRemoveCommand(ctx, command); } }, 0); Iterator<Map.Entry<Object, Object>> it = cache.withFlags(Flag.SKIP_CACHE_STORE) .entrySet() .stream() .iterator(); assertTrue(it.hasNext()); Map.Entry<Object, Object> entry = it.next(); Object key = entry.getKey(); assertEquals(values.get(key), entry.getValue()); Exceptions.expectException(UnsupportedOperationException.class, it::remove); }
Source:
private boolean navigate(WebElement dateBox, LocalDate date) throws ParseException { click(dateBox); LocalDate selectedDate = LocalDate.parse( dateBox.getAttribute("value"), DateTimeFormatter.ofPattern("EEE, dd MMM, yyyy")); String month = date.getMonth().getDisplayName(TextStyle.FULL, Locale.ENGLISH); String year = Integer.toString(date.getYear()); if (selectedDate.isAfter(date)) { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement previousButton = browser.driver.findElement(By.className("ui-datepicker-prev")); if (previousButton.getAttribute("class").contains("ui-state-disabled")) { return false; } click(previousButton); } } else { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement nextButton = browser.driver.findElement(By.className("ui-datepicker-next")); if (nextButton.getAttribute("class").contains("ui-state-disabled")) { return false; } click(nextButton); } } return true; }

Target:
private boolean navigate(WebElement dateBox, LocalDate date) throws ParseException { click(dateBox); LocalDate selectedDate = TimeHelper.parseLocalDateForSessionsForm(dateBox.getAttribute("value")); String month = date.getMonth().getDisplayName(TextStyle.FULL, Locale.ENGLISH); String year = Integer.toString(date.getYear()); if (selectedDate.isAfter(date)) { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement previousButton = browser.driver.findElement(By.className("ui-datepicker-prev")); if (previousButton.getAttribute("class").contains("ui-state-disabled")) { return false; } click(previousButton); } } else { while (!getDatepickerMonth().equals(month) || !getDatepickerYear().equals(year)) { WebElement nextButton = browser.driver.findElement(By.className("ui-datepicker-next")); if (nextButton.getAttribute("class").contains("ui-state-disabled")) { return false; } click(nextButton); } } return true; }
Source:
public GlowTravelAgent(World world) { if (world.getEnvironment() == World.Environment.THE_END) { throw new UnsupportedOperationException("Not supported yet."); } this.world = world; }

Target:
public GlowTravelAgent(World world) { if (world.getEnvironment() == World.Environment.THE_END) { throw new UnsupportedOperationException("End Portals are not supported yet."); } this.world = world; }
Source:
public void writeStringNoTag(final String value) throws IOException { try { final int lengthVarIntSize = computeRawVarint32Size(value.length()); if (lengthVarIntSize == computeRawVarint32Size(value.length() * 3 )) { int oldPosition = buffer.position(); buffer.position(oldPosition + lengthVarIntSize); encode(value, buffer); int newPosition = buffer.position(); buffer.position(oldPosition); writeRawVarint32(newPosition - oldPosition - lengthVarIntSize); buffer.position(newPosition); } else { writeRawVarint32(encodedLength(value)); encode(value, buffer); } } catch (BufferOverflowException e) { throw new OutOfSpaceException(buffer.position(), buffer.limit()); } }

Target:
public void writeStringNoTag(final String value) throws IOException { try { final int minLengthVarIntSize = computeRawVarint32Size(value.length()); final int maxLengthVarIntSize = computeRawVarint32Size(value.length() * MAX_UTF8_EXPANSION); if (minLengthVarIntSize == maxLengthVarIntSize) { int oldPosition = buffer.position(); buffer.position(oldPosition + minLengthVarIntSize); encode(value, buffer); int newPosition = buffer.position(); buffer.position(oldPosition); writeRawVarint32(newPosition - oldPosition - minLengthVarIntSize); buffer.position(newPosition); } else { writeRawVarint32(encodedLength(value)); encode(value, buffer); } } catch (BufferOverflowException e) { throw new OutOfSpaceException(buffer.position(), buffer.limit()); } }
Source:
public void testEdit() throws Throwable { final CountDownLatch completionLatch = new CountDownLatch(1); runTestOnUiThread(new Runnable() { @Override public void run() { doSave(completionLatch); } }); assertTrue(completionLatch.await(TASK_COMPLETION_TIMEOUT, TimeUnit.MILLISECONDS)); }

Target:
public void testEdit() throws Throwable { final TestLatch completionLatch = new TestLatch(1); InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { doSave(completionLatch); } }); assertThat(completionLatch.await(), is(true)); }
Source:
public FormValidation updateNow() throws IOException { List<JSONObject> jsonList = new ArrayList<>(); boolean toolInstallerMetadataExists = false; for (UpdateSite updatesite : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) { String site = updatesite.getMetadataUrlForDownloadable(url); if (site == null) { return FormValidation.warning("The update site " + updatesite + " does not look like an update center"); } String jsonString; try { jsonString = loadJSONHTML(new URL(site + ".html?id=" + URLEncoder.encode(getId(), "UTF-8") + "&version=" + URLEncoder.encode(Jenkins.VERSION, "UTF-8"))); toolInstallerMetadataExists = true; } catch (Exception e) { LOGGER.log(Level.FINE, "Could not load json from " + site, e ); continue; } JSONObject o = JSONObject.fromObject(jsonString); if (signatureCheck) { FormValidation e = updatesite.getJsonSignatureValidator(signatureValidatorPrefix +" '"+id+"'").verifySignature(o); if (e.kind!= Kind.OK) { LOGGER.log(Level.WARNING, "signature check failed for " + site, e ); continue; } } jsonList.add(o); } if (jsonList.size() == 0 && toolInstallerMetadataExists) { return FormValidation.warning("None of the tool installer metadata passed the signature check"); } else if (!toolInstallerMetadataExists) { LOGGER.log(Level.WARNING, "No tool installer metadata found for " + id); return FormValidation.ok(); } JSONObject reducedJson = reduce(jsonList); return load(reducedJson.toString(), System.currentTimeMillis()); }

Target:
public FormValidation updateNow() throws IOException { List<JSONObject> jsonList = new ArrayList<>(); boolean toolInstallerMetadataExists = false; for (UpdateSite updatesite : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) { String site = updatesite.getMetadataUrlForDownloadable(url); if (site == null) { return FormValidation.warning("The update site " + updatesite.getId() + " does not look like an update center"); } String jsonString; try { jsonString = loadJSONHTML(new URL(site + ".html?id=" + URLEncoder.encode(getId(), "UTF-8") + "&version=" + URLEncoder.encode(Jenkins.VERSION, "UTF-8"))); toolInstallerMetadataExists = true; } catch (Exception e) { LOGGER.log(Level.FINE, "Could not load json from " + site, e ); continue; } JSONObject o = JSONObject.fromObject(jsonString); if (signatureCheck) { FormValidation e = updatesite.getJsonSignatureValidator(signatureValidatorPrefix +" '"+id+"'").verifySignature(o); if (e.kind!= Kind.OK) { LOGGER.log(Level.WARNING, "signature check failed for " + site, e ); continue; } } jsonList.add(o); } if (jsonList.size() == 0 && toolInstallerMetadataExists) { return FormValidation.warning("None of the tool installer metadata passed the signature check"); } else if (!toolInstallerMetadataExists) { LOGGER.log(Level.WARNING, "No tool installer metadata found for " + id); return FormValidation.ok(); } JSONObject reducedJson = reduce(jsonList); return load(reducedJson.toString(), System.currentTimeMillis()); }
Source:
public boolean hasFullValuePrecision( IndexQuery... predicates ) { IndexReader instance = selector.select( instances, predicates ); if ( instance == null ) { assert predicates.length == 1 && predicates[0] instanceof IndexQuery.ExistsPredicate : "Unexpected selector result for predicates " + Arrays.toString( predicates ); return true; } return instance.hasFullValuePrecision( predicates ); }

Target:
public boolean hasFullValuePrecision( IndexQuery... predicates ) { IndexReader instance = selector.select( instances, predicates ); if ( instance == null ) { if ( !(predicates.length == 1 && predicates[0] instanceof ExistsPredicate) ) { throw new IllegalStateException( "Selected IndexReader null for predicates " + Arrays.toString( predicates ) ); } return true; } return instance.hasFullValuePrecision( predicates ); }
Source:
public int getSQLType(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) { return Types.OTHER; } Integer sqlType = _oidToSQLType.get(oid); if (sqlType != null) { return sqlType; } PgType pgType = fetchPgType(oid); if (pgType == null) { return Types.OTHER; } return pgType.sqlType(); }

Target:
public synchronized int getSQLType(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) { return Types.OTHER; } Integer sqlType = _oidToSQLType.get(oid); if (sqlType != null) { return sqlType; } PgType pgType = fetchPgType(oid); if (pgType == null) { return Types.OTHER; } return pgType.sqlType(); }
Source:
public boolean isSecretAnswer(User u, String answer) throws DAOException { if (answer == null || answer.equals("")) { return false; } LoginCredential credentials = getLoginCredential(u); String answerOnRecord = credentials.getSecretAnswer(); String hashedAnswer = Security.encodeString(answer + credentials.getSalt()); return (hashedAnswer.equals(answerOnRecord)); }

Target:
public boolean isSecretAnswer(User u, String answer) throws DAOException { if (answer == null || answer.equals("")) { return false; } LoginCredential credentials = getLoginCredential(u); String answerOnRecord = credentials.getSecretAnswer(); String hashedAnswer = Security.encodeString(answer.toLowerCase() + credentials.getSalt()); return (hashedAnswer.equals(answerOnRecord)); }
Source:
public InterpolatedNodalCurve withNode(double x, double y, ParameterMetadata paramMetadata) { throw new IllegalArgumentException("Not well-defined due to unspecified interpolator"); }

Target:
public ConstantNodalCurve withNode(double x, double y, ParameterMetadata paramMetadata) { ArgChecker.isTrue(x == xValue, "x should be equal to the existing x-value"); CurveMetadata md = metadata.withParameterMetadata(ImmutableList.of(paramMetadata)); return new ConstantNodalCurve(md, x, y); }
Source:
private static boolean coordinateInsideBoundary(int coordinate, long maxTileIndex) { return (coordinate >= 0 && coordinate <= maxTileIndex); }

Target:
private static boolean coordinateInsideBoundary(int coordinate, long maxTileIndex) { return coordinate >= 0 && coordinate <= maxTileIndex; }
Source:
public void run() { ISarosSession session = sessionManager.getSession(); JID jid = getSelectedJID(); if (session != null || jid == null) { return; } if (!discoveryManager.isFeatureSupported(jid, SarosConstants.NAMESPACE_SERVER)) { return; } transmitter.sendPacketExtension( jid, JoinSessionRequestExtension.PROVIDER.create(new JoinSessionRequestExtension())); }

Target:
public void run() { ISarosSession session = sessionManager.getSession(); JID jid = getSelectedJID(); if (session != null || jid == null) { return; } transmitter.sendPacketExtension( jid, JoinSessionRequestExtension.PROVIDER.create(new JoinSessionRequestExtension())); }
Source:
private DataTableType createDataTableType(Method method) { Class returnType = TypeResolver.resolveRawArguments(DataTableDefinitionBody.class, body.getClass())[0]; Type[] parameterTypes = method.getGenericParameterTypes(); Type parameterType = parameterTypes[0]; if (Map.class.equals(parameterType)) { return new DataTableType( returnType, (TableEntryTransformer<Object>) this::execute ); } else { return new DataTableType( returnType, (TableTransformer<Object>) this::execute ); } }

Target:
private DataTableType createDataTableType(Method method) { Class returnType = TypeResolver.resolveRawArguments(DataTableEntryDefinitionBody.class, body.getClass())[0]; Type[] parameterTypes = method.getGenericParameterTypes(); Type parameterType = parameterTypes[0]; if (DataTable.class.equals(parameterType)) { return new DataTableType( returnType, (TableTransformer<Object>) this::execute); } if (List.class.equals(parameterType)) { return new DataTableType(returnType, (TableRowTransformer<Object>) this::execute); } if (Map.class.equals(parameterType)) { return new DataTableType(returnType, (TableEntryTransformer<Object>) this::execute); } if (String.class.equals(parameterType)) { return new DataTableType(returnType, (TableCellTransformer<Object>) this::execute); } return new DataTableType(returnType, (TableTransformer<Object>) this::execute); }
Source:
public String toString() { return Objects.toStringHelper(CreateJobResponse.class) .add("status", status) .add("errors", errors) .add("id", id) .toString(); }

Target:
public String toString() { return Objects.toStringHelper(getClass()) .add("status", status) .add("errors", errors) .add("id", id) .toString(); }
Source:
private boolean isPublisherAheadByMax() { boolean ahead = false; if (backPressureEnabled) { int blocks = MAX_COUNT_OF_INMEM_BLOCKS + 1; synchronized (DataList.this) { for (Block curr = this; !ahead && (curr != null); curr = curr.next) { ahead = (--blocks <= 0); } } } return ahead; }

Target:
private boolean isPublisherAheadByMax() { boolean ahead = false; if (backPressureEnabled) { int blocks = MAX_COUNT_OF_INMEM_BLOCKS; synchronized (DataList.this) { Block curr = this.next; while ((curr != null) && (curr.refCount.get() == 0)) { curr = curr.next; } while (!ahead && (curr != null)) { ahead = (--blocks == 0); curr = curr.next; } } } return ahead; }
Source:
public void prepareRun(BatchSourceContext context) throws Exception { Job job = context.getHadoopJob(); Configuration conf = job.getConfiguration(); ConfigHelper.setInputColumnFamily(conf, config.keyspace, config.columnFamily); ConfigHelper.setInputInitialAddress(conf, config.initialAddress); ConfigHelper.setInputPartitioner(conf, config.partitioner); ConfigHelper.setInputRpcPort(conf, config.port); Preconditions.checkArgument(!(Strings.isNullOrEmpty(config.username) ^ Strings.isNullOrEmpty(config.password)), "You must either set both username and password or neither username or password. " + "Currently, they are username: " + config.username + " and password: " + config.password); if (!Strings.isNullOrEmpty(config.username)) { ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, config.username, config.password); } if (!Strings.isNullOrEmpty(config.properties)) { for (String pair : config.properties.split(",")) { conf.set(pair.split(":")[0], pair.split(":")[1]); } } CqlConfigHelper.setInputCql(conf, config.query); job.setInputFormatClass(CqlInputFormat.class); }

Target:
public void prepareRun(BatchSourceContext context) throws Exception { Job job = context.getHadoopJob(); Configuration conf = job.getConfiguration(); ConfigHelper.setInputColumnFamily(conf, config.keyspace, config.columnFamily); ConfigHelper.setInputInitialAddress(conf, config.initialAddress); ConfigHelper.setInputPartitioner(conf, config.partitioner); ConfigHelper.setInputRpcPort(conf, config.port); Preconditions.checkArgument(!(Strings.isNullOrEmpty(config.username) ^ Strings.isNullOrEmpty(config.password)), "You must either set both username and password or neither username nor password. " + "Currently, they are username: " + config.username + " and password: " + config.password); if (!Strings.isNullOrEmpty(config.username)) { ConfigHelper.setInputKeyspaceUserNameAndPassword(conf, config.username, config.password); } if (!Strings.isNullOrEmpty(config.properties)) { for (String pair : config.properties.split(",")) { conf.set(pair.split(":")[0], pair.split(":")[1]); } } CqlConfigHelper.setInputCql(conf, config.query); job.setInputFormatClass(CqlInputFormat.class); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manage_appointment_blocks); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { getSupportActionBar().setElevation(0); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } ManageAppointmentBlocksFragment manageAppointmentBlocksFragment = (ManageAppointmentBlocksFragment) getSupportFragmentManager().findFragmentById(R.id.manageAppointmentBlocksContentFrame); if (manageAppointmentBlocksFragment == null) { manageAppointmentBlocksFragment = ManageAppointmentBlocksFragment.newInstance(); } if (!manageAppointmentBlocksFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), manageAppointmentBlocksFragment, R.id.manageAppointmentBlocksContentFrame); } mPresenter = new ManageAppointmentBlocksPresenter(manageAppointmentBlocksFragment); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manage_appointment_blocks); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } ManageAppointmentBlocksFragment manageAppointmentBlocksFragment = (ManageAppointmentBlocksFragment) getSupportFragmentManager().findFragmentById(R.id.manageAppointmentBlocksContentFrame); if (manageAppointmentBlocksFragment == null) { manageAppointmentBlocksFragment = ManageAppointmentBlocksFragment.newInstance(); } if (!manageAppointmentBlocksFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), manageAppointmentBlocksFragment, R.id.manageAppointmentBlocksContentFrame); } mPresenter = new ManageAppointmentBlocksPresenter(manageAppointmentBlocksFragment); }
Source:
default <T> @Nullable T getFieldValue(@NonNull Class<T> type, @NonNull String @NonNull ... fieldName) { ITmfEventField field = getField(fieldName); if (field == null) { return null; } Object value = field.getValue(); if (value == null) { return null; } if (type.isAssignableFrom(value.getClass())) { @SuppressWarnings("unchecked") T ret = (T) value; return ret; } String strVal = String.valueOf(value); if (type.equals(String.class)) { @SuppressWarnings("unchecked") T ret = (T) strVal; return ret; } if (type.equals(Long.class)) { Long longVal = Longs.tryParse(strVal); if (longVal != null) { @SuppressWarnings("unchecked") T ret = (T) longVal; return ret; } return null; } if (type.equals(Integer.class)) { Integer intVal = Ints.tryParse(strVal); if (intVal != null) { @SuppressWarnings("unchecked") T ret = (T) intVal; return ret; } return null; } return null; }

Target:
default <T> @Nullable T getFieldValue(@NonNull Class<T> type, @NonNull String @NonNull ... fieldName) { ITmfEventField field = getField(fieldName); if (field == null) { return null; } Object value = field.getValue(); if (value == null) { return null; } if (type.isAssignableFrom(value.getClass())) { @SuppressWarnings("unchecked") T ret = (T) value; return ret; } if (type.equals(String.class)) { @SuppressWarnings("unchecked") T ret = (T) String.valueOf(value); return ret; } if (type.equals(Long.class)) { if (Number.class.isAssignableFrom(value.getClass())) { @SuppressWarnings("unchecked") T ret = (T) ((Long) ((Number) value).longValue()); return ret; } Long longVal = Longs.tryParse(String.valueOf(value)); if (longVal != null) { @SuppressWarnings("unchecked") T ret = (T) longVal; return ret; } return null; } if (type.equals(Integer.class)) { if (Number.class.isAssignableFrom(value.getClass())) { @SuppressWarnings("unchecked") T ret = (T) ((Integer) ((Number) value).intValue()); return ret; } Integer intVal = Ints.tryParse(String.valueOf(value)); if (intVal != null) { @SuppressWarnings("unchecked") T ret = (T) intVal; return ret; } return null; } if (type.equals(Double.class)) { if (Number.class.isAssignableFrom(value.getClass())) { @SuppressWarnings("unchecked") T ret = (T) ((Double) ((Number) value).doubleValue()); return ret; } Double dblVal = Doubles.tryParse(String.valueOf(value)); if (dblVal != null) { @SuppressWarnings("unchecked") T ret = (T) dblVal; return ret; } return null; } return null; }
Source:
public void syncPostBatch(final String topicId, final List<BatchItem> batchItems) throws EventPublishingException { final Producer<String, String> producer = kafkaFactory.takeProducer(); try { final Map<String, String> partitionToBroker = producer.partitionsFor(topicId).stream() .collect(Collectors.toMap(p -> String.valueOf(p.partition()),p -> String.valueOf(p.leader().id()))); batchItems.forEach(item -> { Preconditions.checkNotNull( item.getPartition(), "BatchItem partition can't be null at the moment of publishing!"); item.setBrokerId(partitionToBroker.get(item.getPartition())); item.setTopic(topicId); }); final List<ProducerSendCommand.NakadiCallback> callbacks = batchItems.stream() .peek(item -> item.setStep(EventPublishingStep.PUBLISHING)) .map(item -> new ProducerSendCommand(producer, item).execute()) .filter(Objects::nonNull) .collect(Collectors.toList()); waitCallbacksCompleted(producer, callbacks, createSendTimeout()); for (final BatchItem batchItem: batchItems) { if (batchItem.getResponse().getPublishingStatus() == EventPublishingStatus.FAILED) throw new EventPublishingException("Error publishing message to kafka"); } } finally { kafkaFactory.releaseProducer(producer); } }

Target:
public void syncPostBatch(final String topicId, final List<BatchItem> batchItems) throws EventPublishingException { final Producer<String, String> producer = kafkaFactory.takeProducer(); try { final Map<String, String> partitionToBroker = producer.partitionsFor(topicId).stream() .collect(Collectors.toMap(p -> String.valueOf(p.partition()),p -> String.valueOf(p.leader().id()))); batchItems.forEach(item -> { Preconditions.checkNotNull( item.getPartition(), "BatchItem partition can't be null at the moment of publishing!"); item.setBrokerId(partitionToBroker.get(item.getPartition())); item.setTopic(topicId); }); final List<ProducerSendCommand.NakadiCallback> callbacks = batchItems.stream() .peek(item -> item.setStep(EventPublishingStep.PUBLISHING)) .map(item -> new ProducerSendCommand(producer, item).execute()) .filter(Objects::nonNull) .collect(Collectors.toList()); waitCallbacksCompleted(producer, callbacks, createSendTimeout()); for (final BatchItem batchItem: batchItems) { if (batchItem.getResponse().getPublishingStatus() == EventPublishingStatus.FAILED) throw new EventPublishingException("Error publishing message to kafka"); } } catch (final HystrixRuntimeException hre) { LOG.debug("Failed to send bacth to kafka due to {}", hre.getFailureType(), hre); throw new EventPublishingException("Error publishing message to kafka", hre); } finally { kafkaFactory.releaseProducer(producer); } }
Source:
public boolean exists() { OverriddenBooleanValue overriden = null; if ( decorator != null ) { overriden = decorator.decorateExists( this, new EventMetadata( ) ); } if ( ( overriden != null ) && overriden.overrides() ) { return overriden.getResult(); } else { return provider.exists( resource ); } }

Target:
public boolean exists() { return exists( new EventMetadata() ); }
Source:
public void testFLTEquivalence() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { TmfTimestampTransformLinear precise = new TmfTimestampTransformLinear(Math.PI, 0); TmfTimestampTransformLinearFast fast = new TmfTimestampTransformLinearFast(Math.PI, 0); Field field = fast.getClass().getDeclaredField("fDeltaMax"); field.setAccessible(true); long deltaMax = field.getLong(fast); long start = (ts - (ts % deltaMax) - 10); checkTime(precise, fast, 20, start, 1); }

Target:
public void testFLTEquivalence() throws SecurityException, IllegalArgumentException { TmfTimestampTransformLinearFast fast = new TmfTimestampTransformLinearFast(Math.PI, 0); TmfTimestampTransformLinearFast fast2 = new TmfTimestampTransformLinearFast(Math.PI, 0); long deltaMax = getPrivateFieldLong(fast, "fDeltaMax"); long start = (ts - (ts % deltaMax) - 10); checkTime(fast, fast2, 20, start, 1); }
Source:
public void testDeleteAsyncQuery() { ArgumentCaptor<FilterExpression> filterCaptor = ArgumentCaptor.forClass(FilterExpression.class); cleanerThread.deleteAsyncQuery(); verify(asyncQueryDao, times(1)).deleteAsyncQueryAndResultCollection(filterCaptor.capture()); Long date = System.currentTimeMillis() - (cleanerThread.getQueryCleanupDays() * 24 * 3600 * 1000); assertEquals("asyncQuery.createdOn LE [" + new Date(date) + "]", filterCaptor.getValue().toString()); }

Target:
public void testDeleteAsyncQuery() { when(dateUtil.calculateFilterDate(Calendar.DATE, cleanerThread.getQueryCleanupDays())).thenReturn(testDate); ArgumentCaptor<FilterExpression> filterCaptor = ArgumentCaptor.forClass(FilterExpression.class); cleanerThread.deleteAsyncQuery(); verify(asyncQueryDao, times(1)).deleteAsyncQueryAndResultCollection(filterCaptor.capture()); assertEquals("asyncQuery.createdOn LE [" + testDate + "]", filterCaptor.getValue().toString()); }
Source:
private Tumor getTumor(JSONObject jsonObject, String oncoTreeCode){ Tumor tumor = new Tumor(); if (jsonObject.containsKey(oncoTreeCode)){ JSONObject tumorObj = (JSONObject)jsonObject.get(oncoTreeCode); tumor.setNciCode((String)tumorObj.get("nciCode")); tumor.setNciMainType((String)tumorObj.get("nciMainType")); tumor.setTumorName((String)tumorObj.get("tumorName")); JSONArray trialsArr = (JSONArray)tumorObj.get("trials"); Trial[] trials = getTrials(trialsArr); tumor.setTrials(trials); } return tumor; }

Target:
private Tumor getTumor(JSONObject jsonObject, String oncoTreeCode){ Tumor tumor = new Tumor(); if (jsonObject.containsKey(oncoTreeCode)){ JSONObject tumorObj = (JSONObject)jsonObject.get(oncoTreeCode); Gson gson = new Gson(); tumor = gson.fromJson(tumorObj.toString(), Tumor.class); } return tumor; }
Source:
protected Bitmap getBitmapFromResourceId(int resourceId) { return BitmapFactory.decodeResource(context.getResources(), resourceId); }

Target:
Bitmap getBitmapFromResourceId(int resourceId) { return BitmapFactory.decodeResource(mContext.getResources(), resourceId); }
Source:
public void onSetDead(CallbackInfo ci) { net.minecraft.entity.Entity mcEntity = (net.minecraft.entity.Entity) (Object) this; if (!this.world.isRemote && (!(mcEntity instanceof EntityLivingBase) || (mcEntity instanceof EntityArmorStand))) { IMixinWorldServer spongeWorld = (IMixinWorldServer) this.world; final CauseTracker causeTracker = spongeWorld.getCauseTracker(); PhaseData phaseData = causeTracker.getCurrentPhaseData(); Cause.Builder causeBuilder = Cause.builder(); Optional<Object> sourceOptional = phaseData.context.getSource(Object.class); sourceOptional.ifPresent(source -> { causeBuilder.named(NamedCause.source(source)); if (source instanceof Projectile) { ProjectileSource projectileSource = ((Projectile) source).getShooter(); causeBuilder.named(NamedCause.of(NamedCause.THROWER, projectileSource)); } }); Optional<ItemStack> usedItemOptional = phaseData.context.firstNamed("ItemUsed", ItemStack.class); usedItemOptional.ifPresent(item -> causeBuilder.named(NamedCause.of("ItemUsed", item))); phaseData.context.getOwner().ifPresent(owner -> causeBuilder.named(NamedCause.owner(owner))); this.destructCause = causeBuilder.build(); } }

Target:
private void onSetDead(CallbackInfo ci) { if (ShouldFire.DESTRUCT_ENTITY_EVENT && !((IMixinWorld) this.world).isFake() && !(EntityUtil.toNative(this) instanceof EntityLiving)) { MessageChannel originalChannel = MessageChannel.TO_NONE; try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { DestructEntityEvent event = SpongeEventFactory.createDestructEntityEvent( frame.getCurrentCause(), originalChannel, Optional.of(originalChannel), new MessageEvent.MessageFormatter(), this, true ); this.destructEvent = event; } } }
Source:
public static int getTcpBacklog(int tcpBacklog) { return AccessController.doPrivileged(new PrivilegedAction<Integer>() { @Override public Integer run() { int somaxconn = tcpBacklog; File file = new File(TCP_BACKLOG_SETTING_LOCATION); BufferedReader in = null; try { if (file.exists()) { in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); somaxconn = Integer.parseInt(in.readLine()); } } catch (SecurityException | IOException | NumberFormatException e) { } finally { if (in != null) { try { in.close(); } catch (Exception e) { } } } return somaxconn; } }); }

Target:
public static int getTcpBacklog(int tcpBacklog) { return AccessController.doPrivileged(new PrivilegedAction<Integer>() { @Override public Integer run() { int somaxconn = tcpBacklog; try { String setting = Files.toString(new File(TCP_BACKLOG_SETTING_LOCATION), Charsets.UTF_8); somaxconn = Integer.parseInt(setting.trim()); } catch (SecurityException | IOException | NumberFormatException | NullPointerException e) { } finally { return somaxconn; } } }); }
Source:
protected void init() throws IOException { _selector = Selector.open(); try { _clientConnection = SocketChannel.open(); LOGGER.info("Connecting to " + _host + ":" + _port); final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); _clientConnection.connect(peerAddr); Thread.sleep(3600000); } catch (final IOException e) { _selector.close(); throw e; } catch (InterruptedException e) { LOGGER.debug(e.getMessage()); } }

Target:
protected void init() throws IOException { _selector = Selector.open(); try { _clientConnection = SocketChannel.open(); LOGGER.info("Connecting to " + _host + ":" + _port); final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); _clientConnection.connect(peerAddr); Thread.sleep(Long.MAX_VALUE); } catch (final IOException e) { _selector.close(); throw e; } catch (InterruptedException e) { LOGGER.debug(e.getMessage()); } }
Source:
@NonNull public static AppContentProviderEndpoint of(@NonNull Uri uri) { int code = URI_TO_CODE.match(uri); if (code == -1) { throw new IllegalArgumentException("uri=" + uri); } return of(code); }

Target:
@NonNull public static AppContentProviderEndpoint of(@NonNull Uri uri) { int code = URI_TO_CODE.match(uri); if (code == UriMatcher.NO_MATCH) { throw new IllegalArgumentException("uri=" + uri); } return of(code); }
Source:
public void setUp() throws Exception { junitPlayer = PlayerBuilder.create("JUnit").defaultValues().get(); instance = new GameService(new ClientProperties(), fafService, forgedAllianceService, mapService, preferencesService, gameUpdater, notificationService, i18n, executor, playerService, reportingService, eventBus, iceAdapter, modService, platformService, discordRichPresenceService, replayService); Preferences preferences = new Preferences(); when(preferencesService.getPreferences()).thenReturn(preferences); when(fafService.connectionStateProperty()).thenReturn(new SimpleObjectProperty<>()); when(replayService.start(anyInt(), any())).thenReturn(completedFuture(LOCAL_REPLAY_PORT)); when(iceAdapter.start()).thenReturn(completedFuture(GPG_PORT)); when(playerService.getCurrentPlayer()).thenReturn(Optional.of(junitPlayer)); doAnswer(invocation -> { try { ((Runnable) invocation.getArgument(0)).run(); } catch (Exception e) { e.printStackTrace(); } return null; }).when(executor).execute(any()); instance.afterPropertiesSet(); verify(fafService).addOnMessageListener(eq(GameInfoMessage.class), gameInfoMessageListenerCaptor.capture()); }

Target:
public void setUp() throws Exception { junitPlayer = PlayerBuilder.create("JUnit").defaultValues().get(); ClientProperties clientProperties = new ClientProperties(); instance = new GameService(clientProperties, fafService, forgedAllianceService, mapService, preferencesService, gameUpdater, notificationService, i18n, executor, playerService, reportingService, eventBus, iceAdapter, modService, platformService, discordRichPresenceService, replayService); Preferences preferences = new Preferences(); when(preferencesService.getPreferences()).thenReturn(preferences); when(fafService.connectionStateProperty()).thenReturn(new SimpleObjectProperty<>()); when(replayService.start(anyInt(), any())).thenReturn(completedFuture(LOCAL_REPLAY_PORT)); when(iceAdapter.start()).thenReturn(completedFuture(GPG_PORT)); when(playerService.getCurrentPlayer()).thenReturn(Optional.of(junitPlayer)); doAnswer(invocation -> { try { ((Runnable) invocation.getArgument(0)).run(); } catch (Exception e) { e.printStackTrace(); } return null; }).when(executor).execute(any()); instance.afterPropertiesSet(); verify(fafService).addOnMessageListener(eq(GameInfoMessage.class), gameInfoMessageListenerCaptor.capture()); }
Source:
public void shouldTimeout() { try { webTestClient.get() .uri("/timeout/{timeout}", 3) .exchange(); Assert.fail(); } catch (ReadTimeoutException ignore) { } }

Target:
public void shouldTimeout() { exception.expect(ReadTimeoutException.class); webTestClient.get() .uri("/timeout/{timeout}", 3) .exchange(); }
Source:
public void testCardinalityManyColumns() { long blockSize = 254; long uniqueElts = 1000 * blockSize; String projection = getCardinalityProjection(getUniqueElements((int) blockSize, uniqueElts)); double error = uniqueElts * 0.05; functionAssertions.assertFunctionWithError(projection, BIGINT, uniqueElts, error); }

Target:
public void testCardinalityManyColumns() { int blockSize = 254; long uniqueElements = 1000 * blockSize; double error = uniqueElements * 0.05; String projection = getCardinalityProjection(getUniqueElements(blockSize, uniqueElements)); functionAssertions.assertFunctionWithError(projection, BIGINT, uniqueElements, error); }
Source:
private static File[] splitDexPath(String path) { List<File> result = splitPaths(path, null, false); return result.toArray(new File[result.size()]); }

Target:
private static List<File> splitDexPath(String path) { return splitPaths(path, null, false); }
Source:
private void endTransaction(BinlogEventV4 e) { LOG.info("Ending transaction " + _scn); if (_eventsInTransaction.size() > 0) { DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.setPartition(0); String checkpoint = MysqlCheckpoint.createCheckpointString(_sourceId, _scn, _currFileName, _mostRecentSeenEventPosition); builder.setSourceCheckpoint(checkpoint); _eventsInTransaction.forEach(builder::addEvent); Optional<Long> eventTimestamp = Optional.ofNullable(_eventsInTransaction.get(0)) .map(firstEvent -> firstEvent.metadata) .map(metadata -> metadata.get(DatastreamEventMetadata.EVENT_TIMESTAMP)) .map(metaVal -> Long.valueOf(metaVal.toString())); if (eventTimestamp.isPresent()) { builder.setEventsTimestamp(eventTimestamp.get()); } else { String errorMsg = "Datastream event " + _eventsInTransaction.get(0).toString() + " was missing event timestamp metadata."; LOG.error(errorMsg); throw new IllegalStateException(errorMsg); } _producer.send(builder.build(), (metadata, exception) -> { if (exception == null) { LOG.debug(String.format("Sending event succeeded, metadata:{%s}", metadata)); } else { LOG.error(String.format("Sending event failed, metadata:{%s}", metadata), exception); } }); } resetTransactionData(); }

Target:
private void endTransaction(BinlogEventV4 e) { LOG.info("Ending transaction " + _scn); if (_eventsInTransaction.size() > 0) { DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.setPartition(0); String checkpoint = MysqlCheckpoint.createCheckpointString(_sourceId, _scn, _currFileName, _mostRecentSeenEventPosition); builder.setSourceCheckpoint(checkpoint); _eventsInTransaction.forEach(builder::addEvent); Optional<Long> eventTimestamp = Optional.ofNullable(_eventsInTransaction.get(0)) .map(firstEvent -> firstEvent.metadata) .map(metadata -> metadata.get(DatastreamEventMetadata.EVENT_TIMESTAMP)) .map(metaVal -> Long.valueOf(metaVal.toString())); if (eventTimestamp.isPresent()) { builder.setEventsTimestamp(eventTimestamp.get()); } else { String errorMsg = "Datastream event " + _eventsInTransaction.get(0).toString() + " was missing event timestamp metadata."; LOG.error(errorMsg); throw new DatastreamRuntimeException(errorMsg); } _producer.send(builder.build(), (metadata, exception) -> { if (exception == null) { LOG.debug(String.format("Sending event succeeded, metadata:{%s}", metadata)); } else { LOG.error(String.format("Sending event failed, metadata:{%s}", metadata), exception); } }); } resetTransactionData(); }
Source:
protected void resetSnapshotIndex(RaftMemberContext member, AppendResponse response) { final long snapshotIndex = response.lastSnapshotIndex(); if (member.getSnapshotIndex() != snapshotIndex) { member.setSnapshotIndex(snapshotIndex); log.trace("Reset snapshot index for to {}", member, snapshotIndex); } }

Target:
protected void resetSnapshotIndex(RaftMemberContext member, AppendResponse response) { final long snapshotIndex = response.lastSnapshotIndex(); if (member.getSnapshotIndex() != snapshotIndex) { member.setSnapshotIndex(snapshotIndex); log.warn("Reset snapshot index for to {}", member, snapshotIndex); } }
Source:
public void testFlashBrick() { checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.brick_flash); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_flash_spinner, brickPosition, R.string.brick_flash_on); onView(withId(R.id.brick_flash_spinner)).perform(click()); onView(withText(R.string.brick_flash_off)).perform(click()); onView(withText(R.string.brick_flash_off)).check(matches(isDisplayed())); onView(withId(R.id.brick_flash_spinner)).perform(click()); onView(withText(R.string.brick_flash_on)).perform(click()); onView(withText(R.string.brick_flash_on)).check(matches(isDisplayed())); }

Target:
public void testFlashBrick() { checkIfBrickAtPositionShowsString(0, R.string.brick_when_started); checkIfBrickAtPositionShowsString(brickPosition, R.string.brick_flash); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_flash_spinner, brickPosition, R.string.brick_flash_on); clickSelectCheckSpinnerValueOnBrick(R.id.brick_flash_spinner, brickPosition, R.string .brick_flash_off); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_flash_spinner, brickPosition, R.string.brick_flash_off); clickSelectCheckSpinnerValueOnBrick(R.id.brick_flash_spinner, brickPosition, R.string .brick_flash_on); checkIfSpinnerOnBrickAtPositionShowsString(R.id.brick_flash_spinner, brickPosition, R.string.brick_flash_on); }