auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<Patch> NopolPatchGeneration(String cpClassFolder,String cpTestFolder, String srcClassFolder, String srcTestFolder, String destSrcTestFolder, String destCpTestFolder, String dependencies, String[] testClasses) { String sources = srcClassFolder+File.pathSeparatorChar+srcTestFolder+File.pathSeparatorChar+destSrcTestFolder; String cp = cpClassFolder+File.pathSeparatorChar+cpTestFolder+File.pathSeparatorChar+destCpTestFolder+File.pathSeparatorChar+dependencies; String[] sourcesArray = sources.split(File.pathSeparator); File[] sourceFiles = new File[sourcesArray.length]; for(int i = 0; i<sourcesArray.length; i++){ sourceFiles[i] = FileLibrary.openFrom(sourcesArray[i]); } URL[] classPath = JavaLibrary.classpathFrom(cp); logger.debug("Launch nopol with:"); logger.debug("sources = "+sources); logger.debug("getClasspath = "+cp); logger.debug("getTestClasses = "+testClasses); Config config = new Config(sourceFiles, classPath, testClasses); config.setMaxTimeInMinutes(maxTime); config.setType(nopolType); NoPol nopol = new NoPol(config); List<Patch> currentPatches; currentPatches = nopol.build(); return currentPatches; }

Target:
public static List<Patch> NopolPatchGeneration(String cpClassFolder,String cpTestFolder, String srcClassFolder, String srcTestFolder, String destSrcTestFolder, String destCpTestFolder, String dependencies, String[] testClasses) { String sources = srcClassFolder+File.pathSeparatorChar+srcTestFolder+File.pathSeparatorChar+destSrcTestFolder; String cp = cpClassFolder+File.pathSeparatorChar+cpTestFolder+File.pathSeparatorChar+destCpTestFolder+File.pathSeparatorChar+dependencies; String[] sourcesArray = sources.split(File.pathSeparator); File[] sourceFiles = new File[sourcesArray.length]; for(int i = 0; i<sourcesArray.length; i++){ sourceFiles[i] = FileLibrary.openFrom(sourcesArray[i]); } URL[] classPath = JavaLibrary.classpathFrom(cp); logger.debug("Launch nopol with:"); logger.debug("sources = "+sources); logger.debug("classpath = "+cp); logger.debug("testClasses = "+testClasses); NopolContext nopolContext = new NopolContext(sourceFiles, classPath, testClasses); nopolContext.setMaxTimeInMinutes(maxTime); nopolContext.setType(nopolType); NoPol nopol = new NoPol(nopolContext); List<Patch> currentPatches; currentPatches = nopol.build(); return currentPatches; }
Source:
public SchedulerTask<?> createTaskInstance( String taskType ) throws IllegalArgumentException { try { return lookupTask( taskType ); } catch ( ComponentLookupException e ) { this.logger.debug( "Failed to load Schedule Task: " + taskType, e ); throw new IllegalArgumentException( "Could not create task of type" + taskType, e ); } }

Target:
public SchedulerTask<?> createTaskInstance( String taskType ) throws IllegalArgumentException { try { return lookupTask( taskType ); } catch ( ComponentLookupException e ) { throw new IllegalArgumentException( "Could not create task of type" + taskType, e ); } }
Source:
public int getVisitsByPartOfDay(PartOfDay partOfDay) { int count = 0; for (ExplorationStatisticsEntry location : distinctLocations.values()) { if (PartOfDay.getCorrespondingConstant(location.getDiscoveredDate()).getName().getSingular().equalsIgnoreCase( partOfDay.getName().getSingular())) { count++; } } return count; }

Target:
public int getVisitsByPartOfDay(PartOfDay partOfDay) { int count = 0; for (ExplorationStatisticsEntry location : distinctLocations.values()) { PartOfDay day = PartOfDay.getCorrespondingConstant(location.getDiscoveredDate()); String locationName = day.getName().getSingular(); if (locationName.equalsIgnoreCase(partOfDay.getName().getSingular())) { count++; } } return count; }
Source:
public void testGetTableDescriptorsByTableNameWithNullAndEmptyList() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { HTableDescriptor[] descriptor = admin.getTableDescriptorsByTableName(null); assertTrue(descriptor.length > 0); } catch (Exception e) { actualError = e; } assertNull(actualError); try { HTableDescriptor[] descriptor = admin.getTableDescriptorsByTableName(ImmutableList.<TableName>of()); assertTrue(descriptor.length > 0); } catch (Exception e) { actualError = e; } assertNull(actualError); } }

Target:
public void testGetTableDescriptorsByTableNameWithNullAndEmptyList() throws IOException { try (Admin admin = getConnection().getAdmin()) { assertTrue(admin.getTableDescriptorsByTableName(null).length > 0); assertTrue(admin.getTableDescriptorsByTableName(ImmutableList.<TableName>of()).length > 0); } }
Source:
PkgControl(final PkgControl parent, final String subPkg, final boolean regex) { this.parent = parent; if (regex || parent.regex) { final String parentRegex = ensureRegex(parent.fullPackage, parent.regex); final String thisRegex = addGroupingIfNecessary(ensureRegex(subPkg, regex), regex); fullPackage = parentRegex + DOT_REGEX + thisRegex; patternForPartialMatch = createPatternForPartialMatch(); patternForExactMatch = createPatternForExactMatch(); this.regex = true; } else { fullPackage = parent.fullPackage + DOT + subPkg; patternForPartialMatch = null; patternForExactMatch = null; this.regex = false; } parent.children.add(this); }

