auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void performTableModification(CommandCall commandCall) { Table table = new Table(commandCall.getElement()); Map<Integer, CommandCall> headerCommands = populateCommandCallByColumnMap(table, commandCall); Row headerRow = table.getLastHeaderRow(); for (Row row : table.getDetailRows()) { CommandCall rowCommand = duplicateCommandForDifferentElement(commandCall, row.getElement()); rowCommand.setParent(commandCall); for (int cellCount = 0; cellCount < row.getCells().length; cellCount++) { CommandCall headerCall = headerCommands.get(cellCount); if (headerCall != null) { Element cellElement = row.getCells()[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.setParent(rowCommand); } } } for (CommandCall headerCommand : headerCommands.values()) { headerCommand.setParent(null); } }

Target:
private void performTableModification(CommandCall commandCall) { Table table = new Table(commandCall.getElement()); Map<Integer, CommandCall> headerCommands = populateCommandCallByColumnMap(table, commandCall); Row[] detailRows = table.getDetailRows(); for (int i = 0; i < detailRows.length; i++) { Row row = detailRows[i]; Element[] cells = row.getCells(); if (cells.length != table.getLastHeaderRow().getCells().length) { throw new RuntimeException("The <table> 'execute' command only supports rows with an equal number of columns. Detail row " + (i + 1) + " has a different number of columns to the last header row"); } CommandCall rowCommand = duplicateCommandForDifferentElement(commandCall, row.getElement()); rowCommand.transferToParent(commandCall); for (int cellCount = 0; cellCount < cells.length; cellCount++) { CommandCall headerCall = headerCommands.get(cellCount); if (headerCall != null) { Element cellElement = cells[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.transferToParent(rowCommand); } } } for (CommandCall headerCommand : headerCommands.values()) { headerCommand.transferToParent(null); } }
Source:
private Path addArtifactsToJar(Path artifactsLocation) throws Exception { Path jarFile = Paths.get(stormJarLocation); if (artifactsLocation.toFile().isDirectory()) { File[] artifacts = artifactsLocation.toFile().listFiles(); if (artifacts.length > 0) { Path newJar = Files.copy(jarFile, artifactsLocation.resolve(jarFile.getFileName())); for (File artifact : artifacts) { executeShellProcess( ImmutableList.of(javaJarCommand, "uf", newJar.toString(), "-C", artifactsLocation.toString(), artifact.getName())); LOG.debug("Added file to jar {}", artifact, jarFile); } return newJar; } } return jarFile; }

Target:
private Path addArtifactsToJar(Path artifactsLocation) throws Exception { Path jarFile = Paths.get(stormJarLocation); if (artifactsLocation.toFile().isDirectory()) { File[] artifacts = artifactsLocation.toFile().listFiles(); if (artifacts.length > 0) { Path newJar = Files.copy(jarFile, artifactsLocation.resolve(jarFile.getFileName())); for (File artifact : artifacts) { executeShellProcess( ImmutableList.of(javaJarCommand, "uf", newJar.toString(), "-C", artifactsLocation.toString(), artifact.getName())); LOG.debug("Added file to jar {}", artifact, jarFile); } return newJar; } } else { LOG.debug("Artifacts directory does not exist, not adding any artifacts to jar", artifactsLocation); } return jarFile; }
Source:
public Annotation(String chromosome, int start, int end, String vepVersion, String vepCacheVersion, Set<? extends IXref> xrefs, Set<? extends IConsequenceType> consequenceTypes) { this.chromosome = chromosome; this.start = start; this.end = end; this.vepVersion = vepVersion; this.vepCacheVersion = vepCacheVersion; this.xrefs = new HashSet<>(); if (xrefs != null) { xrefs.stream().forEach(xref -> this.xrefs.add(new Xref(xref))); } this.consequenceTypes = new HashSet<>(); if (consequenceTypes != null) { consequenceTypes.stream() .forEach(consequence -> this.consequenceTypes.add(new ConsequenceType(consequence))); } }

Target:
public Annotation(String chromosome, int start, int end, String vepVersion, String vepCacheVersion, Set<? extends IXref> xrefs, Set<? extends IConsequenceType> consequenceTypes) { this.chromosome = chromosome; this.start = start; this.end = end; this.vepVersion = vepVersion; this.vepCacheVersion = vepCacheVersion; this.xrefs = new HashSet<>(); if (xrefs != null) { xrefs.forEach(xref -> this.xrefs.add(new Xref(xref))); } this.consequenceTypes = new HashSet<>(); if (consequenceTypes != null) { consequenceTypes.forEach(consequence -> this.consequenceTypes.add(new ConsequenceType(consequence))); } }
Source:
protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConditionalExpr(@NotNull GoConditionalExpr o) { if (o.getEq() == null) { return; } if (o.getLeft() instanceof GoIndexOrSliceExpr && o.getRight() instanceof GoStringLiteral) { GoIndexOrSliceExpr left = (GoIndexOrSliceExpr)o.getLeft(); GoStringLiteral right = (GoStringLiteral)o.getRight(); checkTypeMismatch(o, holder, left, right, STRING_INDEX_IS_BYTE_QUICK_FIX); } else if (o.getLeft() instanceof GoStringLiteral && o.getRight() instanceof GoIndexOrSliceExpr) { GoIndexOrSliceExpr right = (GoIndexOrSliceExpr)o.getRight(); GoStringLiteral left = (GoStringLiteral)o.getLeft(); checkTypeMismatch(o, holder, right, left, STRING_INDEX_IS_BYTE_QUICK_FIX); } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConditionalExpr(@NotNull GoConditionalExpr o) { GoExpression left = o.getLeft(); GoExpression right = o.getRight(); GoIndexOrSliceExpr indexExpr = getFirstElementOfType(GoIndexOrSliceExpr.class, left, right); GoStringLiteral stringLiteral = getFirstElementOfType(GoStringLiteral.class, left, right); if (indexExpr == null || stringLiteral == null) { return; } if (isStringIndexExpression(indexExpr)) { LocalQuickFix[] fixes = isSingleCharLiteral(stringLiteral) ? new LocalQuickFix[]{STRING_INDEX_IS_BYTE_QUICK_FIX} : LocalQuickFix.EMPTY_ARRAY; holder.registerProblem(o, TEXT_HINT, ProblemHighlightType.GENERIC_ERROR, fixes); } } }; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); blockDrawerFromOpening(); switch (field.getFieldType()) { case SELECT: { final String screenName; final DataType dataType = field.getDataType(); if (dataType == COUNTRY) { screenName = Analytics.Screens.PROFILE_CHOOSE_LOCATION; } else if (dataType == LANGUAGE) { screenName = Analytics.Screens.PROFILE_CHOOSE_LANGUAGE; } else { screenName = Analytics.Screens.PROFILE_CHOOSE_BIRTH_YEAR; } environment.getAnalyticsRegistry().trackScreenView(screenName); break; } case TEXTAREA: { environment.getAnalyticsRegistry().trackScreenView(Analytics.Screens.PROFILE_EDIT_TEXT_VALUE); break; } } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); blockDrawerFromOpening(); fireScreenEvent(); }
Source:
public void serialize(GeometryState state, BlockBuilder out) { if (state.getGeometry() == null) { out.appendNull(); } else { GeometryType.GEOMETRY.writeSlice(out, GeometrySerde.serialize(state.getGeometry())); } }

