auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateUnregisteredEntity(VmTemplate entityFromConfiguration, OvfEntityData ovfEntityData) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_OVF); } if (entityFromConfiguration == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); } if (getImages().size() > 0 && !ImagesHandler.isImagesExists(getImages(), getStoragePool().getId())) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } for (DiskImage image : getImages()) { StorageDomain sd = getStorageDomainDao().getForStoragePool( image.getStorageIds().get(0), getStoragePool().getId()); if (!validate(new StorageDomainValidator(sd).isDomainExistAndActive())) { return false; } } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED, String.format("$domainId %1$s", getParameters().getStorageDomainId()), String.format("$domainType %1$s", getStorageDomain().getStorageDomainType())); } return true; }

Target:
private boolean validateUnregisteredEntity(VmTemplate entityFromConfiguration, OvfEntityData ovfEntityData) { if (ovfEntityData == null && !getParameters().isImportAsNewEntity()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_UNSUPPORTED_OVF); } if (entityFromConfiguration == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); } if (!ImagesHandler.isImagesExists(getImages(), getStoragePool().getId())) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } for (DiskImage image : getImages()) { StorageDomain sd = getStorageDomainDao().getForStoragePool( image.getStorageIds().get(0), getStoragePool().getId()); if (!validate(new StorageDomainValidator(sd).isDomainExistAndActive())) { return false; } } if (!getStorageDomain().getStorageDomainType().isDataDomain()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_UNSUPPORTED, String.format("$domainId %1$s", getParameters().getStorageDomainId()), String.format("$domainType %1$s", getStorageDomain().getStorageDomainType())); } return true; }
Source:
public void cancelRunningStackConfigUpdates(Environment environment) { try { FlowLog flowLog = flowLogDBService.getLastFlowLogByResourceCrnOrName(environment.getResourceCrn()); if (!flowLog.getFinalized() && flowLog.getFlowType() != null && flowLog.getFlowType().getCanonicalName() .equals(EnvStackConfigUpdatesFlowConfig.class.getCanonicalName())) { LOGGER.info("Canceling running Stack config update flow for environment {}", environment.getResourceCrn()); EnvironmentInMemoryStateStore.put(environment.getId(), PollGroup.CANCELLED); flowCancelService.cancelFlowSilently(flowLog); } else { LOGGER.debug("No running Stack config update flow to cancel"); } } catch (NotFoundException nfe) { LOGGER.info("No flow logs found for environment {}", environment.getResourceCrn()); } }

Target:
public void cancelRunningStackConfigUpdates(Environment environment) { List<FlowLog> flowLogs = flowLogDBService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(environment.getId()); if (!flowLogs.isEmpty() && flowLogs.get(0).getFlowType() != null && EnvStackConfigUpdatesFlowConfig.class.equals(flowLogs.get(0).getFlowType())) { LOGGER.info("Canceling running Stack config update flow for environment {}", environment.getResourceCrn()); EnvironmentInMemoryStateStore.put(environment.getId(), PollGroup.CANCELLED); flowCancelService.cancelFlowSilently(flowLogs.get(0)); } else { LOGGER.debug("No running Stack config update flow to cancel"); } }
Source:
public KStream<K, V> repartition(final Repartitioned<K, V> repartitioned) { Objects.requireNonNull(repartitioned, "repartitioned parameter can't be null"); final RepartitionedInternal<K, V> repartitionedInternal = new RepartitionedInternal<>(repartitioned); final String name = new NamedInternal(repartitionedInternal.name()) .orElseGenerateWithPrefix(builder, REPARTITION_NAME); final Serde<K> keySerde = repartitionedInternal.keySerde() == null ? this.keySerde : repartitionedInternal.keySerde(); final Serde<V> valueSerde = repartitionedInternal.valueSerde() == null ? this.valSerde : repartitionedInternal.valueSerde(); final UnoptimizableRepartitionNodeBuilder<K, V> unoptimizableRepartitionNodeBuilder = UnoptimizableRepartitionNode.repartitionNodeBuilder(); final String repartitionSourceName = createUnoptimizableRepartitionSource( builder, keySerde, valueSerde, name, repartitionedInternal.toInternalTopicProperties(), repartitionedInternal.streamPartitioner(), unoptimizableRepartitionNodeBuilder ); final UnoptimizableRepartitionNode<K, V> unoptimizableRepartitionNode = unoptimizableRepartitionNodeBuilder.build(); builder.addGraphNode(this.streamsGraphNode, unoptimizableRepartitionNode); return new KStreamImpl<>( repartitionSourceName, keySerde, valueSerde, sourceNodes, false, unoptimizableRepartitionNode, builder ); }

Target:
public KStream<K, V> repartition(final Repartitioned<K, V> repartitioned) { return doRepartition(repartitioned); }
Source:
public void testRegexMapper() { Roles roles = createRoles("123-user", "joe", "abc-admin"); RegexRoleMapper roleMapper = new RegexRoleMapper(); roleMapper.initialize(".*-([a-z]*)", "$1",true); Roles mappedRoles = roleMapper.mapRoles(roles); assertTrue(mappedRoles.contains("user")); assertTrue(mappedRoles.contains("admin")); assertFalse(mappedRoles.contains("abc-admin")); assertFalse(mappedRoles.contains("123-user")); assertTrue(mappedRoles.contains("joe")); Iterator<String> iterator = mappedRoles.iterator(); int count = 0; while (iterator.hasNext()) { iterator.next(); count++; } assertEquals(count, 3); }

Target:
public void testRegexMapper() { Roles roles = createRoles("123-user", "joe", "abc-admin"); RegexRoleMapper roleMapper = new RegexRoleMapper.Builder().setPattern(".*-([a-z]*)").setReplacement("$1").setKeepNonMapped(true).build(); Roles mappedRoles = roleMapper.mapRoles(roles); assertTrue(mappedRoles.contains("user")); assertTrue(mappedRoles.contains("admin")); assertFalse(mappedRoles.contains("abc-admin")); assertFalse(mappedRoles.contains("123-user")); assertTrue(mappedRoles.contains("joe")); Iterator<String> iterator = mappedRoles.iterator(); int count = 0; while (iterator.hasNext()) { iterator.next(); count++; } assertEquals(count, 3); }
Source:
public Map<String, String> getCommonLabels() { return KubernetesUtils.getCommonLabels(getClusterId()); }

