auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<HealthDataRecord> getRecordsByHealthCodeCreatedOn(String healthCode, DateTime createdOnStart, DateTime createdOnEnd) { if (StringUtils.isBlank(healthCode)) { throw new BadRequestException(String.format(Validate.CANNOT_BE_BLANK, "healthCode")); } if (createdOnStart == null) { throw new BadRequestException(String.format(Validate.CANNOT_BE_NULL, "createdOnStart")); } if (createdOnEnd == null) { throw new BadRequestException(String.format(Validate.CANNOT_BE_NULL, "createdOnEnd")); } if (createdOnStart.isAfter(createdOnEnd)) { throw new BadRequestException("createdOnStart can't be after createdOnEnd"); } if (createdOnStart.plusDays(MAX_DATE_RANGE_DAYS).isBefore(createdOnEnd)) { throw new BadRequestException("maximum date range is " + MAX_DATE_RANGE_DAYS + " days"); } return healthDataDao.getRecordsByHealthCodeCreatedOn(healthCode, createdOnStart.getMillis(), createdOnEnd.getMillis()); }

Target:
public List<HealthDataRecord> getRecordsByHealthCodeCreatedOn(String healthCode, DateTime createdOnStart, DateTime createdOnEnd) { Preconditions.checkArgument(StringUtils.isNotBlank(healthCode)); if (createdOnStart == null) { throw new BadRequestException(String.format(Validate.CANNOT_BE_NULL, "createdOnStart")); } if (createdOnEnd == null) { throw new BadRequestException(String.format(Validate.CANNOT_BE_NULL, "createdOnEnd")); } if (createdOnStart.isAfter(createdOnEnd)) { throw new BadRequestException("createdOnStart can't be after createdOnEnd"); } if (createdOnStart.plusDays(MAX_DATE_RANGE_DAYS).isBefore(createdOnEnd)) { throw new BadRequestException("maximum date range is " + MAX_DATE_RANGE_DAYS + " days"); } return healthDataDao.getRecordsByHealthCodeCreatedOn(healthCode, createdOnStart.getMillis(), createdOnEnd.getMillis()); }
Source:
public ResponseEntity getConfigurationXML() { logger.debug("Received configuration request."); return ResponseEntity.status(HttpStatus.OK) .body(getConfiguration()); }

Target:
public ResponseEntity getConfigurationXML() { logger.debug("Retrieved strongbox.xml configuration file."); return ResponseEntity.status(HttpStatus.OK) .body(getConfiguration()); }
Source:
public void testCloneEmpty() throws Exception { File gitDir = db.getDirectory(); String sourcePath = gitDir.getAbsolutePath(); String targetPath = (new File(sourcePath)).getParentFile() .getParentFile().getAbsolutePath() + "/target"; StringBuilder cmd = new StringBuilder("git clone ").append(sourcePath + " " + targetPath); String[] result = execute(cmd.toString()); assertArrayEquals(new String[] { "Cloning into '" + targetPath + "'...", "warning: You appear to have cloned an empty repository.", "", "" }, result); Git git2 = Git.open(new File(targetPath)); List<Ref> branches = git2.branchList().call(); assertEquals("expected 0 branch", 0, branches.size()); }

Target:
public void testCloneEmpty() throws Exception { File gitDir = db.getDirectory(); String sourceURI = gitDir.toURI().toString(); File target = createTempDirectory("target"); StringBuilder cmd = new StringBuilder("git clone ").append(sourceURI + " " + target.getPath()); String[] result = execute(cmd.toString()); assertArrayEquals(new String[] { "Cloning into '" + target.getPath() + "'...", "warning: You appear to have cloned an empty repository.", "", "" }, result); Git git2 = Git.open(target); List<Ref> branches = git2.branchList().call(); assertEquals("expected 0 branch", 0, branches.size()); }
Source:
public static <T> com.azure.search.documents.implementation.models.IndexAction map(IndexAction<T> obj) { if (obj == null) { return null; } com.azure.search.documents.implementation.models.IndexAction indexAction = new com.azure.search.documents.implementation.models.IndexAction(); if (obj.getActionType() != null) { com.azure.search.documents.implementation.models.IndexActionType actionType = IndexActionTypeConverter.map(obj.getActionType()); indexAction.setActionType(actionType); } Map<String, Object> additionalProperties; TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {}; if (obj.getParamMap() != null) { Map<String, Object> properties = obj.getParamMap(); MAPPER.setSerializationInclusion(JsonInclude.Include.ALWAYS); additionalProperties = MAPPER.convertValue(properties, typeRef); } else { T properties = obj.getDocument(); MAPPER.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); additionalProperties = MAPPER.convertValue(properties, typeRef); } indexAction.setAdditionalProperties(additionalProperties); return indexAction; }

Target:
public static <T> com.azure.search.documents.implementation.models.IndexAction map(IndexAction<T> obj) { if (obj == null) { return null; } com.azure.search.documents.implementation.models.IndexAction indexAction = new com.azure.search.documents.implementation.models.IndexAction(); if (obj.getActionType() != null) { com.azure.search.documents.implementation.models.IndexActionType actionType = IndexActionTypeConverter.map(obj.getActionType()); indexAction.setActionType(actionType); } Map<String, Object> additionalProperties; TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {}; if (obj.getParamMap() != null) { Map<String, Object> properties = obj.getParamMap(); DYNAMIC_TYPE_MAPPER.setSerializationInclusion(JsonInclude.Include.ALWAYS); additionalProperties = DYNAMIC_TYPE_MAPPER.convertValue(properties, typeRef); } else { T properties = obj.getDocument(); additionalProperties = STRONGLY_TYPE_MAPPER.convertValue(properties, typeRef); } indexAction.setAdditionalProperties(additionalProperties); return indexAction; }
Source:
private void parseHDLine(final ParsedHeaderLine parsedHeaderLine) { assert(HeaderRecordType.HD.equals(parsedHeaderLine.getHeaderRecordType())); if (!parsedHeaderLine.requireTag(SAMFileHeader.VERSION_TAG)) { return; } final String soString = parsedHeaderLine.getValue(SAMFileHeader.SORT_ORDER_TAG); try { if (soString != null) SAMFileHeader.SortOrder.valueOf(soString); } catch (IllegalArgumentException e) { reportErrorParsingLine(HEADER_LINE_START + parsedHeaderLine.getHeaderRecordType() + " line has non-conforming SO tag value: " + soString + ".", SAMValidationError.Type.HEADER_TAG_NON_CONFORMING_VALUE, null); } final String goString = parsedHeaderLine.getValue(SAMFileHeader.GROUP_ORDER_TAG); try { if (goString != null) SAMFileHeader.GroupOrder.valueOf(goString); } catch (IllegalArgumentException e) { reportErrorParsingLine(HEADER_LINE_START + parsedHeaderLine.getHeaderRecordType() + " line has non-conforming GO tag value: "+ goString + ".", SAMValidationError.Type.HEADER_TAG_NON_CONFORMING_VALUE, null); } transferAttributes(mFileHeader, parsedHeaderLine.mKeyValuePairs); }