Target:
public void serialize(GeometryState state, BlockBuilder out) { if (state.getGeometry() == null) { out.appendNull(); } else { GEOMETRY.writeSlice(out, GeometrySerde.serialize(state.getGeometry())); } }
Source:
private static boolean isUnnecessaryLambdaCast(Type childType, Type parentType) { if (parentType.is(childType.fullyQualifiedName())) { return true; } List<MethodJavaSymbol> childMethods = getMethodSymbolsOf(childType).collect(Collectors.toList()); return childMethods.isEmpty() || (childMethods.size() == 1 && isSingleAbstractMethodOverride(childMethods.get(0), parentType)); }

Target:
private static boolean isUnnecessaryLambdaCast(Type childType, Type parentType) { if (parentType.isSubtypeOf(childType)) { return true; } List<MethodJavaSymbol> childMethods = getMethodSymbolsOf(childType).collect(Collectors.toList()); return childMethods.isEmpty() || (childMethods.size() == 1 && isSingleAbstractMethodOverride(childMethods.get(0), parentType)); }
Source:
void getFileDirectoriesWithEmptyDbParent() { BibDatabaseContext database = new BibDatabaseContext(); database.setDatabasePath(Paths.get("biblio.bib")); assertEquals(Collections.singletonList(currentWorkingDir), database.getFileDirectoriesAsPaths(fileDirPrefs)); }

Target:
void getFileDirectoriesWithEmptyDbParent() { BibDatabaseContext database = new BibDatabaseContext(); database.setDatabasePath(Path.of("biblio.bib")); assertEquals(Collections.singletonList(currentWorkingDir), database.getFileDirectoriesAsPaths(fileDirPrefs)); }
Source:
public TransportMode getTransportMode() { if (HTTPCommandResult.class.isAssignableFrom(this.getClass())) { return TransportMode.HTTP; } throw new UnsupportedOperationException(); }

Target:
public TransportMode getTransportMode() { if (HTTPCommandResult.class.isAssignableFrom(this.getClass())) { return TransportMode.HTTP; } return TransportMode.UNKNOWN; }
Source:
public TestFactory fromUrl(String url) throws Exception { HttpJsonRequest httpJsonRequest = requestFactory.fromUrl(apiEndpointProvider.get() + "factory/resolver"); httpJsonRequest.setBody(singletonMap("url", url)); HttpJsonResponse respoTestCheDefaultUserHttpJsonRequestFactorynse = httpJsonRequest.request(); FactoryDto factoryDto = response.asDto(FactoryDto.class); String factoryUrl = ideUrlProvider.get() + "f?url=" + URLEncoder.encode(url, "UTF8"); return new TestFactory( factoryUrl, defaultUser, factoryDto, dashboardUrlProvider, testFactoryServiceClient, workspaceServiceClient, loginPage); }

Target:
public TestFactory fromUrl(String url) throws Exception { HttpJsonRequest httpJsonRequest = requestFactory.fromUrl(apiEndpointProvider.get() + "factory/resolver"); httpJsonRequest.setBody(singletonMap("url", url)); HttpJsonResponse response = httpJsonRequest.request(); FactoryDto factoryDto = response.asDto(FactoryDto.class); String factoryUrl = ideUrlProvider.get() + "f?url=" + URLEncoder.encode(url, "UTF8"); return new TestFactory( factoryUrl, defaultUser, factoryDto, dashboardUrlProvider, testFactoryServiceClient, workspaceServiceClient, loginPage); }
Source:
public InlineByteBuddyMockMaker() { if (INITIALIZATION_ERROR != null) { throw new MockitoInitializationException(join( "Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)", ToolProvider.getSystemJavaCompiler() == null ? "No JDK implementation detected, this could be a problem.\n" : "", Platform.describe()), INITIALIZATION_ERROR); } bytecodeGenerator = new TypeCachingBytecodeGenerator(new InlineBytecodeGenerator(INSTRUMENTATION, mocks), true); }

Target:
public InlineByteBuddyMockMaker() { if (INITIALIZATION_ERROR != null) { throw new MockitoInitializationException(join( "Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)", ToolProvider.getSystemJavaCompiler() == null ? "Are you running a JRE instead of a JDK? The inline mock maker needs to be run on a JDK.\n" : "", Platform.describe()), INITIALIZATION_ERROR); } bytecodeGenerator = new TypeCachingBytecodeGenerator(new InlineBytecodeGenerator(INSTRUMENTATION, mocks), true); }
Source:
public static String getSafeJsBoolean(String s){ if(s.equals("true") || s.equals("false") || s.equals("0") || s.equals("1")){ return s; }else{ return "null"; } }

Target:
public static String getSafeJsBoolean(String s){ return Boolean.toString(BooleanUtils.toBooleanObject(s)); }
Source:
private VirtualFile createFile(String name) { VirtualFile work = vfs.resolve("/work"); return work.findChild(name) .orElseThrow(() -> Exceptions.handle() .withSystemErrorMessage( "FTP Job Trigger: The virtual file with name %s could not be created", name) .handle()); }