Target:
public Map<String, String> getCommonLabels() { return Collections.unmodifiableMap(KubernetesUtils.getCommonLabels(getClusterId())); }
Source:
private RecordingCommand sortFiltersIfNeeded(Collection<Notification> notifications) { RecordingCommand recordingCommand = null; for (Notification notification : notifications) { if (notification.getNotifier() instanceof DDiagram && notification.getFeature().equals(DiagramPackage.eINSTANCE.getDDiagram_ActivatedFilters()) && (Notification.ADD == notification.getEventType() || Notification.ADD_MANY == notification.getEventType())) { DDiagram diagram = (DDiagram) notification.getNotifier(); List<FilterDescription> descriptions = new ArrayList<>(diagram.getActivatedFilters()); List<FilterDescription> sortedFilters = FilterService.sortFilters(descriptions); boolean listsAreEqual = sortedFilters.size() == diagram.getActivatedFilters().size(); if (listsAreEqual) { int i = 0; while (listsAreEqual && i < sortedFilters.size()) { listsAreEqual = sortedFilters.get(i).equals(diagram.getActivatedFilters().get(i)); i++; } } if (!listsAreEqual) { recordingCommand = new RecordingCommand(domain) { @Override protected void doExecute() { diagram.getActivatedFilters().clear(); diagram.getActivatedFilters().addAll(sortedFilters); } }; } break; } } return recordingCommand; }

Target:
private RecordingCommand sortFiltersIfNeeded(Collection<Notification> notifications) { RecordingCommand recordingCommand = null; for (Notification notification : notifications) { if (notification.getNotifier() instanceof DDiagram && notification.getFeature().equals(DiagramPackage.eINSTANCE.getDDiagram_ActivatedFilters()) && (Notification.ADD == notification.getEventType() || Notification.ADD_MANY == notification.getEventType())) { DDiagram diagram = (DDiagram) notification.getNotifier(); List<FilterDescription> descriptions = new ArrayList<>(diagram.getActivatedFilters()); List<FilterDescription> sortedFilters = FilterService.sortFilters(descriptions); if (!Iterables.elementsEqual(sortedFilters, diagram.getActivatedFilters())) { recordingCommand = new RecordingCommand(domain) { @Override protected void doExecute() { diagram.getActivatedFilters().clear(); diagram.getActivatedFilters().addAll(sortedFilters); } }; } break; } } return recordingCommand; }
Source:
public boolean isConfigured() { return !CommonUtils.isBlank(getBaseURL()); }

Target:
public boolean isConfigured() { return !CommonUtils.isBlank(baseURL); }
Source:
protected Table constructTable(Class<?> entityClass, EntityDictionary metaDataDictionary) { return new SQLTable(entityClass, metaDataDictionary, defaultConnectionDetails, connectionDetailsMap); }

Target:
protected Table constructTable(Class<?> entityClass, EntityDictionary metaDataDictionary) { String dbConnectionName = null; Annotation annotation = EntityDictionary.getFirstAnnotation(entityClass, Arrays.asList(FromTable.class, FromSubquery.class)); if (annotation instanceof FromTable) { dbConnectionName = ((FromTable) annotation).dbConnectionName(); } else if (annotation instanceof FromSubquery) { dbConnectionName = ((FromSubquery) annotation).dbConnectionName(); } ConnectionDetails connectionDetails; if (dbConnectionName == null || dbConnectionName.trim().isEmpty()) { connectionDetails = defaultConnectionDetails; } else { connectionDetails = connectionDetailsMap.get(dbConnectionName); } return new SQLTable(entityClass, metaDataDictionary, connectionDetails); }
Source:
public CommitterPreferencePresenter(CommitterPreferenceView view, GitLocalizationConstant constant, PreferencesManager preferencesManager) { super(constant.committerTitle(), constant.committerPreferenceCategory(), null); this.view = view; this.preferencesManager = preferencesManager; String userName = preferencesManager.getValue(COMMITTER_NAME); String userEmail = preferencesManager.getValue(COMMITTER_EMAIL); name = userName == null ? DEFAULT_COMMITTER_NAME : userName; email = userEmail == null ? DEFAULT_COMMITTER_EMAIL : userEmail; view.setDelegate(this); }

Target:
public CommitterPreferencePresenter(CommitterPreferenceView view, GitLocalizationConstant constant, PreferencesManager preferencesManager) { super(constant.committerTitle(), constant.committerPreferenceCategory(), null); this.view = view; this.preferencesManager = preferencesManager; name = firstNonNull(preferencesManager.getValue(COMMITTER_NAME), DEFAULT_COMMITTER_NAME); email = firstNonNull(preferencesManager.getValue(COMMITTER_EMAIL), DEFAULT_COMMITTER_EMAIL); view.setDelegate(this); }
Source:
public static ByteBuf encode( ByteBufAllocator allocator, int streamId, boolean fragmentFollows, ByteBuf metadata, ByteBuf data) { if (metadata == null) { metadata = Unpooled.EMPTY_BUFFER; } return FLYWEIGHT.encode(allocator, streamId, fragmentFollows, metadata, data); }

Target:
public static ByteBuf encode( ByteBufAllocator allocator, int streamId, boolean fragmentFollows, ByteBuf metadata, ByteBuf data) { return FLYWEIGHT.encode(allocator, streamId, fragmentFollows, metadata, data); }
Source:
public ListBoxBaseDefinition getDefaultField() { StringListBoxFieldDefinition result = new StringListBoxFieldDefinition(); result.setStandaloneClassName(String.class.getName()); return result; }