Target:
private void parseHDLine(final ParsedHeaderLine parsedHeaderLine) { assert(HeaderRecordType.HD.equals(parsedHeaderLine.getHeaderRecordType())); if (!parsedHeaderLine.requireTag(SAMFileHeader.VERSION_TAG)) { return; } final String soString = parsedHeaderLine.getValue(SAMFileHeader.SORT_ORDER_TAG); try { if (soString != null) SortOrder.valueOf(soString); } catch (IllegalArgumentException e) { reportErrorParsingLine(HEADER_LINE_START + parsedHeaderLine.getHeaderRecordType() + " line has non-conforming SO tag value: " + soString + ".", SAMValidationError.Type.HEADER_TAG_NON_CONFORMING_VALUE, null); } final String goString = parsedHeaderLine.getValue(SAMFileHeader.GROUP_ORDER_TAG); try { if (goString != null) SAMFileHeader.GroupOrder.valueOf(goString); } catch (IllegalArgumentException e) { reportErrorParsingLine(HEADER_LINE_START + parsedHeaderLine.getHeaderRecordType() + " line has non-conforming GO tag value: "+ goString + ".", SAMValidationError.Type.HEADER_TAG_NON_CONFORMING_VALUE, null); } transferAttributes(mFileHeader, parsedHeaderLine.mKeyValuePairs); }
Source:
public AuditLogType getAuditLogTypeValue() { AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("StorageDomainName", getStorageDomain().getName()); auditLogableBase.setUserName(getUserName()); if (getActionState() == CommandActionState.EXECUTE && !getSucceeded()) { return AuditLogType.UPDATE_OVF_FOR_STORAGE_DOMAIN_FAILED; } if ("SYSTEM".equals(auditLogableBase.getUserName())) { return AuditLogType.SYSTEM_UPDATE_OVF_STORE; } return AuditLogType.USER_UPDATE_OVF_STORE; }

Target:
public AuditLogType getAuditLogTypeValue() { AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.addCustomValue("StorageDomainName", getStorageDomain().getName()); auditLogableBase.setUserName(getUserName()); if (getActionState() == CommandActionState.EXECUTE && !getSucceeded()) { return AuditLogType.UPDATE_OVF_FOR_STORAGE_DOMAIN_FAILED; } if (!"SYSTEM".equals(auditLogableBase.getUserName())) { return AuditLogType.USER_UPDATE_OVF_STORE; } return super.getAuditLogTypeValue(); }
Source:
private synchronized BridgeHandler getDssBridgeHandler() { if (this.dssBridgeHandler == null) { Bridge bridge = getBridge(); if (bridge == null) { logger.debug("cant find Bridge"); return null; } ThingHandler handler = bridge.getHandler(); if (handler instanceof BridgeHandler) { this.dssBridgeHandler = (BridgeHandler) handler; this.dssBridgeHandler.registerDeviceStatusListener(this); } else { return null; } } return this.dssBridgeHandler; }

Target:
private synchronized BridgeHandler getDssBridgeHandler() { if (this.dssBridgeHandler == null) { Bridge bridge = getBridge(); if (bridge == null) { logger.debug("Bride cannot be found"); return null; } ThingHandler handler = bridge.getHandler(); if (handler instanceof BridgeHandler) { dssBridgeHandler = (BridgeHandler) handler; dssBridgeHandler.registerDeviceStatusListener(this); } else { return null; } } return dssBridgeHandler; }
Source:
void testCreationOfAggregate(Function<String, Object> commandBuilder, String aggregateType) { String id = "id"; fixture.givenNoPriorActivity() .when(commandBuilder.apply(id)) .expectEventsMatching(new PredicateMatcher<>(events -> { DomainEventMessage<CreatedEvent> evt = (DomainEventMessage<CreatedEvent>) events.get(0); return evt.getType().equals(aggregateType) && events.size() == 1 && evt.getPayload().id.equals(id); })); }

Target:
void testCreationOfAggregate(Function<String, Object> commandBuilder, String aggregateType) { String id = "id"; fixture.givenNoPriorActivity() .when(commandBuilder.apply(id)) .expectEventsMatching(Matchers.predicate(events -> { DomainEventMessage<CreatedEvent> evt = (DomainEventMessage<CreatedEvent>) events.get(0); return evt.getType().equals(aggregateType) && events.size() == 1 && evt.getPayload().id.equals(id); })); }
Source:
public void auditNhinCoreX12RealtimeRequest(COREEnvelopeRealTimeRequest message, AssertionType assertion, NhinTargetSystemType target, String direction) { LOG.debug("---Begin COREX12AuditLogger.auditCoreX12RealtimeRequest()---"); AuditRepositoryLogger auditLogger = new AuditRepositoryLogger(); LogEventRequestType auditLogMsg = auditLogger.logNhinCoreX12RealtimeRequest(message, assertion, target, direction); if (auditLogMsg != null && auditLogMsg.getAuditMessage() != null) { audit(auditLogMsg, assertion); } else { LOG.error("Core X12 Realtime Request auditLogMsg is null"); } LOG.debug("---End COREX12AuditLogger.auditCoreX12RealtimeRequest()---"); }