Target:
private VirtualFile createFile(String name) { VirtualFile work = virtualFileSystem.resolve("/work"); return work.findChild(name) .orElseThrow(() -> Exceptions.handle() .withSystemErrorMessage( "FTP Job Trigger: The virtual file with name %s could not be created", name) .handle()); }
Source:
public synchronized Pipeline createPipeline( ReplicationType type, ReplicationFactor factor) throws IOException { lock.writeLock().lock(); try { Pipeline pipeline = pipelineFactory.create(type, factor); pipelineStore.put(pipeline.getId().getProtobuf().toByteArray(), pipeline.getProtobufMessage().toByteArray()); stateManager.addPipeline(pipeline); nodeManager.addPipeline(pipeline); metrics.incNumPipelineCreated(); metrics.createNumBlocksAllocatedMetric(pipeline); return pipeline; } catch (InsufficientDatanodesException idEx) { throw idEx; } catch (IOException ex) { metrics.incNumPipelineCreationFailed(); throw ex; } finally { lock.writeLock().unlock(); } }

Target:
public synchronized Pipeline createPipeline( ReplicationType type, ReplicationFactor factor) throws IOException { lock.writeLock().lock(); try { Pipeline pipeline = pipelineFactory.create(type, factor); pipelineStore.put(pipeline.getId().getProtobuf().toByteArray(), pipeline.getProtobufMessage().toByteArray()); stateManager.addPipeline(pipeline); nodeManager.addPipeline(pipeline); metrics.incNumPipelineCreated(); metrics.createPerPipelineMetrics(pipeline); return pipeline; } catch (InsufficientDatanodesException idEx) { throw idEx; } catch (IOException ex) { metrics.incNumPipelineCreationFailed(); throw ex; } finally { lock.writeLock().unlock(); } }
Source:
public PublishingEndPoint getPublishingEndPoint(final String protocol) { if (UtilMethods.isSet(protocol)) { return null; } else if (PushPublisher.PROTOCOL_HTTP.equalsIgnoreCase(protocol) || PushPublisher.PROTOCOL_HTTP.equalsIgnoreCase(protocol)) { return new PushPublishingEndPoint(); } else if (AWSS3Publisher.PROTOCOL_AWS_S3.equalsIgnoreCase(protocol)) { return new AWSS3PublishingEndPoint(); } else if (StaticPublisher.PROTOCOL_STATIC.equalsIgnoreCase(protocol)) { return new StaticPublishingEndPoint(); } return null; }

Target:
public PublishingEndPoint getPublishingEndPoint(final String protocol) { if (!UtilMethods.isSet(protocol)) { return null; } else if (PushPublisher.PROTOCOL_HTTP.equalsIgnoreCase(protocol) || PushPublisher.PROTOCOL_HTTPS.equalsIgnoreCase(protocol)) { return new PushPublishingEndPoint(); } else if (AWSS3Publisher.PROTOCOL_AWS_S3.equalsIgnoreCase(protocol)) { return new AWSS3PublishingEndPoint(); } else if (StaticPublisher.PROTOCOL_STATIC.equalsIgnoreCase(protocol)) { return new StaticPublishingEndPoint(); } return null; }
Source:
public void handlePostChanged(GeoServerSecurityManager securityManager) { try { JDBCConfiguration config = getJDBCDiskQuotaConfig(); if(config != null) { Resource configFile = configDir.get("geowebcache-diskquota-jdbc.xml"); if(!Resources.exists(configFile)) { return; } JDBCConfiguration c1; InputStream is = configFile.in(); try { c1 = JDBCConfiguration.load(is); } finally { is.close(); } if(c1 == null || c1.getConnectionPool() == null) { return; } String originalEncrypted = c1.getConnectionPool().getPassword(); if(originalEncrypted == null) { return; } JDBCConfiguration c2 = passwordHelper.unencryptPassword(c1); JDBCConfiguration c3 = passwordHelper.encryptPassword(c2); String newEncrypted = c3.getConnectionPool().getPassword(); if(!originalEncrypted.equals(newEncrypted)) { OutputStream os = configFile.out(); try { JDBCConfiguration.store(c3, os); } finally { os.close(); } } } } catch (Exception e) { e.printStackTrace(); } }