Target:
PkgControl(final PkgControl parent, final String subPkg, final boolean regex) { this.parent = parent; if (regex || parent.regex) { final String parentRegex = ensureSelfContainedRegex(parent.fullPackage, parent.regex); final String thisRegex = ensureSelfContainedRegex(subPkg, regex); fullPackage = parentRegex + DOT_REGEX + thisRegex; patternForPartialMatch = createPatternForPartialMatch(fullPackage); patternForExactMatch = createPatternForExactMatch(fullPackage); this.regex = true; } else { fullPackage = parent.fullPackage + DOT + subPkg; patternForPartialMatch = null; patternForExactMatch = null; this.regex = false; } parent.children.add(this); }
Source:
public void testPullMultiLanguage() throws Exception { final long languageId = 2; final ContentType contentType = contentTypeAPI.search(" velocity_var_name = 'News'").get(0); final ContentletDataGen contentletDataGen = new ContentletDataGen(contentType.inode()).host(defaultHost).languageId(languageId); contentletDataGen.setProperty("title", "El Titulo"); contentletDataGen.setProperty("byline", "El Sub Titulo"); contentletDataGen.setProperty("story", "EL Relato"); contentletDataGen.setProperty("sysPublishDate", new Date()); contentletDataGen.setProperty("urlTitle", "/news/el-titulo"); final Contentlet contentlet = contentletDataGen.nextPersisted(); final ContentTool contentTool = getContentTool(languageId); try { Thread.sleep(2000); Assert.assertTrue( contentletAPI.isInodeIndexed(contentlet.getInode()) ); final List<ContentMap> results = contentTool.pull( "+structurename:news +(conhost:"+defaultHost.getIdentifier()+" conhost:system_host) +working:true", 6, "score News.sysPublishDate desc" ); Assert.assertFalse(results.isEmpty()); for(ContentMap cm : results) { Assert.assertEquals(cm.getContentObject().getLanguageId(), languageId); } } finally { contentletDataGen.remove(contentlet); } }

Target:
public void testPullMultiLanguage() throws Exception { final long languageId = 2; final ContentType contentType = contentTypeAPI.search(" velocity_var_name = 'News'").get(0); final ContentletDataGen contentletDataGen = new ContentletDataGen(contentType.inode()).host(defaultHost).languageId(languageId); contentletDataGen.setProperty("title", "El Titulo"); contentletDataGen.setProperty("byline", "El Sub Titulo"); contentletDataGen.setProperty("story", "EL Relato"); contentletDataGen.setProperty("sysPublishDate", new Date()); contentletDataGen.setProperty("urlTitle", "/news/el-titulo"); final Contentlet contentlet = contentletDataGen.nextPersisted(); final ContentTool contentTool = getContentTool(languageId); try { final List<ContentMap> results = contentTool.pull( "+structurename:news +(conhost:"+defaultHost.getIdentifier()+" conhost:system_host) +working:true", 6, "score News.sysPublishDate desc" ); Assert.assertFalse(results.isEmpty()); for(ContentMap cm : results) { Assert.assertEquals(cm.getContentObject().getLanguageId(), languageId); } } finally { contentletDataGen.remove(contentlet); } }
Source:
private void doClose(Handler<AsyncResult<Void>> handler) { ContextImpl handlerContext = vertx.getOrCreateContext(); context.executeBlocking((Future<Void> res) -> { try { ch.close(); res.complete(null); } catch (IOException e) { res.fail(e); } }, ar -> { if (handler != null) { handlerContext.runOnContext(v -> handler.handle(ar)); } }); }

Target:
private void doClose(Handler<AsyncResult<Void>> handler) { ContextImpl handlerContext = vertx.getOrCreateContext(); handlerContext.executeBlocking(res -> { try { ch.close(); res.complete(null); } catch (IOException e) { res.fail(e); } }, handler); }
Source:
public ScriptedCollectionSetBuilder(File script, BundleContext bundleContext) throws IOException, ScriptException { if (!script.canRead()) { throw new IllegalStateException("Cannot read script at '" + script + "'."); } final String ext = Files.getFileExtension(script.getAbsolutePath()); ScriptEngineManager manager; if (bundleContext != null) { manager = new OSGiScriptEngineManager(bundleContext); } else { manager = new ScriptEngineManager(); } final ScriptEngine engine = manager.getEngineByExtension(ext); if (engine == null) { throw new IllegalStateException("No engine found for extension: " + ext); } if (!(engine instanceof Compilable)) { throw new IllegalStateException("Only engines that can compile scripts are supported."); } final Compilable compilable = (Compilable) engine; try (FileReader reader = new FileReader(script)) { compiledScript = compilable.compile(reader); } }

Target:
public ScriptedCollectionSetBuilder(File script, BundleContext bundleContext) throws IOException, ScriptException { this(script, new OSGiScriptEngineManager(bundleContext)); }
Source:
public boolean supports(final Credential credential) { return (DuoCredential.class.isAssignableFrom(credential.getClass()) || credential instanceof DuoDirectCredential) && supports((MfaCredential) credential); }

Target:
public boolean supports(final Credential credential) { return (DuoCredential.class.isAssignableFrom(credential.getClass()) || credential instanceof DuoDirectCredential) && supports((MultiInstanceMfaCredential) credential); }
Source:
public IInlinedAnnotationAction getAction(MouseEvent e) { return null; }

Target:
public Consumer<MouseEvent> getAction(MouseEvent e) { return null; }
Source:
public void testOnCompletedMsgWithoutOperationId() { final AvroElasticMemoryMessage msgWithoutOperationId = AvroElasticMemoryMessage.newBuilder() .setType(Type.ResultMsg) .setSrcId("") .setDestId("") .build(); callbackRouter.onCompleted(msgWithoutOperationId); assertTrue("No exceptions were thrown.", true); }