Target:
public void auditNhinCoreX12RealtimeRequest(COREEnvelopeRealTimeRequest message, AssertionType assertion, NhinTargetSystemType target, String direction) { LOG.trace("---Begin COREX12AuditLogger.auditCoreX12RealtimeRequest()---"); LogEventRequestType auditLogMsg = auditLogger.logNhinCoreX12RealtimeRequest(message, assertion, target, direction); if (auditLogMsg != null && auditLogMsg.getAuditMessage() != null) { audit(auditLogMsg, assertion); } else { LOG.error("Core X12 Realtime Request auditLogMsg is null"); } LOG.trace("---End COREX12AuditLogger.auditCoreX12RealtimeRequest()---"); }
Source:
public void aDeviceWithDeviceID(final String deviceId) throws Throwable { this.deviceId.setDeviceIdE(deviceId); this.deviceHooks.activateDevice(deviceId); }

Target:
public void aDeviceWithDeviceID(final String deviceId) throws Throwable { this.deviceId.setDeviceIdE(deviceId); }
Source:
public Message<?> preSend(Message<?> message, MessageChannel channel) { if (log.isDebugEnabled()) { log.debug("Processing message before sending it to the channel"); } Message<?> retrievedMessage = getMessage(message); MessageBuilder<?> messageBuilder = MessageBuilder.fromMessage(retrievedMessage); Span parentSpan = getTracer().isTracing() ? getTracer().getCurrentSpan() : buildSpan(new MessagingTextMap(messageBuilder)); if (log.isDebugEnabled()) { log.debug("Parent span is " + parentSpan); } String name = getMessageChannelName(channel); if (log.isDebugEnabled()) { log.debug("Name of the span will be [" + name + "]"); } Span span = startSpan(parentSpan, name, message); if (message.getHeaders().containsKey(TraceMessageHeaders.MESSAGE_SENT_FROM_CLIENT)) { if (log.isDebugEnabled()) { log.debug("Marking span with server received"); } span.logEvent(Span.SERVER_RECV); } else { if (log.isDebugEnabled()) { log.debug("Marking span with client send"); } span.logEvent(Span.CLIENT_SEND); messageBuilder.setHeader(TraceMessageHeaders.MESSAGE_SENT_FROM_CLIENT, true); } getSpanInjector().inject(span, new MessagingTextMap(messageBuilder)); MessageHeaderAccessor headers = MessageHeaderAccessor.getMutableAccessor(message); if (message.getPayload() instanceof MessagingException) { headers.copyHeaders(sleuthHeaders(messageBuilder.build().getHeaders())); return new ErrorMessage((MessagingException) message.getPayload(), headers.getMessageHeaders()); } headers.copyHeaders(messageBuilder.build().getHeaders()); return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders()); }

Target:
public Message<?> preSend(Message<?> message, MessageChannel channel) { if (log.isDebugEnabled()) { log.debug("Processing message before sending it to the channel"); } Message<?> retrievedMessage = getMessage(message); MessageBuilder<?> messageBuilder = MessageBuilder.fromMessage(retrievedMessage); Span parentSpan = getTracer().isTracing() ? getTracer().getCurrentSpan() : buildSpan(new MessagingTextMap(messageBuilder)); if (log.isDebugEnabled()) { log.debug("Parent span is " + parentSpan); } String name = getMessageChannelName(channel); if (log.isDebugEnabled()) { log.debug("Name of the span will be [" + name + "]"); } Span span = startSpan(parentSpan, name, message); if (message.getHeaders().containsKey(TraceMessageHeaders.MESSAGE_SENT_FROM_CLIENT)) { if (log.isDebugEnabled()) { log.debug("Marking span with server received"); } span.logEvent(Span.SERVER_RECV); } else { if (log.isDebugEnabled()) { log.debug("Marking span with client send"); } span.logEvent(Span.CLIENT_SEND); messageBuilder.setHeader(TraceMessageHeaders.MESSAGE_SENT_FROM_CLIENT, true); } getSpanInjector().inject(span, new MessagingTextMap(messageBuilder)); MessageHeaderAccessor headers = MessageHeaderAccessor.getMutableAccessor(message); if (message instanceof ErrorMessage) { headers.copyHeaders(sleuthHeaders(messageBuilder.build().getHeaders())); return new ErrorMessage((Throwable) message.getPayload(), headers.getMessageHeaders()); } headers.copyHeaders(messageBuilder.build().getHeaders()); return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders()); }
Source:
public void testConnectionOnAfterGetConnectionAfterGettingFromDataSourceWithThrowingSQLException() throws SQLException { SQLException sqle = new SQLException(); when(mockedDataSource.getConnection()).thenThrow(sqle); when(mockedDataSource.getConnection(anyString(), anyString())).thenThrow(sqle); try { wrappedDataSource.getConnection(); } catch (SQLException expected) { } try { wrappedDataSource.getConnection("test", "test"); } catch (SQLException expected) { } verify(mockedJdbcListener, times(2)).onAfterGetConnection(connectionInformationWithoutConnection(), eq(sqle)); }

Target:
public void testConnectionOnAfterGetConnectionAfterGettingFromDataSourceWithThrowingSQLException() throws SQLException { SQLException sqle = new SQLException(); when(mockedDataSource.getConnection()).thenThrow(sqle); when(mockedDataSource.getConnection(anyString(), anyString())).thenThrow(sqle); try { wrappedDataSource.getConnection(); Assert.fail("exception should be thrown"); } catch (SQLException expected) { } try { wrappedDataSource.getConnection("test", "test"); Assert.fail("exception should be thrown"); } catch (SQLException expected) { } verify(mockedJdbcListener, times(2)).onAfterGetConnection(connectionInformationWithoutConnection(), eq(sqle)); }
Source:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> { return ImmutableList.of( createColumn("Type", Comparator.comparing(TmfGenericTreeEntry::getName)), new TmfTreeColumnData("legend")); }; }

Target:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> { return ImmutableList.of( createColumn(Messages.AbstractSegmentStoreScatterView_Type, Comparator.comparing(TmfGenericTreeEntry::getName)), new TmfTreeColumnData(Messages.AbstractSegmentStoreScatterView_Legend)); }; }
Source:
public void beforeBlockElement(ProgramState currentState, Tree element) { T tree = getTree(element); if (tree != null) { boolean isProblem = isProblem(tree, currentState); if (!isProblem) { problemMap.put(tree, true); } else if (!problemMap.containsKey(tree)) { problemMap.put(tree, false); } } }