Target:
public void handlePostChanged(GeoServerSecurityManager securityManager) { try { JDBCConfiguration config = getJDBCDiskQuotaConfig(); if(config != null) { Resource configFile = configDir.get("geowebcache-diskquota-jdbc.xml"); if(!Resources.exists(configFile)) { return; } JDBCConfiguration c1; try (InputStream is = configFile.in()) { c1 = JDBCConfiguration.load(is); } if(c1 == null || c1.getConnectionPool() == null) { return; } String originalEncrypted = c1.getConnectionPool().getPassword(); if(originalEncrypted == null) { return; } JDBCConfiguration c2 = passwordHelper.unencryptPassword(c1); JDBCConfiguration c3 = passwordHelper.encryptPassword(c2); String newEncrypted = c3.getConnectionPool().getPassword(); if(!originalEncrypted.equals(newEncrypted)) { try (OutputStream os = configFile.out()) { JDBCConfiguration.store(c3, os); } } } } catch (Exception e) { e.printStackTrace(); } }
Source:
public void testFileRevisions() throws TeamException, CoreException, IOException { IProject project = createProject("testFileRevisions", new String[] { "file.txt"}); setContentsAndEnsureModified(project.getFile("file.txt"), "hi there"); commitResources(project, new String[] {"file.txt"}); setContentsAndEnsureModified(project.getFile("file.txt"), "bye there"); commitResources(project, new String[] {"file.txt"}); ICVSRemoteFile remote = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file.txt")); ILogEntry[] entries = remote.getLogEntries(DEFAULT_MONITOR); for (ILogEntry entrie : entries) { InputStream in = entrie.getRemoteFile().getContents(DEFAULT_MONITOR); if (entrie.getRevision().equals("1.2")) { int count = 0; byte[] buffer = new byte[1024]; int c; while((c = in.read()) != -1) { buffer[count] = (byte)c; count++; } String contents = new String(buffer, 0, count); assertEquals("the contents of revision 1.2 are not equal", contents, "hi there"); } else if (entrie.getRevision().equals("1.3")) { int count = 0; byte[] buffer = new byte[1024]; int c; while((c = in.read()) != -1) { buffer[count] = (byte)c; count++; } String contents = new String(buffer, 0, count); assertEquals("the contents of revision 1.3 are not equal", contents, "bye there"); } } }

Target:
public void testFileRevisions() throws TeamException, CoreException, IOException { IProject project = createProject("testFileRevisions", new String[] { "file.txt"}); setContentsAndEnsureModified(project.getFile("file.txt"), "hi there"); commitResources(project, new String[] {"file.txt"}); setContentsAndEnsureModified(project.getFile("file.txt"), "bye there"); commitResources(project, new String[] {"file.txt"}); ICVSRemoteFile remote = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file.txt")); ILogEntry[] entries = remote.getLogEntries(DEFAULT_MONITOR); for (ILogEntry entry : entries) { InputStream in = entry.getRemoteFile().getContents(DEFAULT_MONITOR); if (entry.getRevision().equals("1.2")) { int count = 0; byte[] buffer = new byte[1024]; int c; while((c = in.read()) != -1) { buffer[count] = (byte)c; count++; } String contents = new String(buffer, 0, count); assertEquals("the contents of revision 1.2 are not equal", contents, "hi there"); } else if (entry.getRevision().equals("1.3")) { int count = 0; byte[] buffer = new byte[1024]; int c; while((c = in.read()) != -1) { buffer[count] = (byte)c; count++; } String contents = new String(buffer, 0, count); assertEquals("the contents of revision 1.3 are not equal", contents, "bye there"); } } }
Source:
private void processQuery( long lo, long limit, @Transient SqlCompiler compiler, @Transient AssociativeCache<Object> factoryCache ) throws BadProtocolException, SqlException, PeerDisconnectedException, PeerIsSlowToReadException { prepareForNewQuery(); parseQueryText(lo, limit - 1); if (SqlKeywords.isSemicolon(queryText)) { queryTag = TAG_OK; sendExecuteTail(TAIL_SUCCESS); return; } final Object statement = factoryCache.peek(queryText); if (statement == null) { final CompiledQuery cc = compiler.compile(queryText, sqlExecutionContext); sqlExecutionContext.storeTelemetry(cc.getType()); switch (cc.getType()) { case CompiledQuery.SELECT: final RecordCursorFactory factory = cc.getRecordCursorFactory(); factoryCache.put(queryText, factory); queryTag = TAG_SELECT; executeSelect(factory); break; case CompiledQuery.COPY_LOCAL: queryTag = TAG_COPY; sendCopyInResponse(compiler.getEngine(), cc.getTextLoader()); break; case CompiledQuery.INSERT: queryTag = TAG_INSERT; currentInsertStatement = cc.getInsertStatement(); executeInsert(); break; default: queryTag = TAG_OK; sendExecuteTail(TAIL_SUCCESS); break; } } else { if (statement instanceof RecordCursorFactory) { queryTag = TAG_SELECT; executeSelect((RecordCursorFactory) statement); } } }

Target:
private void processQuery( long lo, long limit, @Transient SqlCompiler compiler, @Transient AssociativeCache<Object> factoryCache ) throws BadProtocolException, SqlException, PeerDisconnectedException, PeerIsSlowToReadException { prepareForNewQuery(); parseQueryText(lo, limit - 1); if (SqlKeywords.isSemicolon(queryText)) { queryTag = TAG_OK; sendExecuteTail(TAIL_SUCCESS); return; } final Object statement = factoryCache.peek(queryText); if (statement == null) { final CompiledQuery cc = compiler.compile(queryText, sqlExecutionContext); sqlExecutionContext.storeTelemetry(cc.getType(), TelemetryOrigin.PG_WIRE); switch (cc.getType()) { case CompiledQuery.SELECT: final RecordCursorFactory factory = cc.getRecordCursorFactory(); factoryCache.put(queryText, factory); queryTag = TAG_SELECT; executeSelect(factory); break; case CompiledQuery.COPY_LOCAL: queryTag = TAG_COPY; sendCopyInResponse(compiler.getEngine(), cc.getTextLoader()); break; case CompiledQuery.INSERT: queryTag = TAG_INSERT; currentInsertStatement = cc.getInsertStatement(); executeInsert(); break; default: queryTag = TAG_OK; sendExecuteTail(TAIL_SUCCESS); break; } } else { if (statement instanceof RecordCursorFactory) { queryTag = TAG_SELECT; executeSelect((RecordCursorFactory) statement); } } }
Source:
public String getOwner() { try { User user = userDao.getById(context.getIdentity().getOwnerId()); return user == null ? context.getIdentity().getOwnerId() : user.getName(); } catch (NotFoundException | ServerException e) { return context.getIdentity().getOwnerId(); } }

Target:
public String getOwner() { return context.getIdentity().getOwnerId(); }
Source:
protected void testExecute_asInstructorWithRecycleBinFlagTrue_shouldReturnAllSoftDeletedSessionsForInstructor() { InstructorAttributes instructor2OfCourse1 = typicalBundle.instructors.get("instructor2OfCourse1"); FeedbackSessionAttributes session1InCourse1 = typicalBundle.feedbackSessions.get("session1InCourse1"); loginAsInstructor(instructor2OfCourse1.googleId); String[] submissionParam = { Const.ParamsNames.IS_IN_RECYCLE_BIN, "true", Const.ParamsNames.ENTITY_TYPE, Const.EntityType.INSTRUCTOR, }; GetFeedbackSessionsAction action = getAction(submissionParam); FeedbackSessionsData fsData = (FeedbackSessionsData) getJsonResult(action).getOutput(); assertEquals(1, fsData.getFeedbackSessions().size()); FeedbackSessionData fs = fsData.getFeedbackSessions().get(0); assertNotNull(fs.getDeletedAtTimestamp()); assertAllInformationMatch(fs, session1InCourse1); }

Target:
protected void testExecute_asInstructorWithRecycleBinFlagTrue_shouldReturnAllSoftDeletedSessionsForInstructor() { InstructorAttributes instructor2OfCourse1 = typicalBundle.instructors.get("instructor2OfCourse1"); FeedbackSessionAttributes session1InCourse1 = typicalBundle.feedbackSessions.get("session1InCourse1"); loginAsInstructor(instructor2OfCourse1.googleId); String[] submissionParam = { Const.ParamsNames.IS_IN_RECYCLE_BIN, "true", Const.ParamsNames.ENTITY_TYPE, Const.EntityType.INSTRUCTOR, }; GetFeedbackSessionsAction action = getAction(submissionParam); FeedbackSessionsData fsData = (FeedbackSessionsData) getJsonResult(action).getOutput(); assertEquals(1, fsData.getFeedbackSessions().size()); FeedbackSessionData fs = fsData.getFeedbackSessions().get(0); assertAllInformationMatch(fs, session1InCourse1); }
Source:
private void apply(PacketContext context, UUID ownerId, boolean isPortFilter, RuleResult res, int depth, List<UUID> traversedChains) { context.jlog().debug("Processing chain with name and ID {}", name, id); if (depth > 10) { throw new IllegalStateException("Deep recursion when processing " + "chain " + traversedChains.get(0)); } context.addFlowTag(flowInvTag); traversedChains.add(id); Iterator<Rule> iter = rules.iterator(); res.action = Action.CONTINUE; while (iter.hasNext() && res.action == Action.CONTINUE) { Rule r = iter.next(); r.process(context, res, ownerId, isPortFilter); if (res.action == Action.TRACE) { throw new TraceRequiredException("Packet should be traced"); } if (res.action == Action.JUMP) { Chain jumpChain = getJumpTarget(res.jumpToChain); if (null == jumpChain) { context.jlog().error("ignoring jump to chain : not found.", res.jumpToChain, context); res.action = Action.CONTINUE; } else if (traversedChains.contains(jumpChain.id)) { context.jlog().warn( "cannot jump from chain to chain -- already visited", this, jumpChain, context); res.action = Action.CONTINUE; } else { jumpChain.apply(context, ownerId, isPortFilter, res, depth + 1, traversedChains); if (res.action == Action.RETURN) res.action = Action.CONTINUE; } } } assert res.action != Action.JUMP; }

Target:
private void apply(PacketContext context, UUID ownerId, boolean isPortFilter, RuleResult res, int depth, List<UUID> traversedChains) { context.jlog().debug("Processing chain with name and ID {}", name, id); if (depth > 10) { throw new IllegalStateException("Deep recursion when processing " + "chain " + traversedChains.get(0)); } context.addFlowTag(flowInvTag); traversedChains.add(id); Iterator<Rule> iter = rules.iterator(); res.action = Action.CONTINUE; while (iter.hasNext() && res.action == Action.CONTINUE) { Rule r = iter.next(); r.process(context, res, ownerId, isPortFilter); if (res.action == Action.TRACE) { throw TraceRequiredException.instance(); } if (res.action == Action.JUMP) { Chain jumpChain = getJumpTarget(res.jumpToChain); if (null == jumpChain) { context.jlog().error("ignoring jump to chain : not found.", res.jumpToChain, context); res.action = Action.CONTINUE; } else if (traversedChains.contains(jumpChain.id)) { context.jlog().warn( "cannot jump from chain to chain -- already visited", this, jumpChain, context); res.action = Action.CONTINUE; } else { jumpChain.apply(context, ownerId, isPortFilter, res, depth + 1, traversedChains); if (res.action == Action.RETURN) res.action = Action.CONTINUE; } } } assert res.action != Action.JUMP; }
Source:
public void downloadAllServerChanges_throwsOnUiThread() throws InterruptedException { SyncUser user = createTestUser(); Realm realm = Realm.getInstance(configuration); try { SyncManager.getSession(configuration).downloadAllServerChanges(); } catch (IllegalStateException ignored) { } finally { realm.close(); } }

Target:
public void downloadAllServerChanges_throwsOnUiThread() throws InterruptedException { Realm realm = Realm.getInstance(configuration); try { SyncManager.getSession(configuration).downloadAllServerChanges(); fail("Should throw an IllegalStateException on Ui Thread"); } catch (IllegalStateException ignored) { } finally { realm.close(); } }
Source:
public DeploymentConfiguration createPropertyDeploymentConfiguration( Class<?> systemPropertyBaseClass, VaadinConfig vaadinConfig) throws VaadinConfigurationException { return new PropertyDeploymentConfiguration( ApplicationConfiguration.get(vaadinConfig.getVaadinContext()), systemPropertyBaseClass, createInitParameters(systemPropertyBaseClass, vaadinConfig)); }

Target:
public DeploymentConfiguration createPropertyDeploymentConfiguration( Class<?> systemPropertyBaseClass, VaadinConfig vaadinConfig) { return new PropertyDeploymentConfiguration( ApplicationConfiguration.get(vaadinConfig.getVaadinContext()), systemPropertyBaseClass, createInitParameters(systemPropertyBaseClass, vaadinConfig)); }
Source:
public LoginContext login() throws LoginException { String jaasConfigFile = System.getProperty(JAAS_CONFIG_SYSTEM_PROPERTY); if (jaasConfigFile == null) { log.debug("System property " + JAAS_CONFIG_SYSTEM_PROPERTY + " for jaas config file is not set, using default JAAS configuration."); } loginContext = new LoginContext(loginContextName, new LoginCallbackHandler()); loginContext.login(); log.info("Successfully logged in."); return loginContext; }

Target:
public LoginContext login() throws LoginException { String jaasConfigFile = System.getProperty(JAAS_CONFIG_SYSTEM_PROPERTY); if (jaasConfigFile == null) { log.error("System property " + JAAS_CONFIG_SYSTEM_PROPERTY + " for jaas config file is not set, using default JAAS configuration."); } loginContext = new LoginContext(loginContextName, new LoginCallbackHandler()); loginContext.login(); log.info("Successfully logged in."); return loginContext; }
Source:
protected synchronized void cacheNewValue(final K key, final V newValue) { notNull(newValue); final V nullableOldValue = cache.getIfPresent(key); LOGGER.trace("Caching value={} for {}", newValue, key); cache.put(key, newValue); if (nullableOldValue != null) { final V oldValue = nullableOldValue; if (!java.util.Objects.equals(newValue, oldValue)) { LOGGER.info("The value for was updated from to {}", key, oldValue, newValue); } } else { LOGGER.debug("Polled for the first time. Found that the value is {}", key, newValue); } }

Target:
protected void cacheNewValue(final K key, final V newValue) { notNull(newValue); final V nullableOldValue = cache.getIfPresent(key); LOGGER.trace("Caching value={} for {}", newValue, key); cache.put(key, newValue); if (nullableOldValue != null) { final V oldValue = nullableOldValue; if (!java.util.Objects.equals(newValue, oldValue)) { LOGGER.info("The value for was updated from to {}", key, oldValue, newValue); } } else { LOGGER.debug("Polled for the first time. Found that the value is {}", key, newValue); } }
Source:
public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); SSOLocalConfig localConfig = new SSOLocalConfig(); ctx.setAttribute(SSOUtils.EXTENSION_MANAGER, new SSOExtensionsManager(localConfig)); ctx.setAttribute(SSOUtils.USER_GROUP_MANAGER, new SSOUserGroupManager()); ctx.setAttribute(SSOUtils.SSO_LOCAL_CONFIG, localConfig); ctx.setAttribute(SSOUtils.SSO_PROFILES, AuthenticationUtils.getAvailableProfiles(ctx)); boolean enableBasicAuth = false; String strVal = ctx.getInitParameter("enable-basic-auth"); if (StringUtils.isNotEmpty(strVal)) { enableBasicAuth = Boolean.parseBoolean(strVal); } ctx.setAttribute(SSOUtils.ENABLE_BASIC_AUTH, enableBasicAuth); }