Target:
public void testOnCompletedMsgWithoutOperationId() { final AvroElasticMemoryMessage msgWithoutOperationId = AvroElasticMemoryMessage.newBuilder() .setType(Type.ResultMsg) .setSrcId("") .setDestId("") .build(); callbackRouter.onCompleted(msgWithoutOperationId); }
Source:
private FileListCacheValue getFileList() { readLock.lock(); try { FileListCacheValue fileList = (FileListCacheValue) cache.get(fileListCacheKey); if (fileList == null) { fileList = new FileListCacheValue(); FileListCacheValue prev = (FileListCacheValue) cache.putIfAbsent(fileListCacheKey, fileList); if (prev != null) { fileList = prev; } } if (trace) log.trace("Refreshed file listing view"); return fileList; } finally { readLock.unlock(); } }

Target:
private FileListCacheValue getFileList() { FileListCacheValue fileList = (FileListCacheValue) cache.get(fileListCacheKey); if (fileList == null) { fileList = new FileListCacheValue(); FileListCacheValue prev = (FileListCacheValue) cache.putIfAbsent(fileListCacheKey, fileList); if (prev != null) { fileList = prev; } } if (trace) log.trace("Refreshed file listing view"); return fileList; }
Source:
public void setUp() { storagePool = createStoragePool(new Version(3, 4)); initCommand(); when(facade.getStoragePoolDao()).thenReturn(storagePoolDAO); when(facade.getStoragePoolDao().get(storagePool.getId())).thenReturn(storagePool); when(facade.getStorageDomainDao()).thenReturn(storageDomainDAO); when(storageDomainDAO.getAllForStoragePool(storagePool.getId())).thenReturn(attachedDomains); when(facade.getStoragePoolIsoMapDao()).thenReturn(storagePoolIsoMapDAO); when(storagePoolIsoMapDAO.getAllForStorage(any(Guid.class))).thenReturn(isoMap); }

Target:
public void setUp() { storagePool = createStoragePool(Version.v3_4); initCommand(); when(facade.getStoragePoolDao()).thenReturn(storagePoolDAO); when(facade.getStoragePoolDao().get(storagePool.getId())).thenReturn(storagePool); when(facade.getStorageDomainDao()).thenReturn(storageDomainDAO); when(storageDomainDAO.getAllForStoragePool(storagePool.getId())).thenReturn(attachedDomains); when(facade.getStoragePoolIsoMapDao()).thenReturn(storagePoolIsoMapDAO); when(storagePoolIsoMapDAO.getAllForStorage(any(Guid.class))).thenReturn(isoMap); }
Source:
private void validateVcardAddressBody(Body body) throws ParamValidationException, PropertyValidationException { validateSemanticTagVcardAddressBody(body); if (StringUtils.isBlank(body.getInternalType().toString()) || !BodyInternalTypes.isVcardAddressTagBody(body.getInternalType())) throw new ParamValidationException(ParamValidationException.MESSAGE_MISSING_MANDATORY_FIELD, I18nConstants.MESSAGE_MISSING_MANDATORY_FIELD, new String[] { "tag.body.type", body.getType().toString() }); }

Target:
private void validateVcardAddressBody(Body body) throws ParamValidationException, PropertyValidationException { validateSemanticTagVcardAddressBody(body); }
Source:
public void rateOfReturnCalculationTest() { List<Transaction> transactions = new ArrayList<>(); transactions.add(new PortfolioTransaction(LocalDateTime.of(2019, 01, 14, 12, 00), security.getCurrencyCode(), 1000L, security, 10L, Type.BUY, 0L, 0L)); transactions.add(createDividendTransaction(LocalDateTime.of(2019, 01, 15, 12, 00))); transactions.add(createDividendTransaction(LocalDateTime.of(2020, 01, 15, 12, 00))); CostCalculation cost = Calculation.perform(CostCalculation.class, converter, security, transactions); DividendCalculation dividends = Calculation.perform(DividendCalculation.class, converter, security, transactions); assertEquals(0.1, dividends.getRateOfReturnPerYear(), 0.0); }

Target:
public void rateOfReturnCalculationTest() { List<Transaction> transactions = new ArrayList<>(); transactions.add(new PortfolioTransaction(LocalDateTime.of(2019, 01, 14, 12, 00), security.getCurrencyCode(), 1000L, security, 10L, Type.BUY, 0L, 0L)); transactions.add(createDividendTransaction(LocalDateTime.of(2019, 01, 15, 12, 00))); transactions.add(createDividendTransaction(LocalDateTime.of(2020, 01, 15, 12, 00))); @SuppressWarnings("unused") CostCalculation cost = Calculation.perform(CostCalculation.class, converter, security, transactions); DividendCalculation dividends = Calculation.perform(DividendCalculation.class, converter, security, transactions); assertEquals(0.1, dividends.getRateOfReturnPerYear(), 0.0); }
Source:
protected HttpURLConnection put(String url, String body) throws IOException { if (url == null) { throw new IllegalArgumentException("SimplePush Update URL cannot be null"); } byte[] bytes = body.getBytes(UTF_8); HttpURLConnection conn = getConnection(url); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestProperty("Content-Length", "" + bytes.length); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Accept", "*/*"); conn.setRequestMethod("PUT"); OutputStream out = null; try { out = conn.getOutputStream(); out.write(bytes); out.flush(); } finally { if (out != null) { out.close(); } } return conn; }

Target:
protected HttpURLConnection put(String url, String body) throws IOException { if (url == null) { throw new IllegalArgumentException("SimplePush Update URL cannot be null"); } byte[] bytes = body.getBytes(UTF_8); HttpURLConnection conn = getConnection(url); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestProperty("Content-Length", Integer.toString(bytes.length)); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Accept", "*/*"); conn.setRequestMethod("PUT"); OutputStream out = null; try { out = conn.getOutputStream(); out.write(bytes); out.flush(); } finally { if (out != null) { out.close(); } } return conn; }
Source:
public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentLength(0); response.flushBuffer(); try { Thread.sleep(1000); } catch (InterruptedException x) { throw new InterruptedIOException(); } } }); String host = "localhost"; int port = connector.getLocalPort(); var request = client.newRequest(host, port) .scheme(scenario.getScheme()) .header(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString()) .onRequestSuccess(r -> { HttpDestination destination = (HttpDestination)client.resolveDestination(r); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); HttpConnectionOverHTTP connection = (HttpConnectionOverHTTP)connectionPool.getActiveConnections().iterator().next(); assertFalse(connection.getEndPoint().isOutputShutdown()); }); ContentResponse response = request.send(); assertEquals(HttpStatus.OK_200, response.getStatus()); HttpDestination destination = (HttpDestination)client.resolveDestination(request); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); assertEquals(0, connectionPool.getConnectionCount()); }