Target:
public void beforeBlockElement(ProgramState currentState, Tree element) { T tree = getTree(element); if (tree != null) { boolean isProblem = isProblem(tree, currentState); if (!isProblem) { problemMap.put(tree, false); } else if (!problemMap.containsKey(tree)) { problemMap.put(tree, true); } } }
Source:
private static ASTNode findLastImportNode(@NotNull ASTNode node) { ASTNode lastImportNode = node; ASTNode nextNode = lastImportNode.getTreeNext(); while (nextNode != null && isApplicableForImportsRegion(nextNode.getElementType())) { lastImportNode = nextNode; nextNode = nextNode.getTreeNext(); } if (lastImportNode.getElementType() == WHITE_SPACE) { lastImportNode = lastImportNode.getTreePrev(); } return lastImportNode; }

Target:
private static ASTNode findLastImportNode(@NotNull ASTNode node) { ASTNode lastImportNode = node; ASTNode nextNode = UsefulPsiTreeUtil.getNextSiblingSkipWhiteSpacesAndComments(node); while (nextNode != null && isImportOrUsingStatement(nextNode.getElementType())) { lastImportNode = nextNode; nextNode = UsefulPsiTreeUtil.getNextSiblingSkipWhiteSpacesAndComments(nextNode); } if (lastImportNode.getElementType() == WHITE_SPACE) { lastImportNode = lastImportNode.getTreePrev(); } return lastImportNode; }
Source:
public void incrementReadOps() { statistics.incrementReadOps(1); }

Target:
private void incrementReadOps() { if (statistics != null) { statistics.incrementReadOps(1); } }
Source:
private void processTupleBatch(final TupleBatch tb) throws DbException { for (int agg = 0; agg < aggregators.length; ++agg) { for (int i = 0; i < tb.numTuples(); ++i) { Object[] groupAgg = getAggState(tb, i); if (aggregators[agg] .getClass() .getName() .equals(StatefulUserDefinedAggregator.class.getName())) { setBitset(tb, i, groupAgg); } else { aggregators[agg].addRow(tb, i, groupAgg[agg]); } } if (aggregators[agg] .getClass() .getName() .equals(StatefulUserDefinedAggregator.class.getName())) { updateltbGroups(tb); } } }

Target:
private void processTupleBatch(final TupleBatch tb) throws DbException { for (int agg = 0; agg < aggregators.length; ++agg) { for (int i = 0; i < tb.numTuples(); ++i) { Object[] groupAgg = getAggState(tb, i); if (aggregators[agg] instanceof StatefulUserDefinedAggregator) { setBitSet(tb, i); } else { aggregators[agg].addRow(tb, i, groupAgg[agg]); } } if (aggregators[agg] instanceof StatefulUserDefinedAggregator) { updateltbGroups(tb); } } }
Source:
public int hashCode() { return Objects.hash(getNumberOfValues(), booleanStatistics, integerStatistics, doubleStatistics, stringStatistics, dateStatistics, decimalStatistics, bloomFilter); }

Target:
public int hashCode() { return Objects.hash(hasNumberOfValues, getNumberOfValues(), booleanStatistics, integerStatistics, doubleStatistics, stringStatistics, dateStatistics, decimalStatistics, bloomFilter); }
Source:
private boolean isNodeHealthy(final String host) { boolean result = true; try { restTemplate.getForObject(this.scheme + host + this.healthEndpoint, String.class); } catch (final HttpStatusCodeException e) { log.error("Failed validating host {}", host, e); try { final Map<String, Object> responseMap = mapper.readValue(e.getResponseBodyAsByteArray(), TypeFactory.defaultInstance().constructMapType(Map.class, String.class, Object.class)); for (Map.Entry<String, Object> responseEntry : responseMap.entrySet()) { if (responseEntry.getValue() instanceof Map && !ignoreHealthEndPoints.contains(responseEntry.getKey()) && Status.OUT_OF_SERVICE.getCode() .equals(((Map) responseEntry.getValue()).get(PROPERTY_STATUS))) { result = false; } } } catch (Exception ex) { log.error("Failed reading the error response when validating host {}", host, ex); result = false; } } catch (final Exception e) { log.error("Unable to reach {}", host, e); result = false; } return result; }

Target:
private boolean isNodeHealthy(final String host) { boolean result = true; try { restTemplate.getForObject(this.scheme + host + this.healthEndpoint, String.class); } catch (final HttpStatusCodeException e) { log.error("Failed validating host {}", host, e); try { final Map<String, Object> responseMap = mapper.readValue(e.getResponseBodyAsByteArray(), TypeFactory.defaultInstance().constructMapType(Map.class, String.class, Object.class)); for (Map.Entry<String, Object> responseEntry : responseMap.entrySet()) { if (responseEntry.getValue() instanceof Map && !healthIndicatorsToIgnore.contains(responseEntry.getKey()) && !Status.UP.getCode().equals(((Map) responseEntry.getValue()).get(PROPERTY_STATUS))) { result = false; break; } } } catch (Exception ex) { log.error("Failed reading the error response when validating host {}", host, ex); result = false; } } catch (final Exception e) { log.error("Unable to reach {}", host, e); result = false; } return result; }
Source:
private void initFabTitle(@IdRes int id, @StringRes int fabTitle, @DrawableRes int icon) { int iconSkin = getCurrentColorPreference().iconSkin; SpeedDialActionItem.Builder builder = new SpeedDialActionItem.Builder(id, icon) .setLabel(fabTitle) .setFabBackgroundColor(iconSkin); switch (getAppTheme().getSimpleTheme()) { case DARK: builder.setLabelBackgroundColor(Utils.getColor(this, R.color.holo_dark_background)) .setLabelColor(Utils.getColor(this, R.color.text_dark)); fabBgView.setBackgroundResource(R.drawable.fab_shadow_dark); break; case BLACK: builder.setLabelBackgroundColor(Color.BLACK) .setLabelColor(Utils.getColor(this, R.color.text_dark)); fabBgView.setBackgroundResource(R.drawable.fab_shadow_black); break; } floatingActionButton.addActionItem(builder.create()); }