Target:
public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); SSOLocalConfig localConfig = new SSOLocalConfig(); ctx.setAttribute(SSOUtils.EXTENSION_MANAGER, new SSOExtensionsManager(localConfig)); ctx.setAttribute(SSOUtils.USER_GROUP_MANAGER, new SSOUserGroupManager()); ctx.setAttribute(SSOUtils.SSO_LOCAL_CONFIG, localConfig); ctx.setAttribute(SSOUtils.SSO_PROFILES, AuthenticationUtils.getAvailableProfiles(ctx)); ctx.setAttribute(SSOUtils.ACCEPT_BASIC_AUTH_HEADERS, getBooleanInitParam(ctx, SSOUtils.ACCEPT_BASIC_AUTH_HEADERS)); ctx.setAttribute(SSOUtils.ENABLE_BASIC_AUTH, getBooleanInitParam(ctx, SSOUtils.ENABLE_BASIC_AUTH)); ctx.setAttribute(SSOUtils.ENABLE_EXTERNAL_AUTH, getBooleanInitParam(ctx, SSOUtils.ENABLE_EXTERNAL_AUTH)); }
Source:
private void setSummaryText(int failingCount, int pendingCount, int successCount) { String failingText = failingCount > 0 ? getContext().getString(R.string.check_failing, failingCount) : ""; if (failingCount > 0 && pendingCount > 0) { failingText += ", "; } String pendingText = pendingCount > 0 ? getContext().getString(R.string.check_pending, pendingCount) : ""; if ((failingCount > 0 || pendingCount > 0) && successCount > 0) { pendingText += ", "; } String successfulText = successCount > 0 ? getContext().getString(R.string.check_successful, successCount) : ""; int sumCount = pendingCount + failingCount + successCount; mSummaryTextView.setText(getResources().getQuantityString(R.plurals.checks_summary, sumCount, failingText, pendingText, successfulText)); }