Target:
public ListBoxBaseDefinition getDefaultField() { return new StringListBoxFieldDefinition(); }
Source:
public void whenListSubscriptionsLimitAndOffsetAreRespected() throws ServiceUnavailableException { final List<Subscription> testSubscriptions = createRandomSubscriptions(10); testSubscriptions.forEach(this::insertSubscriptionToDB); final List<Subscription> expectedSubscriptions = testSubscriptions.stream() .sorted(SUBSCRIPTION_CREATION_DATE_DESC_COMPARATOR) .collect(toList()); expectedSubscriptions.subList(0, 2).clear(); expectedSubscriptions.subList(3, expectedSubscriptions.size()).clear(); final List<Subscription> subscriptions = repository.listSubscriptions(emptySet(), Optional.empty(), 2, 3); assertThat(subscriptions, equalTo(expectedSubscriptions)); }

Target:
public void whenListSubscriptionsLimitAndOffsetAreRespected() throws ServiceUnavailableException { final List<Subscription> testSubscriptions = createRandomSubscriptions(10); testSubscriptions.forEach(this::insertSubscriptionToDB); testSubscriptions.sort(SUBSCRIPTION_CREATION_DATE_DESC_COMPARATOR); testSubscriptions.subList(0, 2).clear(); testSubscriptions.subList(3, testSubscriptions.size()).clear(); final List<Subscription> subscriptions = repository.listSubscriptions(emptySet(), Optional.empty(), 2, 3); assertThat(subscriptions, equalTo(testSubscriptions)); }
Source:
private synchronized void startDelayedWrite() { if (OneSignal.appContext == null) return; startThread(); scheduleFlushToDiskJob(); }

Target:
private synchronized void startDelayedWrite() { if (OneSignal.appContext == null) return; startThread(); scheduleFlushToDisk(); }
Source:
private static Supplier<ResultSet> getResultSet(Supplier<PreparedStatement> supplier, StatementContext ctx) { return () -> { try { ResultSet rs = supplier.get().getResultSet(); if (rs != null) { ctx.addCleanable(forResultSet(rs)); } return rs; } catch (SQLException e) { throw new ResultSetException("Could not get result set", e, ctx); } }; }

Target:
private static Supplier<ResultSet> getResultSet(Supplier<PreparedStatement> supplier, StatementContext ctx) { return () -> { try { ResultSet rs = supplier.get().getResultSet(); if (rs == null) { throw new NoResultsException("Statement returned no results", ctx); } ctx.addCleanable(forResultSet(rs)); return rs; } catch (SQLException e) { throw new ResultSetException("Could not get result set", e, ctx); } }; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if ((authentication != null) && authentication.isAuthenticated() && !authentication.getName() .equals(ANONYMOUS_USERNAME) && !httpRequest.getRequestURI().toLowerCase().equals(CHANGE_PASSWORD_URI.toLowerCase())) { User user = userService.getUser(authentication.getName()); if (user == null) { throw new RuntimeException("Unknown username [" + authentication.getName() + "]"); } if (user.isChangePassword() != null && user.isChangePassword()) { redirectStrategy.sendRedirect(httpRequest, httpResponse, CHANGE_PASSWORD_URI); return; } } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if ((authentication != null) && authentication.isAuthenticated() && !authentication.getName() .equals(ANONYMOUS_USERNAME) && !httpRequest.getRequestURI().equalsIgnoreCase(CHANGE_PASSWORD_URI)) { User user = userService.getUser(authentication.getName()); if (user == null) { throw new RuntimeException("Unknown username [" + authentication.getName() + "]"); } if (user.isChangePassword() != null && user.isChangePassword()) { redirectStrategy.sendRedirect(httpRequest, httpResponse, CHANGE_PASSWORD_URI); return; } } chain.doFilter(request, response); }
Source:
public BuyOrder(String inputStock, int sizeIn, double priceIn, Trader traderIn) { stockSymbol = inputStock; size = sizeIn; price = priceIn; trader = traderIn; }

Target:
public BuyOrder(String inputStock, int sizeIn, double priceIn, Trader traderIn) { super(); stockSymbol = inputStock; size = sizeIn; price = priceIn; trader = traderIn; }
Source:
private void resolveSetterConflicts(Map<String, List<Method>> conflictingSetters) { for (String propName : conflictingSetters.keySet()) { List<Method> setters = conflictingSetters.get(propName); Class<?> getterType = getTypes.get(propName); Method match = null; for (Method setter : setters) { if (setter.getParameterTypes()[0].equals(getterType)) { match = setter; break; } match = pickBetterSetter(match, setter, propName); } if (match != null) { addSetMethod(propName, match); } } }

Target:
private void resolveSetterConflicts(Map<String, List<Method>> conflictingSetters) { for (String propName : conflictingSetters.keySet()) { List<Method> setters = conflictingSetters.get(propName); Class<?> getterType = getTypes.get(propName); boolean isGetterAmbiguous = getMethods.get(propName) instanceof AmbiguousMethodInvoker; boolean isSetterAmbiguous = false; Method match = null; for (Method setter : setters) { if (!isGetterAmbiguous && setter.getParameterTypes()[0].equals(getterType)) { match = setter; break; } if (!isSetterAmbiguous) { match = pickBetterSetter(match, setter, propName); isSetterAmbiguous = match == null; } } if (match != null) { addSetMethod(propName, match); } } }
Source:
public void run() { getNodeEngine().getExecutionService().execute(ExecutionService.ASYNC_EXECUTOR, () -> { getNodeEngine().getClusterService().changeClusterState(newState); sendResponse(null); }); }

Target:
public void run() { ILogger logger = getNodeEngine().getLogger(getClass()); ExecutionService executionService = getNodeEngine().getExecutionService(); Future<Void> future = executionService.submit( ExecutionService.ASYNC_EXECUTOR, () -> { getNodeEngine().getClusterService().changeClusterState(newState); return null; }); executionService.asCompletableFuture(future).whenComplete( withTryCatch( logger, (empty, error) -> sendResponse(error != null ? peel(error) : null))); }
Source:
private Provider<OpenStackImageProviderProperties> createOpenStackV2Provider(String name, String url, String tenant) { Provider<OpenStackImageProviderProperties> result = mock(Provider.class); when(result.getName()).thenReturn(name); when(result.getType()).thenReturn(ProviderType.OPENSTACK_IMAGE); when(result.getAuthUrl()).thenReturn("http://localhost:35357/v2.0/"); OpenStackImageProviderProperties props = mock(OpenStackImageProviderProperties.class); when(props.getTenantName()).thenReturn(tenant); when(result.getAdditionalProperties()).thenReturn(props); when(result.getUrl()).thenReturn(url); return result; }