Target:
public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentLength(0); response.flushBuffer(); try { Thread.sleep(1000); } catch (InterruptedException x) { throw new InterruptedIOException(); } } }); String host = "localhost"; int port = connector.getLocalPort(); var request = client.newRequest(host, port) .scheme(scenario.getScheme()) .header(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString()) .onRequestSuccess(r -> { HttpDestination destination = (HttpDestination)client.resolveDestination(r); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); HttpConnectionOverHTTP connection = (HttpConnectionOverHTTP)connectionPool.getActiveConnections().iterator().next(); assertFalse(connection.getEndPoint().isOutputShutdown()); }) .onResponseHeaders(r -> { ((HttpResponse)r).getHeaderFieldsMutable().remove(HttpHeader.CONNECTION); }); ContentResponse response = request.send(); assertEquals(HttpStatus.OK_200, response.getStatus()); HttpDestination destination = (HttpDestination)client.resolveDestination(request); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); assertEquals(0, connectionPool.getConnectionCount()); }
Source:
public void close() throws IOException { try { primaryAccountService.close(); } finally { secondaryAccountService.close(); } shutDownExecutorService(scheduler, config.consistencyCheckerShutdownTimeoutMinutes, TimeUnit.MINUTES); }

Target:
public void close() throws IOException { shutDownExecutorService(scheduler, config.consistencyCheckerShutdownTimeoutMinutes, TimeUnit.MINUTES); try { primaryAccountService.close(); } catch (Exception e) { logger.error("Close failed for primary source", e); } try { secondaryAccountService.close(); } catch (Exception e) { logger.error("Close failed for secondary source", e); } }
Source:
protected MBStyleHandler(SLDHandler sldHandler) { super("JSON", FORMAT); this.sldHandler = sldHandler; }

Target:
protected MBStyleHandler(SLDHandler sldHandler) { super("MBStyle", FORMAT); this.sldHandler = sldHandler; }
Source:
public void testExternalTableCreationFailsIfNoCreateOrDropTablePresent() throws Exception { final int TOTAL_RECORDS = 1 * 10; String table = getTableName().toUpperCase(); ColumnGenerator[] cols = new ColumnGenerator[] { HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0), "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, new HiveVarchar("1", 20), "1", KeyType.STATIC_KEY), HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1), "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, new HiveVarchar("2", 20), "2", KeyType.DYNAMIC_KEY), }; List<String> addlArgsArray = new ArrayList<String>(); addlArgsArray.add("--hcatalog-external-table"); addlArgsArray.add("--hcatalog-storage-stanza"); addlArgsArray.add("\"stored as orc tblproperties (\"transactional\"=\"false\")\""); setExtraArgs(addlArgsArray); utils.dropHCatTableIfExists(table, SqoopHCatUtilities.DEFHCATDB); try { runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null, true, false); Assert.fail("--hcatalog-external-table cannot be used without signing creation of hcatalog table."); } catch (Exception e) { LOG.debug("Caught expected exception while running " + " hcatalog-external-table without signing create or drop-and-create test", e); } }

Target:
public void testExternalTableCreationFailsIfNoCreateOrDropTablePresent() throws Exception { externalTableCreationCoreTest(true, "--" + HCATALOG_EXTERNAL_TABLE_ARG, "--" + HCATALOG_STORAGE_STANZA_ARG, TABLEPROPERTIES_ORC_NONTRANSACTIONAL); }
Source:
public void shouldNotCreateNewEntryIFEntryAlreadyExsists() throws Exception { String newEntries = "[{\"id\": \"europe\", \"label\": \"europe\", \"obsolete\": 0}]"; Map<String, Object> params = new HashMap<>(); params.put("directoryName", "continent"); params.put("entries", newEntries); OperationParameters oparams = new OperationParameters(CreateDirectoryEntries.ID, params); OperationContext ctx = new OperationContext(session); OperationChain chain = new OperationChain("fakeChain"); chain.add(oparams); try { service.run(ctx, chain); fail(); } catch (NuxeoException e) { if (!(e instanceof DirectoryException)) { fail(); } assertEquals("Failed to invoke operation Directory.CreateEntries, Entry with id europe already exists", e.getMessage()); } }