Target:
private void initFabTitle(@IdRes int id, @StringRes int fabTitle, @DrawableRes int icon) { int iconSkin = getCurrentColorPreference().iconSkin; SpeedDialActionItem.Builder builder = new SpeedDialActionItem.Builder(id, icon) .setLabel(fabTitle) .setFabBackgroundColor(iconSkin); switch (getAppTheme().getSimpleTheme()) { case LIGHT: fabBgView.setBackgroundResource(R.drawable.fab_shadow_light); break; case DARK: builder.setLabelBackgroundColor(Utils.getColor(this, R.color.holo_dark_background)) .setLabelColor(Utils.getColor(this, R.color.text_dark)); fabBgView.setBackgroundResource(R.drawable.fab_shadow_dark); break; case BLACK: builder.setLabelBackgroundColor(Color.BLACK) .setLabelColor(Utils.getColor(this, R.color.text_dark)); fabBgView.setBackgroundResource(R.drawable.fab_shadow_black); break; } floatingActionButton.addActionItem(builder.create()); }
Source:
public static void exit() { if(oldUserInfoValue != null) { System.setProperty("org.jbpm.ht.userinfo", oldUserInfoValue); } if(oldUserInfoImpl != null) { System.setProperty("org.jbpm.ht.custom.userinfo", oldUserInfoImpl); } }

Target:
public static void exit() { if(oldUserInfoValue != null) { System.setProperty("org.jbpm.ht.userinfo", oldUserInfoValue); } else { System.clearProperty("org.jbpm.ht.userinfo"); } if(oldUserInfoImpl != null) { System.setProperty("org.jbpm.ht.custom.userinfo", oldUserInfoImpl); } else { System.clearProperty("org.jbpm.ht.custom.userinfo"); } }
Source:
private Table<String, String, Map<String, String>> studyFileIdsToPositionSamples() { List<VariantSourceEntity> variantSourceEntities = variantSourceEntityRepository.findAll(); Table<String, String, Map<String, String>> studyFileIdsToPositionSamples = HashBasedTable.create(); for (VariantSourceEntity variantSourceEntity : variantSourceEntities) { if (variantSourceEntity.getSamplesPosition() == null) { continue; } String studyId = variantSourceEntity.getStudyId(); String fileId = variantSourceEntity.getFileId(); Map<String, Integer> samplesPosition = variantSourceEntity.getSamplesPosition(); Map<String, String> positionSamples = new HashMap<>(); for(Map.Entry<String, Integer> entry : samplesPosition.entrySet()) { positionSamples.put(Integer.toString(entry.getValue()), entry.getKey()); } studyFileIdsToPositionSamples.put(studyId, fileId, positionSamples); } return studyFileIdsToPositionSamples; }

Target:
private Table<String, String, Map<String, String>> studyFileIdsToPositionSamples() { List<VariantSourceEntity> variantSourceEntities = variantSourceEntityRepository.findAll(); Table<String, String, Map<String, String>> studyFileIdsToPositionSamples = HashBasedTable.create(); for (VariantSourceEntity variantSourceEntity : variantSourceEntities) { if (variantSourceEntity.getSamplesPosition() == null) { continue; } String studyId = variantSourceEntity.getStudyId(); String fileId = variantSourceEntity.getFileId(); Map<String, Integer> samplesPositionFromVariantSource = variantSourceEntity.getSamplesPosition(); Map<String, String> positionSamples = new HashMap<>(); for(Map.Entry<String, Integer> entry : samplesPositionFromVariantSource.entrySet()) { positionSamples.put(Integer.toString(entry.getValue()), entry.getKey()); } studyFileIdsToPositionSamples.put(studyId, fileId, positionSamples); } return studyFileIdsToPositionSamples; }
Source:
public void getSetMembers_shouldReturnTheSameAsgetSetMembersIfincludeRetiredIsTrue() throws Exception { executeDataSet(CONCEPT_XML_DATASET_PACKAGE_PATH); Concept c = new Concept(); Concept setMember1 = service.getConcept(867543); c.addSetMember(setMember1); Concept setMember2 = service.getConcept(1234567); c.addSetMember(setMember2); Concept setMember3 = service.getConcept(8675439); c.addSetMember(setMember3); Concept setMember4 = service.getConcept(12345679); c.addSetMember(setMember4); List<Concept> setMembers = c.getSetMembers(true); Assert.assertEquals(4, setMembers.size()); Assert.assertEquals(setMember1, setMembers.get(0)); Assert.assertEquals(setMember2, setMembers.get(1)); }

Target:
public void getSetMembers_shouldReturnTheSameAsgetSetMembersIfincludeRetiredIsTrue() throws Exception { executeDataSet(CONCEPT_XML_DATASET_PACKAGE_PATH); Concept c = new Concept(); Concept setMember1 = service.getConcept(867543); c.addSetMember(setMember1); Concept setMember2 = service.getConcept(1234567); c.addSetMember(setMember2); Concept setMember3 = service.getConcept(8675439); c.addSetMember(setMember3); Concept setMember4 = service.getConcept(12345679); c.addSetMember(setMember4); List<Concept> setMembers = c.getSetMembers(true); Assert.assertEquals(4, setMembers.size()); Assert.assertFalse(setMembers.get(0).getRetired()); Assert.assertFalse(setMembers.get(1).getRetired()); Assert.assertTrue(setMembers.get(2).getRetired()); Assert.assertTrue(setMembers.get(3).getRetired()); }
Source:
private synchronized void registerMetricWithFqn(String fullyQualifiedMetricName, Metric metric) { try { metricRegistry.register(fullyQualifiedMetricName, metric); registeredMetrics.add(fullyQualifiedMetricName); } catch (Exception e) { log.error("Unable to register metric {}", fullyQualifiedMetricName, e); } }

Target:
private synchronized void registerMetricWithFqn(String fullyQualifiedMetricName, Metric metric) { try { metricRegistry.register(fullyQualifiedMetricName, metric); registeredMetrics.add(fullyQualifiedMetricName); } catch (Exception e) { log.warn("Unable to register metric {}." + " This may occur if you are running integration tests that don't clean up completely after " + " themselves, or if you are trying to use multiple TransactionManagers concurrently in the same" + " JVM (e.g. in a KVS migration). If this is not the case, this is likely to be a product and/or" + " an AtlasDB bug. This is no cause for immediate alarm, but it does mean that your telemetry for" + " the aforementioned metric may be reported incorrectly. Turn on TRACE logging to see the full" + " exception.", SafeArg.of("metricName", fullyQualifiedMetricName)); log.trace("Full exception follows:", e); } }
Source:
public void shutDownTask(TaskDefinition task) throws SchedulerException { for (String taskDef : scheduledTasks) { if (taskDef.equals(task.getName())) { scheduledTasks.remove(taskDef); break; } } }