Target:
private void setSummaryText(int failingCount, int pendingCount, int successCount) { ArrayList<String> summaryList = new ArrayList<>(); if (failingCount > 0) { summaryList.add(getContext().getString(R.string.check_failing, failingCount)); } if (pendingCount > 0) { summaryList.add(getContext().getString(R.string.check_pending, pendingCount)); } if (successCount > 0) { summaryList.add(getContext().getString(R.string.check_successful, successCount)); } String summary = TextUtils.join(", ", summaryList); int sumCount = pendingCount + failingCount + successCount; mSummaryTextView.setText(getResources().getQuantityString(R.plurals.checks_summary, sumCount, summary)); }
Source:
private ProjectName( final String value ) { Preconditions.checkNotNull( value, "Project name cannot be null" ); Preconditions.checkArgument( !value.trim().isEmpty(), "Project name cannot be blank" ); Preconditions.checkArgument( value.matches( "^" + VALID_PROJECT_NAME_REGEX + "$" ), "Project name format incorrect: " + value ); this.value = value; }

Target:
private ProjectName( final String value ) { Preconditions.checkNotNull( value, "Project name cannot be null" ); Preconditions.checkArgument( !value.trim().isEmpty(), "Project name cannot be blank" ); Preconditions.checkArgument( VALID_PROJECT_NAME_PATTERN.matcher( value ).matches(), "Project name format incorrect: " + value ); this.value = value; }
Source:
private void setLayoutRestrictions(boolean allowUpDownButtons, boolean allowScrollThumb, boolean allowAlphaJump) { ImageView upButton = mPagedListView.findViewById(R.id.page_up); ImageView downButton = mPagedListView.findViewById(R.id.page_down); Button alphaJump = mPagedListView.findViewById(R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = mPagedListView.getContext().getResources() .getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; if (allowUpDownButtons) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowScrollThumb) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } if (!(allowUpDownButtons & allowScrollThumb & allowAlphaJump)) { restrictedHeight += -1; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> scrollBarView.requestLayout()); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }

Target:
private void setLayoutRestrictions(boolean allowUpDownButtons, boolean allowScrollThumb, boolean allowAlphaJump) { ImageView upButton = mPagedListView.findViewById(R.id.page_up); ImageView downButton = mPagedListView.findViewById(R.id.page_down); Button alphaJump = mPagedListView.findViewById(R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = mPagedListView.getContext().getResources() .getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = 0; if (allowUpDownButtons) { restrictedHeight += mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; } if (allowScrollThumb) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowAlphaJump) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> scrollBarView.requestLayout()); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }
Source:
public void waitForValueToBePresentInElementsAttributeByCss(String selector, String attribute, String value) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { waitFor.until(CommonExpectedConditions.valueToBePresentInElementsAttribute( By.cssSelector(selector), attribute, escapeHtml(value))); } finally { restoreDeaultImplicitWait(); } }

Target:
public void waitForValueToBePresentInElementsAttributeByCss(String selector, String attribute, String value) { changeImplicitWait(250, TimeUnit.MILLISECONDS); try { waitFor.until(CommonExpectedConditions.valueToBePresentInElementsAttribute( By.cssSelector(selector), attribute, value)); } finally { restoreDeaultImplicitWait(); } }
Source:
private boolean isIgnored(List<DataManipulator<?, ?>> list, DataManipulator<?, ?> toCheck) { for (Class<? extends DataManipulator<?, ?>> ignore : ignored) { if (ignore.isAssignableFrom(toCheck.getClass())) { list.removeIf(manip -> ignore.isAssignableFrom(manip.getClass())); return true; } } return false; }