Target:
private Provider<OpenStackImageProviderProperties> createOpenStackV2Provider(String name, String url, String tenant) { Provider<OpenStackImageProviderProperties> result = mock(Provider.class); when(result.getName()).thenReturn(name); when(result.getType()).thenReturn(ProviderType.OPENSTACK_IMAGE); when(result.getAuthUrl()).thenReturn(AUTH_URL_LOCALHOST); OpenStackImageProviderProperties props = mock(OpenStackImageProviderProperties.class); when(props.getTenantName()).thenReturn(tenant); when(result.getAdditionalProperties()).thenReturn(props); when(result.getUrl()).thenReturn(url); return result; }
Source:
public void setModified(DateTime date) throws InvalidArgumentException { if (date == null) { throw new InvalidArgumentException("Date cannot be empty"); } copyConditions.put("x-amz-copy-source-if-modified-since", RFC1123_DATE_TIME_FORMATTER.print(date)); }

Target:
public void setModified(DateTime date) throws InvalidArgumentException { if (date == null) { throw new InvalidArgumentException("Date cannot be empty"); } copyConditions.put("x-amz-copy-source-if-modified-since", date.toString(DateFormat.HTTP_HEADER_DATE_FORMAT)); }
Source:
public void multipleClientsCanShareGlobalThreads() { List<RemoteLockService> lockServiceList = ImmutableList.of( getLockService(CLIENT_1), getLockService(CLIENT_2), getLockService(CLIENT_3)); assertThat(lockAndUnlockAndCountExceptions(lockServiceList, LOCAL_TC_LIMIT + GLOBAL_TC_LIMIT / 3)) .isEqualTo(0); }

Target:
public void multipleClientsCanShareGlobalThreads() throws Exception { List<RemoteLockService> lockServiceList = ImmutableList.of( getLockService(CLIENT_1), getLockService(CLIENT_2), getLockService(CLIENT_3)); assertThat(lockAndUnlockAndCountExceptions(lockServiceList, LOCAL_TC_LIMIT + SHARED_TC_LIMIT / 3)) .isEqualTo(0); }
Source:
protected void configure() { setName(SERVICE_NAME); setDescription("Dictionary ops service."); addHandler(new DictionaryOpsServiceHandler()); }

Target:
protected void configure() { setName(SERVICE_NAME); setDescription("Service to retrieve values from a Dictionary."); addHandler(new DictionaryOpsServiceHandler()); }
Source:
public List<VariableDeclarator> localVariablesExposedToChild(Node child) { for (int i=0;i<wrappedNode.getResources().size();i++) { if (child == wrappedNode.getResources().get(i)) { return wrappedNode.getResources().subList(0, i).stream() .map(e -> e instanceof VariableDeclarationExpr ? ((VariableDeclarationExpr) e).getVariables() : Collections.<VariableDeclarator>emptyList()) .flatMap(List::stream) .collect(Collectors.toList()); } } if (child == wrappedNode.getTryBlock()) { List<VariableDeclarator> res = new LinkedList<>(); for (Expression expr : wrappedNode.getResources()) { if (expr instanceof VariableDeclarationExpr) { res.addAll(((VariableDeclarationExpr)expr).getVariables()); } } return res; } return Collections.emptyList(); }

Target:
public List<VariableDeclarator> localVariablesExposedToChild(Node child) { NodeList<Expression> resources = wrappedNode.getResources(); for (int i=0;i<resources.size();i++) { if (child == resources.get(i)) { return resources.subList(0, i).stream() .map(e -> e instanceof VariableDeclarationExpr ? ((VariableDeclarationExpr) e).getVariables() : Collections.<VariableDeclarator>emptyList()) .flatMap(List::stream) .collect(Collectors.toList()); } } if (child == wrappedNode.getTryBlock()) { List<VariableDeclarator> res = new LinkedList<>(); for (Expression expr : resources) { if (expr instanceof VariableDeclarationExpr) { res.addAll(((VariableDeclarationExpr)expr).getVariables()); } } return res; } return Collections.emptyList(); }
Source:
public void onNetworkCapabilitiesChanged() { synchronized (mNetworkPoliciesSecondLock) { updateNetworkRulesNL(); } }

Target:
public void onNetworkCapabilitiesChanged() { mHandler.post(() -> { synchronized (mNetworkPoliciesSecondLock) { updateNetworkRulesNL(); } }); }
Source:
TaskData getTaskData(AbstractRepositoryConnector connector, IProgressMonitor monitor) throws CoreException { if (taskId != null && taskKey != null && connector.supportsSearchByTaskKey(repository)) { try { TaskData data = getTaskDataByKey(connector, monitor); if (data != null) { return data; } } catch (CoreException | RuntimeException e) { } try { return connector.getTaskData(repository, taskId, monitor); } catch (RuntimeException e) { throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, String.format("Could not find task with ID %s", taskId), e)); } } else if (taskId != null) { return connector.getTaskData(repository, taskId, monitor); } else if (taskKey != null && connector.supportsSearchByTaskKey(repository)) { return getTaskDataByKey(connector, monitor); } return null; }