Target:
public void shouldNotCreateNewEntryIFEntryAlreadyExsists() throws Exception { String newEntries = "[{\"id\": \"europe\", \"label\": \"europe\", \"obsolete\": 0}]"; Map<String, Object> params = new HashMap<>(); params.put("directoryName", "continent"); params.put("entries", newEntries); OperationParameters oparams = new OperationParameters(CreateDirectoryEntries.ID, params); OperationContext ctx = new OperationContext(session); OperationChain chain = new OperationChain("fakeChain"); chain.add(oparams); try { service.run(ctx, chain); fail(); } catch (DirectoryException e) { assertEquals("Failed to invoke operation Directory.CreateEntries, Entry with id europe already exists", e.getMessage()); } }
Source:
public static Map<String, Object> prepareLocationInfoForVdsCommand(LocationInfo locationInfo) { if (locationInfo instanceof ExternalLocationInfo) { ExternalLocationInfo info = (ExternalLocationInfo)locationInfo; if (ConnectionMethod.HTTP.equals(info.getConnectionMethod())) { HttpLocationInfo httpInfo = (HttpLocationInfo) info; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("method", "http"); infoMap.put("url", httpInfo.getUrl()); infoMap.put("headers", httpInfo.getHeaders()); return infoMap; } } if (locationInfo instanceof VdsmImageLocationInfo) { VdsmImageLocationInfo info = (VdsmImageLocationInfo)locationInfo; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("endpoint_type", "div"); infoMap.put("sd_id", info.getStorageDomainId().toString()); infoMap.put("img_id", info.getImageGroupId().toString()); infoMap.put("vol_id", info.getImageId().toString()); infoMap.put("generation", info.getGeneration()); return infoMap; } throw new RuntimeException("Unsupported location info"); }

Target:
public static Map<String, Object> prepareLocationInfoForVdsCommand(LocationInfo locationInfo) { if (locationInfo instanceof ExternalLocationInfo) { ExternalLocationInfo info = (ExternalLocationInfo)locationInfo; if (ConnectionMethod.HTTP.equals(info.getConnectionMethod())) { HttpLocationInfo httpInfo = (HttpLocationInfo) info; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("method", "http"); infoMap.put("url", httpInfo.getUrl()); infoMap.put("headers", httpInfo.getHeaders()); return infoMap; } } if (locationInfo instanceof VdsmImageLocationInfo) { VdsmImageLocationInfo info = (VdsmImageLocationInfo)locationInfo; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("endpoint_type", "div"); infoMap.put("sd_id", info.getStorageDomainId().toString()); infoMap.put("img_id", info.getImageGroupId().toString()); infoMap.put("vol_id", info.getImageId().toString()); if (info.getGeneration() != null) { infoMap.put("generation", info.getGeneration()); } return infoMap; } throw new RuntimeException("Unsupported location info"); }
Source:
private void updateCards(JSONObject model) { Timber.d("updateCards()"); try { JSONArray tmpls = model.getJSONArray("tmpls"); String cardsList = ""; Timber.d("updateCards() template count is %s", tmpls.length()); for (int i = 0; i < tmpls.length(); i++) { String name = tmpls.getJSONObject(i).optString("name"); if (!mAddNote && tmpls.length() > 1 && model == mEditorNote.model() && mCurrentEditedCard.getOrd() < tmpls.length() && mCurrentEditedCard.template().optString("name").equals(name)) { name = "<u>" + name + "</u>"; } cardsList += name; if (i < tmpls.length()-1) { cardsList += ", "; } } if (!mAddNote && tmpls.length() < mEditorNote.model().getJSONArray("tmpls").length()) { cardsList = "<font color='red'>" + cardsList + "</font>"; } mCardsButton.setText(Html.fromHtml(getResources().getString(R.string.CardEditorCards, cardsList))); } catch (JSONException e) { throw new RuntimeException(e); } }

Target:
private void updateCards(JSONObject model) { Timber.d("updateCards()"); try { JSONArray tmpls = model.getJSONArray("tmpls"); String cardsList = ""; Timber.d("updateCards() template count is %s", tmpls.length()); for (int i = 0; i < tmpls.length(); i++) { String name = tmpls.getJSONObject(i).optString("name"); if (!mAddNote && tmpls.length() > 1 && model == mEditorNote.model() && mCurrentEditedCard.template().optString("name").equals(name)) { name = "<u>" + name + "</u>"; } cardsList += name; if (i < tmpls.length()-1) { cardsList += ", "; } } if (!mAddNote && tmpls.length() < mEditorNote.model().getJSONArray("tmpls").length()) { cardsList = "<font color='red'>" + cardsList + "</font>"; } mCardsButton.setText(Html.fromHtml(getResources().getString(R.string.CardEditorCards, cardsList))); } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
public void scan(HttpMessage msg, NameValuePair originalParam) { paramType = originalParam.getType(); scan(msg, originalParam.getName(), originalParam.getValue()); }

Target:
public void scan(HttpMessage msg, NameValuePair originalParam) { currentParamType = originalParam.getType(); super.scan(msg, originalParam); }
Source:
private void sendPack(PackStatistics.Accumulator accumulator, FetchRequest req, @Nullable Collection<Ref> allTags, List<ObjectId> unshallowCommits) throws IOException { Set<String> cc = req.getClientCapabilities(); boolean sideband = cc.contains(OPTION_SIDE_BAND) || cc.contains(OPTION_SIDE_BAND_64K); if (sideband) { try { sendPack(true, req, accumulator, allTags, unshallowCommits); } catch (ServiceMayNotContinueException noPack) { throw noPack; } catch (IOException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (RuntimeException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (Error err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } } else { sendPack(false, req, accumulator, allTags, unshallowCommits); } }

Target:
private void sendPack(PackStatistics.Accumulator accumulator, FetchRequest req, @Nullable Collection<Ref> allTags, List<ObjectId> unshallowCommits) throws IOException { Set<String> caps = req.getClientCapabilities(); boolean sideband = caps.contains(OPTION_SIDE_BAND) || caps.contains(OPTION_SIDE_BAND_64K); if (sideband) { try { sendPack(true, req, accumulator, allTags, unshallowCommits); } catch (ServiceMayNotContinueException noPack) { throw noPack; } catch (IOException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (RuntimeException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (Error err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } } else { sendPack(false, req, accumulator, allTags, unshallowCommits); } }
Source:
public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } gidAttribute.setValue(attribute.getValue()); try { sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); } catch(WrongReferenceAttributeValueException ex) { throw new WrongReferenceAttributeValueException(attribute, ex.getAttribute(), ex); } }

Target:
public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } gidAttribute.setValue(attribute.getValue()); try { sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSyntax(sess, group, gidAttribute); sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); } catch(WrongReferenceAttributeValueException | WrongAttributeValueException ex) { throw new WrongReferenceAttributeValueException(attribute, ex.getAttribute(), ex); } }
Source:
public ValidationResult validate(Object value) { if (!(value instanceof IconWithOsDefault)) { throw new IllegalArgumentException("Illegal argument type: " + (value == null ? "null" : value.getClass().toString())); } final IconWithOsDefault iconWithOsDefault = (IconWithOsDefault) value; return iconWithOsDefault.getValidationResult(); }