Target:
private boolean isIgnored(List<DataManipulator<?, ?>> list, DataManipulator<?, ?> toCheck) { for (Class<? extends DataManipulator<?, ?>> ignore : this.ignored) { if (ignore.isAssignableFrom(toCheck.getClass())) { list.removeIf(manip -> ignore.isAssignableFrom(manip.getClass())); return true; } } return false; }
Source:
public static synchronized void setField(Object target, Field field, Object value) { AccessibilityChanger changer = new AccessibilityChanger(); changer.enableAccess(field); try { field.set(target, value); } catch (IllegalAccessException e) { throw new RuntimeException("Access not authorized on field '" + field + "' of object '" + target + "' with value: '" + value + "'", e); } catch (IllegalArgumentException e) { throw new RuntimeException("Wrong argument on field '" + field + "' of object '" + target + "' with value: '" + value + "', \n" + "reason : " + e.getMessage(), e); } changer.safelyDisableAccess(field); }

Target:
public static void setField(Object target, Field field, Object value) { AccessibilityChanger changer = new AccessibilityChanger(); changer.enableAccess(field); try { field.set(target, value); } catch (IllegalAccessException e) { throw new RuntimeException("Access not authorized on field '" + field + "' of object '" + target + "'" + " with value: '" + value + "'", e); } catch (IllegalArgumentException e) { throw new RuntimeException("Wrong argument on field '" + field + "' of object '" + target + "' with " + "value: '" + value + "', \n" + "reason : " + e.getMessage(), e); } finally { changer.safelyDisableAccess(field); } }
Source:
public MyqDeviceData getMyqData() throws InvalidLoginException, IOException { logger.trace("Retreiveing door data"); String url = String.format( "%s/api/v4/userdevicedetails/get?appId=%s&SecurityToken=%s", websiteUrl, enc(appId), enc(getSecurityToken())); JsonNode data = request("GET", url, null, null, true); return new MyqDeviceData(data); }

Target:
public MyqDeviceData getMyqData() throws InvalidLoginException, IOException { logger.trace("Retrieving door data"); String url = String.format( "%s/api/v4/userdevicedetails/get?appId=%s&SecurityToken=%s", websiteUrl, enc(appId), enc(getSecurityToken())); JsonNode data = request("GET", url, null, null, true); return new MyqDeviceData(data); }
Source:
boolean isBitrateImproving(int newBitrateBps) { synchronized (critSect) { boolean initialProbe = !remoteRate.isValidEstimate() && newBitrateBps > 0; boolean bitrateAboveEstimate = remoteRate.isValidEstimate() && newBitrateBps > (int) (remoteRate .getLatestEstimate()); return initialProbe || bitrateAboveEstimate; } }

Target:
private boolean isBitrateImproving(int newBitrateBps) { synchronized (critSect) { boolean initialProbe = !remoteRate.isValidEstimate() && newBitrateBps > 0; boolean bitrateAboveEstimate = remoteRate.isValidEstimate() && newBitrateBps > (int) (remoteRate .getLatestEstimate()); return initialProbe || bitrateAboveEstimate; } }
Source:
private void relocateHashAdders(){ final Set<JsonObject> hashAdders = new HashSet<>(); GraphUtilities.visitOnce(GraphUtilities.findStarts(graph), new HashSet<BVirtualMarker>(), graph, new Consumer<JsonObject>(){ public void accept(JsonObject op) { if(jstring(op, "kind").equals("com.ibm.streamsx.topology.functional.java::HashAdder")){ hashAdders.add(op); } } }); for(JsonObject hashAdder : hashAdders){ relocateHashAdder(hashAdder); } }

Target:
private void relocateHashAdders(){ final Set<JsonObject> hashAdders = new HashSet<>(); GraphUtilities.visitOnce(GraphUtilities.findStarts(graph), new HashSet<BVirtualMarker>(), graph, (JsonObject op) -> { if (GraphUtilities.isHashAdder(op)) { hashAdders.add(op); } } ); for(JsonObject hashAdder : hashAdders){ relocateHashAdder(hashAdder); } }
Source:
public byte[] sign(PublicKey key, byte[] data) throws IOException { byte cmd = SshAgentConstants.SSH2_AGENTC_SIGN_REQUEST; byte okcmd = SshAgentConstants.SSH2_AGENT_SIGN_RESPONSE; if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { cmd = SshAgentConstants.SSH_AGENT_PRIVATE_KEY_OP; okcmd = SshAgentConstants.SSH_AGENT_OPERATION_COMPLETE; } Buffer buffer = createBuffer(cmd); if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { buffer.putString("sign"); } buffer.putPublicKey(key); buffer.putBytes(data); buffer.putInt(0); buffer = request(prepare(buffer)); int responseType = buffer.getUByte(); if (responseType != okcmd) { throw new SshException("Bad signing response type: " + SshAgentConstants.getCommandMessageName(responseType)); } byte[] signature = null; if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { signature = buffer.getBytes(); if (log.isDebugEnabled()) { log.debug("sign({})[{}] : {}", KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key), BufferUtils.toHex(':', signature)); } } else { Buffer buf = new ByteArrayBuffer(buffer.getBytes()); String algorithm = buf.getString(); signature = buf.getBytes(); if (log.isDebugEnabled()) { log.debug("sign({})[{}] {}: {}", KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key), algorithm, BufferUtils.toHex(':', signature)); } } return signature; }