Target:
TaskData getTaskData(AbstractRepositoryConnector connector, IProgressMonitor monitor) throws CoreException { if (taskId != null && taskKey != null && connector.supportsSearchByTaskKey(repository)) { try { TaskData data = getTaskDataByKey(connector, monitor); if (data != null) { return data; } } catch (CoreException | RuntimeException e) { } try { return connector.getTaskData(repository, taskId, monitor); } catch (CoreException | RuntimeException e) { throw new CoreException(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind("Could not find task with ID \"{0}\" on repository {1}.", taskId, repository), e)); } } else if (taskId != null) { return connector.getTaskData(repository, taskId, monitor); } else if (taskKey != null && connector.supportsSearchByTaskKey(repository)) { return getTaskDataByKey(connector, monitor); } return null; }
Source:
private List<String> resolveAttributes(MBeanServer mbeanServer, ObjectName on) throws Exception { List<String> resolvedAttributes = new ArrayList<>(); if (attribute == null || attribute.isEmpty()) { for (MBeanAttributeInfo mBeanAttributeInfo : mbeanServer.getMBeanInfo(on).getAttributes()) { resolvedAttributes.add(mBeanAttributeInfo.getName()); } } else { String[] attributes = attribute.split(","); resolvedAttributes.addAll(Arrays.asList(attributes)); } return resolvedAttributes; }

Target:
private List<String> resolveAttributes(MBeanServer mbeanServer, ObjectName on) { if (attributes.isEmpty()) { return findAllAttributes(mbeanServer, on); } return attributes; }
Source:
BlobBatch(String accountUrl, HttpPipeline pipeline) { this.contentId = new AtomicInteger(0); this.batchBoundary = String.format(BATCH_BOUNDARY_TEMPLATE, UUID.randomUUID()); this.contentType = String.format(REQUEST_CONTENT_TYPE_TEMPLATE, batchBoundary); boolean batchHeadersPolicySet = false; HttpPipelineBuilder batchPipelineBuilder = new HttpPipelineBuilder().httpClient(this::setupBatchOperation); for (int i = 0; i < pipeline.getPolicyCount(); i++) { HttpPipelinePolicy policy = pipeline.getPolicy(i); if (policy instanceof SharedKeyCredentialPolicy) { batchHeadersPolicySet = true; batchPipelineBuilder.policies(this::cleanseHeaders); } batchPipelineBuilder.policies(pipeline.getPolicy(i)); } if (!batchHeadersPolicySet) { batchPipelineBuilder.policies(this::cleanseHeaders); } this.batchClient = new BlobClientBuilder() .endpoint(accountUrl) .blobName("") .pipeline(batchPipelineBuilder.build()) .buildAsyncClient(); this.batchOperationQueue = new ConcurrentLinkedDeque<>(); this.batchRequest = new ArrayList<>(); this.batchMapping = new ConcurrentHashMap<>(); }

Target:
BlobBatch(String accountUrl, HttpPipeline pipeline) { this.contentId = new AtomicInteger(0); this.batchBoundary = String.format(BATCH_BOUNDARY_TEMPLATE, UUID.randomUUID()); this.contentType = String.format(REQUEST_CONTENT_TYPE_TEMPLATE, batchBoundary); boolean batchHeadersPolicySet = false; HttpPipelineBuilder batchPipelineBuilder = new HttpPipelineBuilder().httpClient(this::setupBatchOperation); for (int i = 0; i < pipeline.getPolicyCount(); i++) { HttpPipelinePolicy policy = pipeline.getPolicy(i); if (policy instanceof SharedKeyCredentialPolicy) { batchHeadersPolicySet = true; batchPipelineBuilder.policies(this::cleanseHeaders, this::setRequestUrl); } batchPipelineBuilder.policies(pipeline.getPolicy(i)); } if (!batchHeadersPolicySet) { batchPipelineBuilder.policies(this::cleanseHeaders, this::setRequestUrl); } this.blobAsyncClient = new BlobClientBuilder() .endpoint(accountUrl) .blobName("") .pipeline(batchPipelineBuilder.build()) .buildAsyncClient(); this.batchOperationQueue = new ConcurrentLinkedDeque<>(); this.batchRequest = new ArrayList<>(); this.batchMapping = new ConcurrentHashMap<>(); }
Source:
public static void tearDownAfterClass() { }

Target:
public static void tearDownAfterClass() { WebsocketEchoTestBase.cleanupFiles(); }
Source:
public static IntSet make(Set<Integer> x) { int[] vals = new int[x.size()]; Iterator<Integer> vs = x.iterator(); Arrays.setAll(vals, i -> vs.next()); return make(vals); }

Target:
public static IntSet make(Set<Integer> x) { int[] vals = x.stream().mapToInt(Integer::intValue).toArray(); return make(vals); }
Source:
private static ThrottleSetting loadThrottleCommand(Element elem, Warrant w) { long time = 0; try { time = elem.getAttribute("time").getLongValue(); } catch (org.jdom2.DataConversionException dce) { log.warn("error loading throttle command"); } Attribute attr = elem.getAttribute("command"); String command = null; if (attr != null) { command = attr.getValue(); } else { log.error("Command type is null for throttleSetting in warrant {}", command, w.getDisplayName()); return null; } attr = elem.getAttribute("value"); String value = null; if (attr != null) value =attr.getValue(); attr = elem.getAttribute("block"); String block = null; if (attr != null) block =attr.getValue(); float speed = 0.0f; attr = elem.getAttribute("trackSpeed"); if (attr != null) { try { speed = attr.getFloatValue(); } catch (DataConversionException ex) { speed = 0.0f; log.error("Unable to read speed of command.", ex); } } return new ThrottleSetting(time, command, value, block, speed); }