Target:
public ValidationResult validate(Object value) { if (!(value instanceof IconWithOsDefault)) { throw new IllegalArgumentException("Illegal argument type: " + (value == null ? "null" : value.getClass().toString())); } final IconWithOsDefault iconWithOsDefault = (IconWithOsDefault) value; if (iconWithOsDefault.getValidationResult() == null) { UIConstants constants = ConstantsManager.getInstance().getConstants(); return ValidationResult.fail(constants.iconNotValidatedYet()); } return iconWithOsDefault.getValidationResult(); }
Source:
public void image(Attributes attributes, String url) { assertOpenBlock(); try { currentBlock.write('!'); writeAttributes(attributes); if (url != null) { currentBlock.write(url); } currentBlock.write('!'); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public void image(Attributes attributes, String url) { assertOpenBlock(); try { currentBlock.write('!'); writeAttributes(attributes); currentBlock.write(url); currentBlock.write('!'); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public Query optimizeQuery(Query q, NullCheckCategory category) { if (category == NullCheckCategory.NOT_NULL) { for (InputColumn<?> col : columns) { Column column = col.getPhysicalColumn(); if (column == null) { throw new IllegalStateException("Cannot optimize on non-physical column: " + col); } q.where(column, OperatorType.DIFFERENT_FROM, null); if (considerEmptyStringAsNull && col.getDataType() == String.class) { q.where(column, OperatorType.LIKE, "%"); } } } else { List<FilterItem> filterItems = new ArrayList<>(); for (InputColumn<?> col : columns) { Column column = col.getPhysicalColumn(); if (column == null) { throw new IllegalStateException("Cannot optimize on non-physical column: " + col); } SelectItem selectItem = new SelectItem(column); FilterItem fi1 = new FilterItem(selectItem, OperatorType.EQUALS_TO, null); filterItems.add(fi1); if (considerEmptyStringAsNull && col.getDataType() == String.class) { FilterItem fi2 = new FilterItem(selectItem, OperatorType.EQUALS_TO, ""); filterItems.add(fi2); } } q.where(new FilterItem(filterItems.toArray(new FilterItem[filterItems.size()]))); } return q; }

Target:
public Query optimizeQuery(Query q, NullCheckCategory category) { if (category == NullCheckCategory.NOT_NULL) { for (InputColumn<?> col : columns) { Column column = col.getPhysicalColumn(); if (column == null) { throw new IllegalStateException("Cannot optimize on non-physical column: " + col); } q.where(column, OperatorType.DIFFERENT_FROM, null); if (considerEmptyStringAsNull && col.getDataType() == String.class) { q.where(column, OperatorType.DIFFERENT_FROM, ""); } } } else { List<FilterItem> filterItems = new ArrayList<>(); for (InputColumn<?> col : columns) { Column column = col.getPhysicalColumn(); if (column == null) { throw new IllegalStateException("Cannot optimize on non-physical column: " + col); } SelectItem selectItem = new SelectItem(column); FilterItem fi1 = new FilterItem(selectItem, OperatorType.EQUALS_TO, null); filterItems.add(fi1); if (considerEmptyStringAsNull && col.getDataType() == String.class) { FilterItem fi2 = new FilterItem(selectItem, OperatorType.EQUALS_TO, ""); filterItems.add(fi2); } } q.where(new FilterItem(filterItems.toArray(new FilterItem[filterItems.size()]))); } return q; }
Source:
public void createOrUpdateNetworks(final Guid vmId, final List<NicWithLogicalNetworks> nicsWithLogicalNetworks) { AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<VmNetworkInterface> createdFromTemplate = (List<VmNetworkInterface>) result; if (createdFromTemplate.size() == 0) { createNetworks(vmId, nicsWithLogicalNetworks); } else { ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); for (VmNetworkInterface created : createdFromTemplate) { for (NicWithLogicalNetworks edited : nicsWithLogicalNetworks) { boolean sameNic = edited.getNetworkInterface().getName().equals(created.getName()); boolean assignedNetworkChanged = !((created.getNetworkName() == null && edited.getNetworkInterface() .getNetworkName() == null) || (created.getNetworkName() != null && created.getNetworkName() .equals(edited.getNetworkInterface().getNetworkName()))); if (sameNic && assignedNetworkChanged) { created.setNetworkName(edited.getNetworkInterface().getNetworkName()); parameters.add(new AddVmInterfaceParameters(vmId, created)); break; } } } updateNetworksFromParams(vmId, parameters); } } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vmId); }

Target:
public void createOrUpdateNetworks(final Guid vmId, final List<NicWithLogicalNetworks> nicsWithLogicalNetworks) { AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<VmNetworkInterface> createdFromTemplate = (List<VmNetworkInterface>) result; if (createdFromTemplate.size() == 0) { createNetworks(vmId, nicsWithLogicalNetworks); } else { ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); for (VmNetworkInterface created : createdFromTemplate) { for (NicWithLogicalNetworks edited : nicsWithLogicalNetworks) { boolean sameNic = edited.getNetworkInterface().getName().equals(created.getName()); boolean bothNetworksNull = created.getNetworkName() == null && edited.getNetworkInterface().getNetworkName() == null; boolean sameNetworkNames = created.getNetworkName() != null && created.getNetworkName().equals(edited.getNetworkInterface().getNetworkName()); boolean assignedNetworkChanged = !(bothNetworksNull || sameNetworkNames); if (sameNic && assignedNetworkChanged) { created.setNetworkName(edited.getNetworkInterface().getNetworkName()); parameters.add(new AddVmInterfaceParameters(vmId, created)); break; } } } updateNetworksFromParams(vmId, parameters); } } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vmId); }
Source:
public SpatialDimensionRowFormatter(List<SpatialDimensionSchema> spatialDimensions) { this.spatialDimensionMap = Maps.newHashMap(); for (SpatialDimensionSchema spatialDimension : spatialDimensions) { this.spatialDimensionMap.put(spatialDimension.getDimName(), spatialDimension); } this.spatialPartialDimNames = Sets.newHashSet( Iterables.concat( Lists.transform( spatialDimensions, new Function<SpatialDimensionSchema, List<String>>() { @Override public List<String> apply(SpatialDimensionSchema input) { return input.getDims(); } } ) ) ); }