Target:
public void shutDownTask(TaskDefinition task) throws SchedulerException { if (scheduledTasks.contains(task)) { scheduledTasks.remove(task); } }
Source:
public static IProbeArrayStrategy createFor(final long classId, final ClassReader reader, final IExecutionDataAccessorGenerator accessorGenerator) { final String className = reader.getClassName(); final int version = getVersion(reader); final boolean withFrames = version >= Opcodes.V1_6; if (isInterfaceOrModule(reader)) { final ProbeCounter counter = getProbeCounter(reader); if (counter.getCount() == 0) { return new NoneProbeArrayStrategy(); } if (version >= Opcodes.V1_8 && counter.hasMethods()) { return new InterfaceFieldProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } else { return new LocalProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } } else { return new ClassFieldProbeArrayStrategy(className, classId, withFrames, accessorGenerator); } }

Target:
public static IProbeArrayStrategy createFor(final long classId, final ClassReader reader, final IExecutionDataAccessorGenerator accessorGenerator) { final String className = reader.getClassName(); final int version = BytecodeVersion.get(reader.b); final boolean withFrames = version >= Opcodes.V1_6; if (isInterfaceOrModule(reader)) { final ProbeCounter counter = getProbeCounter(reader); if (counter.getCount() == 0) { return new NoneProbeArrayStrategy(); } if (version >= Opcodes.V1_8 && counter.hasMethods()) { return new InterfaceFieldProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } else { return new LocalProbeArrayStrategy(className, classId, counter.getCount(), accessorGenerator); } } else { return new ClassFieldProbeArrayStrategy(className, classId, withFrames, accessorGenerator); } }
Source:
public String generateReport() { throw new UnsupportedOperationException("ERROR: generateReport() Not yet implemented."); }

Target:
public String generateReport() { if (error != null) { return "OntonotesTreebankReader produced "+treesProduced+" trees from "+fileindex+" of "+filelist.size()+" files.\n" +"Error encountered: "+error.getMessage(); } else { return "OntonotesTreebankReader produced "+treesProduced+" trees from "+fileindex+" of "+filelist.size()+" files."; } }
Source:
public DistStageAck executeOnSlave() { DefaultDistStageAck ack = newDefaultStageAck(); if (slaveState.getCacheWrapper() != null) { log.info("Wrapper already set on this slave, not starting it again."); return ack; } if (slaves != null) { if (!slaves.contains(getSlaveIndex())) { log.trace("Start request not targeted for this slave, ignoring."); return ack; } else { int index = 0; for (Integer slave : slaves) { if (slave.equals(getSlaveIndex())) break; index++; } staggerStartup(index, slaves.size()); } } else { staggerStartup(slaveIndex, getActiveSlaveCount()); } log.info("Ack master's StartCluster stage. Local address is: " + slaveState.getLocalAddress() + ". This slave's index is: " + getSlaveIndex()); confAttributes.put("productName", productName); confAttributes.put("configName", Utils.fileName2Config(config)); StartHelper.start(productName, config, confAttributes, slaveState, getSlaveIndex(), validateCluster ? new StartHelper.ClusterValidation(expectNumSlaves, getActiveSlaveCount()) : null, reachable, classLoadHelper, ack); if (!ack.isError()) { log.info("Successfully started cache wrapper on slave " + getSlaveIndex() + ": " + slaveState.getCacheWrapper()); } return ack; }

Target:
public DistStageAck executeOnSlave() { DefaultDistStageAck ack = newDefaultStageAck(); if (slaveState.getCacheWrapper() != null) { log.info("Wrapper already set on this slave, not starting it again."); return ack; } if (slaves != null) { if (!slaves.contains(getSlaveIndex())) { log.trace("Start request not targeted for this slave, ignoring."); return ack; } else { int index = 0; for (Integer slave : slaves) { if (slave.equals(getSlaveIndex())) break; index++; } staggerStartup(index, slaves.size()); } } else { staggerStartup(slaveIndex, getActiveSlaveCount()); } log.info("Ack master's StartCluster stage. Local address is: " + slaveState.getLocalAddress() + ". This slave's index is: " + getSlaveIndex()); StartHelper.start(productName, config, confAttributes, slaveState, getSlaveIndex(), validateCluster ? new StartHelper.ClusterValidation(expectNumSlaves, getActiveSlaveCount()) : null, reachable, classLoadHelper, ack); if (!ack.isError()) { log.info("Successfully started cache wrapper on slave " + getSlaveIndex() + ": " + slaveState.getCacheWrapper()); } return ack; }
Source:
public void bind(final String eventName, final SubscriptionEventListener listener) { validateArguments(eventName, listener); Set<SubscriptionEventListener> listeners = eventNameToListenerMap.get(eventName); synchronized (lock) { if (listeners == null) { listeners = new HashSet<SubscriptionEventListener>(); eventNameToListenerMap.put(eventName, listeners); } listeners.add(listener); } }

Target:
public void bind(final String eventName, final SubscriptionEventListener listener) { validateArguments(eventName, listener); synchronized (lock) { Set<SubscriptionEventListener> listeners = eventNameToListenerMap.get(eventName); if (listeners == null) { listeners = new HashSet<SubscriptionEventListener>(); eventNameToListenerMap.put(eventName, listeners); } listeners.add(listener); } }
Source:
@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = msc.getDatabase(getDefaultCatalog(conf), dbName); if (database != null) { return !ReplUtils.isFirstIncDone(database.getParameters()); } LOG.info("Unable to find database " + dbName); return true; } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }

Target:
@Override boolean replIsCompactionDisabledForDatabase(String dbName) throws TException { try { Database database = msc.getDatabase(getDefaultCatalog(conf), dbName); return ReplUtils.isFirstIncPending(database.getParameters()); } catch (NoSuchObjectException e) { LOG.info("Unable to find database " + dbName); return true; } }
Source:
private static boolean connectNsdManager(final Context context) { synchronized (nsdToolsLock) { boolean connected = new TimeBoundOperation(500) { NsdManager manager; @Override public void run() { manager = (NsdManager)context.getSystemService(Context.NSD_SERVICE); } public void commit() { mNsdManager = manager; } }.execute(); if(!connected) { Logger.log(AndroidLogger.TYPE_MAINTENANCE, "NSD Service Failed to connect"); } if(mNsdManager == null) { Log.d(TAG, "NSD Service Unavailable on device"); state = NsdState.Unsupported; } return connected; } }

Target:
private static boolean connectNsdManager(final Context context) { synchronized (nsdToolsLock) { boolean connected = new TimeBoundOperation(500) { NsdManager manager; @Override public void run() { manager = (NsdManager)context.getSystemService(Context.NSD_SERVICE); } @Override public void commit() { mNsdManager = manager; } }.execute(); if(!connected) { Logger.log(AndroidLogger.TYPE_MAINTENANCE, "NSD Service Failed to connect"); } if(mNsdManager == null) { Log.d(TAG, "NSD Service Unavailable on device"); state = NsdState.Unsupported; } return connected; } }
Source:
private String getEncodedParam(String fileName, String functionName, String type) { if (!fileNamesMap.containsKey(fileName)) { fileNamesMap.put(fileName, fileNamesCounter); fileNamesCounter++; } if (!functionNamesMap.containsKey(functionName)) { functionNamesMap.put(functionName, functionNamesCounter); functionNamesCounter++; } if (!typeMap.containsKey(type)) { typeMap.put(type, typeCounter); typeCounter++; } Integer fnNameIndex = functionNamesMap.get(functionName); Integer fileNameIndex = fileNamesMap.get(fileName); Integer typeIndex = typeMap.get(type); StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, fileNameIndex); Base64VLQ.encode(sb, fnNameIndex); Base64VLQ.encode(sb, typeIndex); } catch (IOException e) { throw new AssertionError(e); } String encodedParam = sb.toString(); if (!paramValueEncodings.containsKey(encodedParam)) { long uniqueIdentifier = getUniqueIdentifier(); if (uniqueIdentifier > Integer.MAX_VALUE) { throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64" + " VLQ"); } sb = new StringBuilder(); try { Base64VLQ.encode(sb, Math.toIntExact(uniqueIdentifier)); } catch (IOException e) { throw new AssertionError(e); } paramValueEncodings.put(encodedParam, sb.toString()); } return paramValueEncodings.get(encodedParam); }

Target:
private String getEncodedParam(String fileName, String functionName, String type) { fileNameToIndex.putIfAbsent(fileName, fileNameToIndex.size()); functionNameToIndex.putIfAbsent(functionName, functionNameToIndex.size()); typeToIndex.putIfAbsent(type, typeToIndex.size()); StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, fileNameToIndex.get(fileName)); Base64VLQ.encode(sb, functionNameToIndex.get(functionName)); Base64VLQ.encode(sb, typeToIndex.get(type)); } catch (IOException e) { throw new AssertionError(e); } String encodedParam = sb.toString(); if (!paramValueEncodings.containsKey(encodedParam)) { long uniqueIdentifier = generateUniqueIdentifier(); if (uniqueIdentifier > Integer.MAX_VALUE) { throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64" + " VLQ"); } sb = new StringBuilder(); try { Base64VLQ.encode(sb, Math.toIntExact(uniqueIdentifier)); } catch (IOException e) { throw new AssertionError(e); } paramValueEncodings.put(encodedParam, sb.toString()); } return paramValueEncodings.get(encodedParam); }
Source:
private void removeNetworksNoLongerAttachedViaLabel(Map<String, List<Network>> sourceNetworksByLabel, Map<String, Network> targetNetworksByName, PersistentHostSetupNetworksParameters params, Map<String, VdsNetworkInterface> nicsByNetwork, VdsNetworkInterface nic, String label) { List<Network> sourceLabeledNetworks = sourceNetworksByLabel.get(label); if (sourceLabeledNetworks != null) { for (Network sourceLabeledNetwork : sourceLabeledNetworks) { String networkName = sourceLabeledNetwork.getName(); if (isNetworkAssignedToNic(nic, networkName, nicsByNetwork)) { if (!isNetworkAssignedToCluster(targetNetworksByName, networkName)) { params.getRemovedUnmanagedNetworks().add(networkName); } else if (isAttachmentShouldBeRemoved(networkName, targetNetworksByName)) { Network targetNetwork = targetNetworksByName.get(networkName); NetworkAttachment attachment = getNetworkToAttachment().get(targetNetwork.getId()); params.getRemovedNetworkAttachments().add(attachment.getId()); } } } } }

Target:
private void removeNetworksNoLongerAttachedViaLabel(Map<String, List<Network>> sourceNetworksByLabel, Map<String, Network> targetNetworksByName, PersistentHostSetupNetworksParameters params, Map<String, VdsNetworkInterface> nicsByNetwork, VdsNetworkInterface nic, String label) { List<Network> sourceLabeledNetworks = sourceNetworksByLabel.get(label); if (sourceLabeledNetworks != null) { for (Network sourceLabeledNetwork : sourceLabeledNetworks) { String networkName = sourceLabeledNetwork.getName(); if (isNetworkAssignedToNic(nic, networkName, nicsByNetwork)) { if (!isNetworkAssignedToTargetCluster(targetNetworksByName, networkName)) { params.getRemovedUnmanagedNetworks().add(networkName); } else if (!isNetworkLabelExistInTargetHost(networkName, targetNetworksByName)) { Network targetNetwork = targetNetworksByName.get(networkName); NetworkAttachment attachment = getNetworkToAttachment().get(targetNetwork.getId()); params.getRemovedNetworkAttachments().add(attachment.getId()); } } } } }
Source:
private void testListenersHeartbeatTimeoutToCluster(boolean isSmartClient, int nodeCount) { factory.newInstances(null, nodeCount); ClientConfig clientConfig = createClientConfig(isSmartClient); ListenerConfig listenerConfig = new ListenerConfig(); CountDownLatch disconnectedLatch = new CountDownLatch(1); CountDownLatch connectedLatch = new CountDownLatch(2); listenerConfig.setImplementation((LifecycleListener) event -> { if (LifecycleEvent.LifecycleState.CLIENT_DISCONNECTED == event.getState()) { disconnectedLatch.countDown(); } if (LifecycleEvent.LifecycleState.CLIENT_CONNECTED == event.getState()) { connectedLatch.countDown(); } }); clientConfig.addListenerConfig(listenerConfig); client = factory.newHazelcastClient(clientConfig); setupListener(); for (HazelcastInstance instance : factory.getAllHazelcastInstances()) { blockMessagesFromInstance(instance, client); } assertOpenEventually(disconnectedLatch); for (HazelcastInstance instance : factory.getAllHazelcastInstances()) { unblockMessagesFromInstance(instance, client); } assertOpenEventually(connectedLatch); validateRegistrationsAndListenerFunctionality(); }

Target:
private void testListenersHeartbeatTimeoutToCluster(boolean isSmartClient, int nodeCount) { factory.newInstances(null, nodeCount); ClientConfig clientConfig = createClientConfig(isSmartClient); ListenerConfig listenerConfig = new ListenerConfig(); AtomicInteger connectCount = new AtomicInteger(); CountDownLatch disconnectedLatch = new CountDownLatch(1); CountDownLatch connectedLatch = new CountDownLatch(1); CountDownLatch reconnectedLatch = new CountDownLatch(1); listenerConfig.setImplementation((LifecycleListener) event -> { if (LifecycleEvent.LifecycleState.CLIENT_DISCONNECTED == event.getState()) { disconnectedLatch.countDown(); } if (LifecycleEvent.LifecycleState.CLIENT_CONNECTED == event.getState()) { int count = connectCount.incrementAndGet(); if (count == 1) { connectedLatch.countDown(); } else if (count == 2) { reconnectedLatch.countDown(); } } }); clientConfig.addListenerConfig(listenerConfig); client = factory.newHazelcastClient(clientConfig); assertOpenEventually(connectedLatch); setupListener(); for (HazelcastInstance instance : factory.getAllHazelcastInstances()) { blockMessagesFromInstance(instance, client); } assertOpenEventually(disconnectedLatch); for (HazelcastInstance instance : factory.getAllHazelcastInstances()) { unblockMessagesFromInstance(instance, client); } assertOpenEventually(reconnectedLatch); validateRegistrationsAndListenerFunctionality(); }
Source:
MultipleProvidersForPluginException(File pluginSrcFile, Iterable<ServerPluginProvider> providersHandlers) { super(pluginSrcFile.getAbsolutePath() + " is claimed to be handled by more than one plugin provider: " + providersHandlers); }

Target:
MultipleProvidersForPluginException(File pluginSrcFile, Iterable<ServerPluginProvider> providersHandlers) { super(pluginSrcFile.getAbsolutePath() + " is claimed to be handled by more than one plugin provider: " + providersListToString(providersHandlers)); }
Source:
public void requestUpdate(@Nullable IConcurrentModelListener listener) { ISegment[] segmentArray = Lists.newArrayList(fWrappedStore.iterator()).toArray(new ISegment[0]); NonNullUtils.checkNotNull(listener).setContents(segmentArray); }

Target:
public void requestUpdate(@Nullable IConcurrentModelListener listener) { ISegment[] segmentArray = Iterables.toArray(fWrappedStore, ISegment.class); NonNullUtils.checkNotNull(listener).setContents(segmentArray); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { LOG.debug("doFilter() started"); HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse) response; String authorizationHeader = httpServletRequest.getHeader(ConcurConstants.AUTHORIZATION_PROPERTY); if (StringUtils.isBlank(authorizationHeader)) { httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); LOG.debug("doFilter(): Concur authentication failed"); return; } else { final String encodedUserNameAndPasswordAsToken = authorizationHeader.replaceFirst(ConcurConstants.BASIC_AUTHENTICATION_SCHEME + " ", ""); if (!getConcurAuthenticationService().isConcurTokenValid(encodedUserNameAndPasswordAsToken)) { httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); LOG.debug("doFilter(): Concur authentication failed"); return; } } LOG.debug("doFilter(): Concur authentication was successful"); filterChain.doFilter(servletRequest, response); }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { LOG.debug("doFilter() started"); HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse) response; String authorizationHeader = httpServletRequest.getHeader(ConcurConstants.AUTHORIZATION_PROPERTY); if (StringUtils.isBlank(authorizationHeader)) { httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); LOG.error("doFilter(): Concur authentication failed: missing authorization header."); return; } else { final String encodedUserNameAndPasswordAsToken = authorizationHeader.replaceFirst(ConcurConstants.BASIC_AUTHENTICATION_SCHEME + " ", ""); if (!getConcurAuthenticationService().isConcurTokenValid(encodedUserNameAndPasswordAsToken)) { httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); LOG.error("doFilter(): Concur authentication failed: invalid token."); return; } } LOG.debug("doFilter(): Concur authentication was successful"); filterChain.doFilter(servletRequest, response); }
Source:
public void testDeleteStudyButNotAnalysys() { Analysis analysis1 = new Analysis("An1", "Analysis 1", "This is one analysis"); Analysis analysis2 = new Analysis("An2", "Analysis 2", "This is other analysis"); study1.addFileGenerator(analysis1); study1.addFileGenerator(analysis2); Study savedStudy = repository.save(study1); assertEquals(1, repository.count()); assertEquals(2, analysisRepository.count()); repository.delete(savedStudy); assertEquals(0, repository.count()); assertEquals(2, analysisRepository.count()); }

Target:
public void testDeleteStudyButNotAnalysys() { Analysis analysis1 = new Analysis("An1", "Analysis 1", "This is one analysis"); Analysis analysis2 = new Analysis("An2", "Analysis 2", "This is other analysis"); study1.addFileGenerator(analysis1); study1.addFileGenerator(analysis2); Study savedStudy = repository.save(study1); assertEquals(1, repository.count()); assertEquals(2, analysisRepository.count()); assertEquals(2, fileGeneratorRepository.count()); repository.delete(savedStudy); assertEquals(0, repository.count()); assertEquals(2, analysisRepository.count()); assertEquals(2, fileGeneratorRepository.count()); }