Target:
private static ThrottleSetting loadThrottleCommand(Element elem, Warrant w) { long time = 0; try { time = elem.getAttribute("time").getLongValue(); } catch (org.jdom2.DataConversionException dce) { log.warn("error loading throttle command"); } Attribute attr = elem.getAttribute("command"); String command = null; if (attr != null) { command = attr.getValue(); } else { log.error("Command type is null. ThrottleSetting not loaded for warrant {}", w.getDisplayName()); return null; } attr = elem.getAttribute("value"); String value = null; if (attr != null) value =attr.getValue(); attr = elem.getAttribute("block"); String block = null; if (attr != null) block =attr.getValue(); float speed = 0.0f; attr = elem.getAttribute("trackSpeed"); if (attr != null) { try { speed = attr.getFloatValue(); } catch (DataConversionException ex) { speed = 0.0f; log.error("Unable to read speed of command.", ex); } } return new ThrottleSetting(time, command, value, block, speed); }
Source:
private synchronized void handleNewCheckpoint(CheckpointBarrier barrier) { long barrierId = barrier.getId(); if (!allBarriersReceivedFuture.isDone()) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", handler.taskName, barrierId, currentReceivedCheckpointId); long currentCheckpointId = currentReceivedCheckpointId; handler.runInTaskThread(() -> handler.notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)), "notifyAbort"); } currentReceivedCheckpointId = barrierId; Arrays.fill(storeNewBuffers, true); numBarriersReceived = 0; allBarriersReceivedFuture = new CompletableFuture<>(); channelStateWriter.start(barrierId, barrier.getCheckpointOptions()); }

Target:
private synchronized void handleNewCheckpoint(CheckpointBarrier barrier) throws IOException { long barrierId = barrier.getId(); if (!allBarriersReceivedFuture.isDone()) { LOG.warn("{}: Received checkpoint barrier for checkpoint before completing current checkpoint {}. " + "Skipping current checkpoint.", handler.taskName, barrierId, currentReceivedCheckpointId); long currentCheckpointId = currentReceivedCheckpointId; handler.executeInTaskThread(() -> handler.notifyAbort(currentCheckpointId, new CheckpointException( "Barrier id: " + barrierId, CheckpointFailureReason.CHECKPOINT_DECLINED_SUBSUMED)), "notifyAbort"); } currentReceivedCheckpointId = barrierId; Arrays.fill(storeNewBuffers, true); numBarriersReceived = 0; allBarriersReceivedFuture = new CompletableFuture<>(); channelStateWriter.start(barrierId, barrier.getCheckpointOptions()); }
Source:
public Image getImage(AttributeType type) { if (type == AttributeType.IDENTIFYING_ATTRIBUTE) { return getManagedImage("bullet_red.png"); } if (type == AttributeType.INSENSITIVE_ATTRIBUTE) { return getManagedImage("bullet_green.png"); } if (type == AttributeType.SENSITIVE_ATTRIBUTE) { return getManagedImage("bullet_purple.png"); } if (type == AttributeType.QUASI_IDENTIFYING_ATTRIBUTE) { return getManagedImage("bullet_yellow.png"); } return null; }

Target:
public Image getImage(AttributeType type) { if (type == AttributeType.IDENTIFYING_ATTRIBUTE) { return getManagedImage("bullet_red.png"); } else if (type == AttributeType.INSENSITIVE_ATTRIBUTE) { return getManagedImage("bullet_green.png"); } else if (type == AttributeType.SENSITIVE_ATTRIBUTE) { return getManagedImage("bullet_purple.png"); } else if (type == AttributeType.QUASI_IDENTIFYING_ATTRIBUTE) { return getManagedImage("bullet_yellow.png"); } else { throw new IllegalArgumentException("Unknown attribute type '" + type + "'"); } }
Source:
public void testProcessActionSameActionAndResult01() { when(requestDataValueProcessor.processAction( (HttpServletRequest) (anyObject()), anyString())).thenReturn( "action"); when(requestDataValueProcessor.processAction( (HttpServletRequest) (anyObject()), anyString(), Mockito .isNull())).thenReturn("action"); String result = compositeRequestDataValueProcessor.processAction( request, "action"); assertThat(result, is("action")); }

Target:
public void testProcessActionSameActionAndResult01() { when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString())).thenReturn("action"); when(requestDataValueProcessor.processAction(any( HttpServletRequest.class), anyString(), nullable(String.class))) .thenReturn("action"); String result = compositeRequestDataValueProcessor.processAction( request, "action"); assertThat(result, is("action")); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DateStatistics that = (DateStatistics) o; return hasMinMax == that.hasMinMax && minimum == that.minimum && maximum == that.maximum; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DateStatistics that = (DateStatistics) o; return Objects.equals(getMin(), that.getMin()) && Objects.equals(getMax(), that.getMax()); }
Source:
public static ErrorMessageFactory shouldBePackagePrivate(Class<?> actual) { return new ClassModifierShouldBe(actual, true, "Package-Private"); }

Target:
public static ErrorMessageFactory shouldBePackagePrivate(Class<?> actual) { return new ClassModifierShouldBe(actual, true, "package-private"); }
Source:
public String buildJVMArgumentWithoutMemory() { StringBuilder jvmArguments = new StringBuilder(); if (securityEnabled) { jvmArguments = addSecurityManager(jvmArguments); jvmArguments = addCurrentAgentPath(jvmArguments); jvmArguments = addConsoleIP(jvmArguments); jvmArguments = addDnsIP(jvmArguments); } else { jvmArguments.append(properties.getProperty("grinder.jvm.arguments", "")); jvmArguments = addNativeLibraryPath(jvmArguments); } jvmArguments = addParam(jvmArguments, properties.getProperty("grinder.param", "")); jvmArguments = addPythonPathJvmArgument(jvmArguments); jvmArguments = addCustomDns(jvmArguments); jvmArguments = addBasePath(jvmArguments); if (server) { jvmArguments = addServerMode(jvmArguments); } if (StringUtils.isNotBlank(additionalJavaOpt)) { jvmArguments = addAdditionalJavaOpt(jvmArguments); } return jvmArguments.toString(); }