Target:
public SpatialDimensionRowFormatter(List<SpatialDimensionSchema> spatialDimensions) { this.spatialDimensionMap = Maps.newHashMap(); for (SpatialDimensionSchema spatialDimension : spatialDimensions) { if (this.spatialDimensionMap.put(spatialDimension.getDimName(), spatialDimension) != null) { throw new ISE("Duplicate spatial dimension names found! Check your schema yo!"); } } this.spatialPartialDimNames = Sets.newHashSet( Iterables.concat( Lists.transform( spatialDimensions, new Function<SpatialDimensionSchema, List<String>>() { @Override public List<String> apply(SpatialDimensionSchema input) { return input.getDims(); } } ) ) ); }
Source:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.setLatLngBoundsForCameraTarget(AUSTRALIA_BOUNDS); mapboxMap.setMinZoomPreference(2); showBoundsArea(); showCrosshair(); } }); }

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.setLatLngBoundsForCameraTarget(RESTRICTED_BOUNDS_AREA); mapboxMap.setMinZoomPreference(2); showBoundsArea(style); showCrosshair(); } }); }
Source:
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) { Map<String, String> headers = new HashMap<>(); headers.put("Content-Type", "application/json"); headers.put("X-Custom-Header", "application/json"); APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent() .withHeaders(headers); if (input != null && input.getBody() != null) { try { Request request = mapper.readValue(input.getBody(), Request.class); try { String s = parseWDLFile(request.getUri(), request.getBranch(), request.getDescriptorRelativePathInGit()); return response.withStatusCode(HttpURLConnection.HTTP_OK).withBody(s); } catch (IOException e) { e.printStackTrace(); return response.withBody("Could not clone repository to temporary directory").withStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } catch (GitAPIException e) { e.printStackTrace(); return response.withBody("Could not clone Git repository").withStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } } catch (JsonProcessingException e) { e.printStackTrace(); return response.withBody("Could not process request").withStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); } } else { return response.withBody("No body in request").withStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); } }

Target:
public APIGatewayProxyResponseEvent handleRequest( final APIGatewayProxyRequestEvent input, final Context context) { Map<String, String> headers = new HashMap<>(); headers.put("Content-Type", "application/json"); headers.put("X-Custom-Header", "application/json"); APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent().withHeaders(headers); if (input != null && input.getBody() != null) { try { LanguageParsingRequest request = mapper.readValue(input.getBody(), LanguageParsingRequest.class); try { String s = parseWdlFile( request.getUri(), request.getBranch(), request.getDescriptorRelativePathInGit(), request); return response.withStatusCode(HttpURLConnection.HTTP_OK).withBody(s); } catch (IOException e) { e.printStackTrace(); return response .withBody("Could not clone repository to temporary directory") .withStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } catch (GitAPIException e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); return response .withBody(exceptionAsString) .withStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } } catch (IOException e) { e.printStackTrace(); return response .withBody("Could not process request") .withStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); } } else { return response .withBody("No body in request") .withStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); } }
Source:
public static ZCallPedFile fromFile(final File pedFile, final File mapFile) throws FileNotFoundException { final String[] pedFileFields = IOUtil.slurp(pedFile).split(" "); final String[] mapFileLines = IOUtil.slurpLines(mapFile).toArray(new String[0]); final ZCallPedFile zCallPedFile = new ZCallPedFile(); for (int i = 0; i < mapFileLines.length; i++) { final int index = (i * 2) + OFFSET; final String alleles = pedFileFields[index] + pedFileFields[index + 1]; zCallPedFile.addAllele(mapFileLines[i].split("\t")[1], alleles); } return zCallPedFile; }