Target:
public byte[] sign(PublicKey key, byte[] data) throws IOException { int cmd = SshAgentConstants.SSH2_AGENTC_SIGN_REQUEST; int okcmd = SshAgentConstants.SSH2_AGENT_SIGN_RESPONSE; if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { cmd = SshAgentConstants.SSH_AGENT_PRIVATE_KEY_OP; okcmd = SshAgentConstants.SSH_AGENT_OPERATION_COMPLETE; } Buffer buffer = createBuffer((byte) cmd); if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { buffer.putString("sign"); } buffer.putPublicKey(key); buffer.putBytes(data); buffer.putInt(0); buffer = request(prepare(buffer)); int responseType = buffer.getUByte(); if (responseType != okcmd) { throw new SshException("Bad signing response type: " + SshAgentConstants.getCommandMessageName(responseType)); } byte[] signature = buffer.getBytes(); if (FactoryManager.AGENT_FORWARDING_TYPE_IETF.equals(channelType)) { if (log.isDebugEnabled()) { log.debug("sign({})[{}] : {}", KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key), BufferUtils.toHex(':', signature)); } } else { Buffer buf = new ByteArrayBuffer(signature); String algorithm = buf.getString(); signature = buf.getBytes(); if (log.isDebugEnabled()) { log.debug("sign({})[{}] {}: {}", KeyUtils.getKeyType(key), KeyUtils.getFingerPrint(key), algorithm, BufferUtils.toHex(':', signature)); } } return signature; }
Source:
public void shouldSaveCondition() { CodedOrFreeText codedOrFreeText = new CodedOrFreeText(new Concept(4), new ConceptName(5089), "non coded"); ConditionClinicalStatus clinicalStatus = ConditionClinicalStatus.ACTIVE; ConditionVerificationStatus verificationStatus = ConditionVerificationStatus.CONFIRMED; Patient patient = new Patient(2); Date onsetDate = new Date(); Date endDate = new Date(); Condition previousVersion = dao.getConditionByUuid("2cc6880e-2c46-15e4-9038-a6c5e4d22fb7"); String additionalDetail = "additionalDetail"; Condition condition = new Condition(); condition.setConditionId(20); condition.setCondition(codedOrFreeText); condition.setClinicalStatus(clinicalStatus); condition.setVerificationStatus(verificationStatus); condition.setPreviousVersion(previousVersion); condition.setAdditionalDetail(additionalDetail); condition.setOnsetDate(onsetDate); condition.setEndDate(endDate); condition.setPatient(patient); Condition savedCondition = dao.saveCondition(condition); assertEquals(additionalDetail, savedCondition.getAdditionalDetail()); assertEquals(20, (int) savedCondition.getConditionId()); assertEquals(onsetDate, (Date) savedCondition.getOnsetDate()); assertEquals(endDate, savedCondition.getEndDate()); assertEquals(clinicalStatus, savedCondition.getClinicalStatus()); assertEquals(verificationStatus, savedCondition.getVerificationStatus()); assertEquals(previousVersion, (Condition) savedCondition.getPreviousVersion()); assertEquals(patient, (Patient) savedCondition.getPatient()); }

Target:
public void shouldSaveCondition() { CodedOrFreeText codedOrFreeText = new CodedOrFreeText(new Concept(4), new ConceptName(5089), "non coded"); ConditionClinicalStatus clinicalStatus = ConditionClinicalStatus.ACTIVE; ConditionVerificationStatus verificationStatus = ConditionVerificationStatus.CONFIRMED; Patient patient = new Patient(2); Date onsetDate = new Date(); Date endDate = new Date(); Condition previousVersion = dao.getConditionByUuid("2cc6880e-2c46-15e4-9038-a6c5e4d22fb7"); String additionalDetail = "additionalDetail"; int conditionId = 20; Condition condition = new Condition(); condition.setConditionId(conditionId); condition.setCondition(codedOrFreeText); condition.setClinicalStatus(clinicalStatus); condition.setVerificationStatus(verificationStatus); condition.setPreviousVersion(previousVersion); condition.setAdditionalDetail(additionalDetail); condition.setOnsetDate(onsetDate); condition.setEndDate(endDate); condition.setPatient(patient); dao.saveCondition(condition); Condition savedCondition = dao.getCondition(conditionId); assertEquals(additionalDetail, savedCondition.getAdditionalDetail()); assertEquals(conditionId, (int) savedCondition.getConditionId()); assertEquals(onsetDate, savedCondition.getOnsetDate()); assertEquals(endDate, savedCondition.getEndDate()); assertEquals(clinicalStatus, savedCondition.getClinicalStatus()); assertEquals(verificationStatus, savedCondition.getVerificationStatus()); assertEquals(previousVersion, savedCondition.getPreviousVersion()); assertEquals(patient, savedCondition.getPatient()); }
Source:
public static List<Technology> sortTechnologies(List<Technology> techList, TechnologyOrderOptionEnum orderBy) { switch (orderBy) { case POSITIVE_RECOMMENDATION_AMOUNT: Collections.sort(techList, new Comparator<Technology>() { @Override public int compare(Technology counter1, Technology counter2) { return Integer.compare(counter2.getPositiveRecommendationsCounter(), counter1.getPositiveRecommendationsCounter()); } }); break; case NEGATIVE_RECOMMENDATION_AMOUNT: Collections.sort(techList, new Comparator<Technology>() { @Override public int compare(Technology counter1, Technology counter2) { return Integer.compare(counter2.getNegativeRecommendationsCounter(), counter1.getNegativeRecommendationsCounter()); } }); break; case COMMENT_AMOUNT: Collections.sort(techList, new Comparator<Technology>() { @Override public int compare(Technology counter1, Technology counter2) { return Integer.compare(counter2.getCommentariesCounter(), counter1.getCommentariesCounter()); } }); break; case ENDORSEMENT_AMOUNT: Collections.sort(techList, new Comparator<Technology>() { @Override public int compare(Technology counter1, Technology counter2) { return Integer.compare(counter2.getEndorsersCounter(), counter1.getEndorsersCounter()); } }); break; case APHABETIC: Collections.sort(techList, new Comparator<Technology>() { @Override public int compare(Technology counter1, Technology counter2) { return counter1.getName().compareTo(counter2.getName()); } }); break; default: break; } return techList; }

Target:
public static List<Technology> sortTechnologies(List<Technology> techList, TechnologyOrderOptionEnum orderBy) { orderBy.sort(techList); return techList; }
Source:
private URI createEntitiesResponseUri() { return ServletUriComponentsBuilder.fromCurrentRequest().build().toUri(); }

Target:
private URI createEntitiesResponseUri() { return createEntitiesResponseUri(null); }
Source:
public void queryStopped() { runningQueries.decrementAndGet(); queuedQueries.decrementAndGet(); }

Target:
public void queryStopped() { runningQueries.decrementAndGet(); }