Target:
public String buildJVMArgumentWithoutMemory() { StringBuilder jvmArguments = new StringBuilder(); if (securityEnabled) { jvmArguments = addSecurityManager(jvmArguments); jvmArguments = addCurrentAgentPath(jvmArguments); jvmArguments = addConsoleIP(jvmArguments); jvmArguments = addDnsIP(jvmArguments); } else { jvmArguments.append(properties.getProperty("grinder.jvm.arguments", "")); jvmArguments = addNativeLibraryPath(jvmArguments); } jvmArguments = addParam(jvmArguments, properties.getProperty("grinder.param", "")); jvmArguments = addPythonPathJvmArgument(jvmArguments); jvmArguments = addCustomDns(jvmArguments); jvmArguments = addUserDir(jvmArguments); if (server) { jvmArguments = addServerMode(jvmArguments); } if (StringUtils.isNotBlank(additionalJavaOpt)) { jvmArguments = addAdditionalJavaOpt(jvmArguments); } return jvmArguments.toString(); }
Source:
private static AbstractVexAction[] computeQuickFixActions(final VexWidget widget) { final ElementName[] names = widget.getValidMorphElements(); final AbstractVexAction[] actions = new AbstractVexAction[names.length]; final int caretOffset = widget.getCaretOffset(); final IElement element = widget.getDocument().getElementForInsertionAt(caretOffset); final String sourceName = element.getPrefixedName(); for (int i = 0; i < names.length; i++) { final QualifiedName qualifiedName = names[i].getQualifiedName(); if (!widget.canMorph(qualifiedName)) { continue; } final String message = Messages.getString("command.convertElement.dynamicCommandName"); final String text = MessageFormat.format(message, sourceName, names[i]); final Icon icon = Icon.CONVERT; actions[i] = new AbstractVexAction(widget, names[i], text, icon) { @Override public void execute(final VexWidget vexWidget) { getWidget().morph(qualifiedName); } }; } return actions; }

Target:
private static AbstractVexAction[] computeQuickFixActions(final VexWidget widget) { final ElementName[] names = widget.getValidMorphElements(); final AbstractVexAction[] actions = new AbstractVexAction[names.length]; final int caretOffset = widget.getCaretOffset(); final IElement element = widget.getDocument().getElementForInsertionAt(caretOffset); final String sourceName = element.getPrefixedName(); for (int i = 0; i < names.length; i++) { final QualifiedName qualifiedName = names[i].getQualifiedName(); final String message = Messages.getString("command.convertElement.dynamicCommandName"); final String text = MessageFormat.format(message, sourceName, names[i]); final Icon icon = Icon.CONVERT; actions[i] = new AbstractVexAction(widget, names[i], text, icon) { @Override public void execute(final VexWidget vexWidget) { getWidget().morph(qualifiedName); } }; } return actions; }
Source:
static ColumnStatus columnStatusWithValue(long value) { return ImmutableColumnStatus.builder().exists(true).value(value).build(); }

Target:
static Optional<ColumnStatus> columnStatusWithValue(long value) { return Optional.of(ImmutableColumnStatus.builder().value(value).build()); }
Source:
private Function<AuthorisationGatewayRequest, GatewayOrder> buildAuthoriseOrderFor(String frontendUrl) { return request -> { EpdqOrderRequestBuilder epdqOrderRequestBuilder = anEpdqAuthoriseOrderRequestBuilder(); if (request.getGatewayAccount().isRequires3ds()) { epdqOrderRequestBuilder = anEpdq3DsAuthoriseOrderRequestBuilder(frontendUrl); } return epdqOrderRequestBuilder .withOrderId(request.getChargeExternalId()) .withPassword(request.getGatewayAccount().getCredentials().get(CREDENTIALS_PASSWORD)) .withShaInPassphrase(request.getGatewayAccount().getCredentials().get( CREDENTIALS_SHA_IN_PASSPHRASE)) .withUserId(request.getGatewayAccount().getCredentials().get(CREDENTIALS_USERNAME)) .withMerchantCode(request.getGatewayAccount().getCredentials().get(CREDENTIALS_MERCHANT_ID)) .withDescription(request.getDescription()) .withAmount(request.getAmount()) .withAuthorisationDetails(request.getAuthCardDetails()) .build(); }; }

Target:
private Function<AuthorisationGatewayRequest, GatewayOrder> buildAuthoriseOrderFor(String frontendUrl) { return request -> { EpdqOrderRequestBuilder epdqOrderRequestBuilder = request.getGatewayAccount().requires3ds() ? anEpdq3DsAuthoriseOrderRequestBuilder(frontendUrl) : anEpdqAuthoriseOrderRequestBuilder(); return epdqOrderRequestBuilder .withOrderId(request.getChargeExternalId()) .withPassword(request.getGatewayAccount().getCredentials().get(CREDENTIALS_PASSWORD)) .withShaInPassphrase(request.getGatewayAccount().getCredentials().get( CREDENTIALS_SHA_IN_PASSPHRASE)) .withUserId(request.getGatewayAccount().getCredentials().get(CREDENTIALS_USERNAME)) .withMerchantCode(request.getGatewayAccount().getCredentials().get(CREDENTIALS_MERCHANT_ID)) .withDescription(request.getDescription()) .withAmount(request.getAmount()) .withAuthorisationDetails(request.getAuthCardDetails()) .build(); }; }
Source:
private DataPointAssignment marshallToDomain(DataPointAssignmentDto dto) { final DataPointAssignment dpa = new DataPointAssignment(); BeanUtils.copyProperties(dto, dpa); if (dto.getKeyId() != null) { dpa.setKey(KeyFactory.createKey("DataPointAssignment", dto.getKeyId())); } dpa.setDataPointIds(dto.getDataPointIds()); return dpa; }

Target:
private DataPointAssignment marshallToDomain(DataPointAssignmentDto dto) { final DataPointAssignment dpa = new DataPointAssignment(); BeanUtils.copyProperties(dto, dpa); if (dto.getKeyId() != null) { dpa.setKey(KeyFactory.createKey("DataPointAssignment", dto.getKeyId())); } return dpa; }
Source:
public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(REQUIRES_TENANT, "true"); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); return properties; }

Target:
public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(REQUIRES_TENANT, "true"); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); properties.setProperty(SERVICE_TYPE, ServiceType.BLOCK_STORAGE); return properties; }
Source:
public void sendsMessageToBout() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final long number = alias.inbox().start(); final Bout bout = alias.inbox().bout(number); bout.friends().invite(alias.name()); final RqWithAuth req = new RqWithAuth( urn, new RqMultipart.Fake( new RqFake( "POST", String.format("/b/%d/attach", number) ), new RqWithHeaders( new RqLive( new ByteArrayInputStream("content".getBytes()) ), String.format("POST /b/%d/attach HTTP/1.1", number), "Content-Disposition: form-data; name=\"file\"; filename=\"some.xml\"", "Content-Type: application/xml" ) ) ); try { new FkBout(".*", new TkAttach(base)).route(req); } catch (final RsForward rsf) { MatcherAssert.assertThat( bout.messages().iterate().iterator().next().text(), Matchers.containsString("some.xml") ); throw rsf; } }