Target:
public static ZCallPedFile fromFile(final File pedFile, final File mapFile) throws FileNotFoundException { final String[] pedFileLines = IOUtil.slurpLines(pedFile).toArray(new String[0]); if (pedFileLines.length > 1) { throw new PicardException("Only single-sample .ped files are supported."); } final String[] pedFileFields = IOUtil.slurp(pedFile).split("\\s"); final String[] mapFileLines = IOUtil.slurpLines(mapFile).toArray(new String[0]); final ZCallPedFile zCallPedFile = new ZCallPedFile(); for (int i = 0; i < mapFileLines.length; i++) { final int index = (i * 2) + OFFSET; if (pedFileFields[index].length() != 1 || pedFileFields[index + 1].length() != 1) { throw new PicardException("Malformed file: each allele should be a single character."); } final String alleles = pedFileFields[index] + pedFileFields[index + 1]; zCallPedFile.addAllele(mapFileLines[i].split("\\s")[1], alleles); } return zCallPedFile; }
Source:
public OncotreeMappingsResp getMappings( @RequestParam(value="vocabularyId", required=false) String vocabularyId, @RequestParam(value="conceptId", required=false) String conceptId, @RequestParam(value="histologyCode", required=false) String histologyCode, @RequestParam(value="siteCode", required=false) String siteCode ) { if( !validateMappingParameters(vocabularyId, conceptId, histologyCode, siteCode) ){ throw new RuntimeException("Your query parameters, vocabularyId: " + vocabularyId + ", conceptId: " + conceptId + ", histologyCode: " + histologyCode + ", siteCode: " + siteCode + " are not valid. Please refer to the documentation"); } MSKConcept mskConcept = crosswalkRepository.queryCVS(vocabularyId, conceptId, histologyCode, siteCode); return extractOncotreeMappings( mskConcept ); }

Target:
public OncotreeMappingsResp getMappings( @RequestParam(value="vocabularyId", required=false) String vocabularyId, @RequestParam(value="conceptId", required=false) String conceptId, @RequestParam(value="histologyCode", required=false) String histologyCode, @RequestParam(value="siteCode", required=false) String siteCode ) { if( !validateMappingParameters(vocabularyId, conceptId, histologyCode, siteCode) ){ throw new InvalidOncotreeMappingsParameters("Your query parameters, vocabularyId: " + vocabularyId + ", conceptId: " + conceptId + ", histologyCode: " + histologyCode + ", siteCode: " + siteCode + " are not valid. Please refer to the documentation"); } MSKConcept mskConcept = crosswalkRepository.queryCVS(vocabularyId, conceptId, histologyCode, siteCode); return extractOncotreeMappings( mskConcept ); }
Source:
public void testGetApplicationReportsForProjectModelSortedByPriority() { ProjectModel projectModel = context.getFramed().addVertex(null, ProjectModel.class); ApplicationReportModel m1 = context.getFramed().addVertex(null, ApplicationReportModel.class); m1.setReportName("m1"); m1.setReportPriority(100); ApplicationReportModel m2 = context.getFramed().addVertex(null, ApplicationReportModel.class); m2.setReportName("m2"); m2.setReportPriority(200); ApplicationReportModel m3 = context.getFramed().addVertex(null, ApplicationReportModel.class); m3.setReportName("m3"); m3.setReportPriority(300); ApplicationReportModel m4 = context.getFramed().addVertex(null, ApplicationReportModel.class); m4.setReportName("m4"); m4.setReportPriority(400); ApplicationReportModel m5 = context.getFramed().addVertex(null, ApplicationReportModel.class); m5.setReportName("m5"); m5.setReportPriority(500); MainNavigationIndexModel idx1 = context.getFramed().addVertex(null, MainNavigationIndexModel.class); idx1.addProjectModel(projectModel); MainNavigationIndexModel idx2 = context.getFramed().addVertex(null, MainNavigationIndexModel.class); m1.setProjectModel(projectModel); m2.setProjectModel(projectModel); m3.setProjectModel(projectModel); m4.setProjectModel(projectModel); MainNavigationIndexModel result = service.getNavigationIndexForProjectModel(projectModel); Assert.assertNotNull(result); Assert.assertEquals(idx1.asVertex().getId(), result.asVertex().getId()); }

Target:
public void testGetApplicationReportsForProjectModelSortedByPriority() { ProjectModel projectModel = projectModelService.create(); ApplicationReportModel m1 = applicationReportModelService.create(); m1.setReportName("m1"); m1.setReportPriority(100); ApplicationReportModel m2 = applicationReportModelService.create(); m2.setReportName("m2"); m2.setReportPriority(200); ApplicationReportModel m3 = applicationReportModelService.create(); m3.setReportName("m3"); m3.setReportPriority(300); ApplicationReportModel m4 = applicationReportModelService.create(); m4.setReportName("m4"); m4.setReportPriority(400); ApplicationReportModel m5 = applicationReportModelService.create(); m5.setReportName("m5"); m5.setReportPriority(500); MainNavigationIndexModel idx1 = mainNavigationIndexModelService.create(); idx1.addProjectModel(projectModel); MainNavigationIndexModel idx2 = mainNavigationIndexModelService.create(); m1.setProjectModel(projectModel); m2.setProjectModel(projectModel); m3.setProjectModel(projectModel); m4.setProjectModel(projectModel); MainNavigationIndexModel result = mainNavigationIndexModelService .getNavigationIndexForProjectModel(projectModel); Assert.assertNotNull(result); Assert.assertEquals(idx1.asVertex().getId(), result.asVertex().getId()); }