Target:
public void sendsMessageToBout() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff1"); final Alias alias = user.aliases().iterate().iterator().next(); final long number = alias.inbox().start(); final Bout bout = alias.inbox().bout(number); bout.friends().invite(alias.name()); final RqWithAuth request = new RqWithAuth( urn, new RqMultipart.Fake( TkAttachTest.fake(number), new RqWithHeaders( new RqLive( new ByteArrayInputStream("content1".getBytes()) ), String.format(TkAttachTest.POST_URL, number), "Content-Disposition: form-data; name=\"file\"; filename=\"some.xml\"", "Content-Type: application/xml" ) ) ); try { new FkBout(".+", new TkAttach(base)).route(request); } catch (final RsForward response) { MatcherAssert.assertThat( response, new HmRsStatus(HttpURLConnection.HTTP_SEE_OTHER) ); } MatcherAssert.assertThat( bout.messages().iterate().iterator().next().text(), Matchers.containsString("attachment \"some.xml\"") ); }
Source:
public synchronized void createIndex(DBObject keys, DBObject options, DBEncoder encoder) throws MongoException { DBCollection indexColl = fongoDb.getCollection("system.indexes"); BasicDBObject rec = new BasicDBObject(); rec.append("v", 1); rec.append("key", keys); rec.append("ns", this.getDB().getName() + "." + this.getName()); if (options != null && !options.containsField("name")) { StringBuilder sb = new StringBuilder(); boolean firstLoop = true; for (String keyName : keys.keySet()) { if (!firstLoop) { sb.append("_"); } sb.append(keyName).append("_").append(keys.get(keyName)); firstLoop = false; } rec.append("name", sb.toString()); } else { rec.append("name", options.get("name")); } if (indexColl.findOne(rec) != null) { return; } boolean unique = options != null && Boolean.TRUE.equals(options.get("unique")); if (unique) { rec.append("unique", unique); } rec.putAll(options); Index index = new Index((String) rec.get("name"), keys, unique); List<List<Object>> notUnique = index.addAll(_idIndex.values()); if (!notUnique.isEmpty()) { if (enforceDuplicates(getWriteConcern())) { fongoDb.errorResult(11000, "E11000 duplicate key error index: " + getFullName() + "." + rec.get("name") + " dup key: { : " + notUnique + " }").throwOnError(); } return; } indexes.put(new HashSet<String>(index.getFields()), index); indexColl.insert(rec); }

Target:
public synchronized void createIndex(DBObject keys, DBObject options, DBEncoder encoder) throws MongoException { DBCollection indexColl = fongoDb.getCollection("system.indexes"); BasicDBObject rec = new BasicDBObject(); rec.append("v", 1); rec.append("key", keys); rec.append("ns", this.getDB().getName() + "." + this.getName()); if (options != null && !options.containsField("name")) { StringBuilder sb = new StringBuilder(); boolean firstLoop = true; for (String keyName : keys.keySet()) { if (!firstLoop) { sb.append("_"); } sb.append(keyName).append("_").append(keys.get(keyName)); firstLoop = false; } rec.append("name", sb.toString()); } else { rec.append("name", options.get("name")); } if (indexColl.findOne(rec) != null) { return; } boolean unique = options != null && Boolean.TRUE.equals(options.get("unique")); if (unique) { rec.append("unique", unique); } rec.putAll(options); Index index = new Index((String) rec.get("name"), keys, unique, false); List<List<Object>> notUnique = index.addAll(_idIndex.values()); if (!notUnique.isEmpty()) { if (enforceDuplicates(getWriteConcern())) { fongoDb.errorResult(11000, "E11000 duplicate key error index: " + getFullName() + "." + rec.get("name") + " dup key: { : " + notUnique + " }").throwOnError(); } return; } indexes.add(index); indexColl.insert(rec); }
Source:
public Document getDocumentById(String id) { ObjectId objectId = ObjectId.valueOf(id); switch (objectId.getType()) { case REPOSITORY: return cmisRepository(); case CONTENT: return cmisContent(objectId.getIdentifier()); case OBJECT: return cmisObject(objectId.getIdentifier()); default: return null; } }

Target:
public Document getDocumentById(String id) { ObjectId objectId = ObjectId.valueOf(id); switch (objectId.getType()) { case REPOSITORY_INFO: return cmisRepository(); case CONTENT: return cmisContent(objectId.getIdentifier()); case OBJECT: return cmisObject(objectId.getIdentifier()); default: return null; } }
Source:
private double getP99ForLeaderTime() { return conjureTimelockServiceBlockingMetrics .leaderTime() .getSnapshot() .get99thPercentile(); }

Target:
private double getP99ForLeaderTime() { return getP99(() -> conjureTimelockServiceBlockingMetrics.leaderTime()); }
Source:
public void testWithEmptyArrays() { final byte[] authenthicationKey = new byte[1]; final byte[] encryptionKey = new byte[1]; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); assertNotNull(keySet); assertNotNull(keySetDto); assertNotNull(keySetDto.getAuthenticationKey()); assertNotNull(keySetDto.getEncryptionKey()); assertEquals(keySet.getAuthenticationKey().length, keySetDto.getAuthenticationKey().length); assertEquals(keySet.getEncryptionKey().length, keySetDto.getEncryptionKey().length); }

Target:
public void testWithEmptyArrays() { final byte[] authenthicationKey = new byte[1]; final byte[] encryptionKey = new byte[1]; final KeySet keySet = new KeySet(authenthicationKey, encryptionKey); final KeySetDto keySetDto = this.configurationMapper.map(keySet, KeySetDto.class); assertNotNull(keySetDto); assertNotNull(keySetDto.getAuthenticationKey()); assertNotNull(keySetDto.getEncryptionKey()); assertEquals(keySet.getAuthenticationKey().length, keySetDto.getAuthenticationKey().length); assertEquals(keySet.getEncryptionKey().length, keySetDto.getEncryptionKey().length); }