edu.emory.mathcs.backport.java.util.Collections Java Examples
The following examples show how to use
edu.emory.mathcs.backport.java.util.Collections.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplianceVmSyncConfigToHaGroupFlow.java From zstack with Apache License 2.0 | 6 votes |
@Override public void rollback(FlowRollback trigger, Map data) { ApplianceVmVO applianceVmVO = (ApplianceVmVO)data.get(VmInstanceConstant.Params.ApplianceVmSyncHaConfig_applianceVm.toString()); String haUuid = (String)data.get(VmInstanceConstant.Params.ApplianceVmSyncHaConfig_haUuid.toString()); if (haUuid == null || applianceVmVO == null) { trigger.rollback(); return; } List<ApplianceVmSyncConfigToHaGroupExtensionPoint> exps = pluginRgty.getExtensionList(ApplianceVmSyncConfigToHaGroupExtensionPoint.class); List<ApplianceVmSyncConfigToHaGroupExtensionPoint> tmp = new ArrayList<>(exps.size()); tmp.addAll(exps); Collections.reverse(tmp); for (ApplianceVmSyncConfigToHaGroupExtensionPoint exp : tmp) { exp.applianceVmSyncConfigToHaRollback(ApplianceVmInventory.valueOf(applianceVmVO), haUuid); } SQL.New(ApplianceVmVO.class).eq(ApplianceVmVO_.uuid, applianceVmVO.getUuid()).set(ApplianceVmVO_.haStatus, ApplianceVmHaStatus.NoHa).update(); trigger.rollback(); }
Example #2
Source File: OverlayDocuments.java From testarea-pdfbox2 with Apache License 2.0 | 6 votes |
/** * <a href="https://issues.apache.org/jira/browse/PDFBOX-4797"> * Overlayed PDF file do not shows the difference * </a> * <br/> * <a href="https://issues.apache.org/jira/secure/attachment/12996277/10.pdf"> * 10.pdf * </a> * <br/> * <a href="https://issues.apache.org/jira/secure/attachment/12996276/114.pdf"> * 114.pdf * </a> * <p> * This test demonstrates how to use the blend mode when overlaying documents * for comparison. * </p> */ @Test public void testOverlayWithMultiply() throws IOException { try ( InputStream file1 = getClass().getResourceAsStream("10.pdf"); InputStream file2 = getClass().getResourceAsStream("114.pdf"); PDDocument document1 = Loader.loadPDF(file1); PDDocument document2 = Loader.loadPDF(file2); Overlay overlayer = new Overlay()) { overlayer.setInputPDF(document1); overlayer.setAllPagesOverlayPDF(document2); try ( PDDocument result = overlayer.overlay(Collections.emptyMap()) ) { result.save(new File(RESULT_FOLDER, "10and114.pdf")); try ( PDPageContentStream canvas = new PDPageContentStream(result, result.getPage(5), AppendMode.PREPEND, false, false)) { PDExtendedGraphicsState extGState = new PDExtendedGraphicsState(); extGState.setBlendMode(BlendMode.MULTIPLY); canvas.setGraphicsStateParameters(extGState); } result.save(new File(RESULT_FOLDER, "10and114multiply.pdf")); } } }
Example #3
Source File: PostProcessorFactory.java From beanmother with Apache License 2.0 | 6 votes |
/** * Get a sorted PostProcessors by generic type * @param targetType the generic type of a registered PostProcessor. * @param <T> the type. * @return the List of PostProcessor */ @SuppressWarnings("unchecked") public <T> List<PostProcessor<T>> get(Class<T> targetType) { List<PostProcessor<T>> selected = new ArrayList<>(); for (PostProcessor postProcessor : postProcessors) { Type type = postProcessor.getTargetClass(); if (TypeToken.of(targetType).isSubtypeOf(TypeToken.of(type))) { selected.add(postProcessor); } } Collections.sort(selected); return selected; }
Example #4
Source File: Issue.java From onedev with MIT License | 6 votes |
public List<RevCommit> getCommits() { if (commits == null) { commits = new ArrayList<>(); CommitInfoManager commitInfoManager = OneDev.getInstance(CommitInfoManager.class); for (ObjectId commitId: commitInfoManager.getFixCommits(getProject(), getNumber())) { RevCommit commit = getProject().getRevCommit(commitId, false); if (commit != null) commits.add(commit); } Collections.sort(commits, new Comparator<RevCommit>() { @Override public int compare(RevCommit o1, RevCommit o2) { return o2.getCommitTime() - o1.getCommitTime(); } }); } return commits; }
Example #5
Source File: Issue.java From onedev with MIT License | 6 votes |
public List<PullRequest> getPullRequests() { if (pullRequests == null) { pullRequests = new ArrayList<>(); PullRequestInfoManager infoManager = OneDev.getInstance(PullRequestInfoManager.class); Collection<Long> pullRequestIds = new HashSet<>(); for (ObjectId commit: getCommits()) pullRequestIds.addAll(infoManager.getPullRequestIds(getProject(), commit)); for (Long requestId: pullRequestIds) { PullRequest request = OneDev.getInstance(PullRequestManager.class).get(requestId); if (request != null && !pullRequests.contains(request)) pullRequests.add(request); } Collections.sort(pullRequests, new Comparator<PullRequest>() { @Override public int compare(PullRequest o1, PullRequest o2) { return o2.getId().compareTo(o1.getId()); } }); } return pullRequests; }
Example #6
Source File: PlantRenderer.java From Java2PlantUML with Apache License 2.0 | 6 votes |
private void renderClassMembers(StringBuilder sb, Class<?> aClass) { List<String> fields = new ArrayList<>(); List<String> methods = new ArrayList<>(); List<String> constructors = new ArrayList<>(); addMembers(aClass.getDeclaredFields(), fields); addMembers(aClass.getDeclaredConstructors(), constructors); addMembers(aClass.getDeclaredMethods(), methods); Collections.sort(fields); Collections.sort(methods); Collections.sort(constructors); for (String field : fields) { sb.append(field + "\n"); } sb.append("--\n"); for (String constructor : constructors) { sb.append(constructor + "\n"); } for (String method : methods) { sb.append(method + "\n"); } }
Example #7
Source File: BasePitMojoTest.java From pitest with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { super.setUp(); MockitoAnnotations.initMocks(this); this.classPath = new ArrayList<>(FCollection.map( ClassPath.getClassPathElementsAsFiles(), fileToString())); when(this.project.getTestClasspathElements()).thenReturn(this.classPath); when(this.project.getPackaging()).thenReturn("jar"); final Build build = new Build(); build.setOutputDirectory(""); when(this.project.getBuild()).thenReturn(build); when(this.plugins.findToolClasspathPlugins()).thenReturn( Collections.emptyList()); when(this.plugins.findClientClasspathPlugins()).thenReturn( Collections.emptyList()); }
Example #8
Source File: SprintBacklogLogic.java From ezScrum with GNU General Public License v2.0 | 6 votes |
/** * 根據 story column 的值來排序 * * @param stories * @param sortedColumn * @return sorted stories */ private ArrayList<StoryObject> sort(ArrayList<StoryObject> stories, String sortedColumn) { if (sortedColumn.equals("EST")) { Collections.sort(stories, new StoryComparator( StoryComparator.TYPE_EST)); } else if (sortedColumn.equals("IMP")) { Collections.sort(stories, new StoryComparator( StoryComparator.TYPE_IMP)); } else if (sortedColumn.equals("VAL")) { Collections.sort(stories, new StoryComparator( StoryComparator.TYPE_VAL)); } else { Collections.sort(stories, new StoryComparator( StoryComparator.TYPE_ID)); } return stories; }
Example #9
Source File: GroupsConfirmationEmailBuilder.java From olat with Apache License 2.0 | 5 votes |
/** * Builds the mail body by using for each type different translation key, and passing the variables into the translated string. <br/> * The variables is an array of parameters specific to each type. Please use exactly this order while defining new translation keys. <br/> * <p> * variables[0] //number of months to filter inactive groups <br/> * variables[1] //number of days till when inactive groups will be deleted <br/> */ @Override protected ResourceEntriesConfirmationMailBody getMailBody(Locale recipientsLocale, GroupsConfirmationInfo groupsConfirmationInfo) { String content; String greeting; String greetingFrom; String footer; Translator translator = mailBuilderCommons.getEmailTranslator(ConfirmationMailBody.class, recipientsLocale); String[] variables = new String[] { String.valueOf(groupsConfirmationInfo.getNumberOfMonths()), String.valueOf(groupsConfirmationInfo.getNumberOfDays()) }; // choose the right translation key, the variables are the same for each template if (GroupsConfirmationInfo.GROUPS_CONFIRMATION_TYPE.DELETE_GROUPS.equals(groupsConfirmationInfo.getGroupsConfirmationType())) { content = translator.translate("mail.body.confirmation.delete.groups", variables); } else { content = "INVALID CONFIRMATION CONTENT"; // UNKNOWN CONFIRMATION TYPE } greeting = translator.translate("mail.body.greeting"); greetingFrom = translator.translate("mail.body.greeting.from"); String olatUrlAsHtmlHref = mailBuilderCommons.getOlatUrlAsHtmlHref(); footer = translator.translate("mail.footer.confirmation", getStringArray(olatUrlAsHtmlHref)); List<String> groupEntries = getGroupEntries(groupsConfirmationInfo.getGroups(), translator); Collections.sort(groupEntries); return new ResourceEntriesConfirmationMailBody(content, greeting, greetingFrom, footer, groupEntries); }
Example #10
Source File: CampusCourseLearnServiceImpl.java From olat with Apache License 2.0 | 5 votes |
@Override public List<SapCampusCourseTo> getCoursesWhichCouldBeOpened(Identity identity, SapOlatUser.SapUserType userType) { List<SapCampusCourseTo> courseList = new ArrayList<SapCampusCourseTo>(); Set<Course> sapCampusCourses = campusCourseCoreService.getCampusCoursesWithResourceableId(identity, userType); for (Course sapCampusCourse : sapCampusCourses) { courseList.add(new SapCampusCourseTo(sapCampusCourse.getTitle(), sapCampusCourse.getId(), sapCampusCourse.getResourceableId())); } Collections.sort(courseList); return courseList; }
Example #11
Source File: CampusCourseLearnServiceImpl.java From olat with Apache License 2.0 | 5 votes |
@Override public List<SapCampusCourseTo> getCoursesWhichCouldBeCreated(Identity identity, SapOlatUser.SapUserType userType) { List<SapCampusCourseTo> courseList = new ArrayList<SapCampusCourseTo>(); Set<Course> sapCampusCourses = campusCourseCoreService.getCampusCoursesWithoutResourceableId(identity, userType); for (Course sapCampusCourse : sapCampusCourses) { courseList.add(new SapCampusCourseTo(sapCampusCourse.getTitle(), sapCampusCourse.getId(), null)); } Collections.sort(courseList); return courseList; }
Example #12
Source File: CardholderNameEditTextTest.java From android-card-form with MIT License | 5 votes |
@Test public void hasMaxAllowedLength() { int maxLength = 255; String justRight = String.join("", Collections.nCopies(maxLength, "a")); String tooLong = justRight + "a"; mView.setText(justRight); assertEquals(maxLength, mView.getText().length()); mView.setText(tooLong); assertEquals(maxLength, mView.getText().length()); }
Example #13
Source File: GooglePlayBillingVendorTest.java From Cashier with Apache License 2.0 | 5 votes |
private void mockApiPurchaseSuccess(final GooglePlayBillingVendor vendor, final Product product, final boolean validSignature) { doAnswer( new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { vendor.onPurchasesUpdated(BillingClient.BillingResponse.OK, Collections.singletonList( validSignature ? new TestPurchase(product) : new TestPurchase(product, "INVALID") ) ); return null; } } ).when(api).launchBillingFlow(activity, product.sku(), BillingClient.SkuType.INAPP); }
Example #14
Source File: ConsumerManagerTest.java From openid4java with Apache License 2.0 | 5 votes |
public void testPerferredAssociation() throws Exception { manager.setPrefAssocSessEnc(AssociationSessionType.DH_SHA1); DiscoveryInformation disc = new DiscoveryInformation(new URL(server.createAbsoluteUrl("/op/endpoint")), null); DiscoveryInformation info = manager.associate(Collections.singletonList(disc)); assertEquals(1,server.getRequestParams().size()); Map request = (Map)server.getRequestParams().get(0); assertEquals(manager.getPrefAssocSessEnc().getAssociationType(),((String[])request.get("openid.assoc_type"))[0]); assertEquals(manager.getPrefAssocSessEnc().getSessionType(),((String[])request.get("openid.session_type"))[0]); }
Example #15
Source File: StudentMappingWriterTest.java From olat with Apache License 2.0 | 5 votes |
@Test public void write_emptyStudentsList() throws Exception { studentMappingWriterTestObject.write(Collections.emptyList()); assertEquals( studentMappingWriterTestObject.getMappingStatistic().toString(), "MappedByEmail=0 , MappedByMatrikelNumber=0 , MappedByPersonalNumber=0 , MappedByAdditionalPersonalNumber=0 , couldNotMappedBecauseNotRegistered=0 , couldBeMappedManually=0"); }
Example #16
Source File: LecturerMappingWriterTest.java From olat with Apache License 2.0 | 5 votes |
@Test public void write_emptyLecturersList() throws Exception { lecturerMappingWriterTestObject.write(Collections.emptyList()); assertEquals( lecturerMappingWriterTestObject.getMappingStatistic().toString(), "MappedByEmail=0 , MappedByMatrikelNumber=0 , MappedByPersonalNumber=0 , MappedByAdditionalPersonalNumber=0 , couldNotMappedBecauseNotRegistered=0 , couldBeMappedManually=0"); }
Example #17
Source File: AssociationStringSimilarity.java From wandora with GNU General Public License v3.0 | 5 votes |
public Collection<String> getAssociationsAsStrings(Topic t) throws TopicMapException { Collection<Association> as = t.getAssociations(); ArrayList<String> asStr = new ArrayList(); for(Association a : as) { StringBuilder sb = new StringBuilder(""); sb.append(getAsString(a.getType())); sb.append(TOPIC_DELIMITER); Collection<Topic> roles = a.getRoles(); ArrayList<Topic> sortedRoles = new ArrayList(); sortedRoles.addAll(roles); Collections.sort(sortedRoles, new TopicStringComparator()); boolean found = false; for(Topic r : sortedRoles) { Topic p = a.getPlayer(r); if(!found && p.mergesWithTopic(t)) { found = true; continue; } sb.append(getAsString(r)); sb.append(TOPIC_DELIMITER); sb.append(getAsString(p)); sb.append(TOPIC_DELIMITER); } asStr.add(sb.toString()); } Collections.sort(asStr); return asStr; }
Example #18
Source File: PlantRenderer.java From Java2PlantUML with Apache License 2.0 | 5 votes |
private void sortRelations(ArrayList<Relation> relations) { Collections.sort(relations, new Comparator<Relation>() { @Override public int compare(Relation o1, Relation o2) { int result = o1.getClass().equals(o2.getClass()) ? o1.getFromType().getName().compareTo(o1.getFromType().getName()) : o1.getClass().getName().compareTo(o2.getClass().getName()); return result; } }); }
Example #19
Source File: UserProfileTest.java From Auth0.Android with MIT License | 5 votes |
@SuppressWarnings("unchecked") @Test public void shouldReturnSubIfMissingId() { Map<String, Object> extraInfo = Collections.singletonMap("sub", "fromSub"); userProfile = new UserProfile(null, null, null, null, null, false, null, null, null, extraInfo, null, null, null); assertThat(userProfile.getId(), is("fromSub")); }
Example #20
Source File: GooglePlayBillingVendorTest.java From Cashier with Apache License 2.0 | 5 votes |
@Test public void get_product_details() { GooglePlayBillingVendor vendor = successfullyInitializedVendor(); ProductDetailsListener listener = mock(ProductDetailsListener.class); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { List<String> skus = invocation.getArgument(1); SkuDetailsResponseListener responseListener = invocation.getArgument(2); assertEquals(1, skus.size()); responseListener.onSkuDetailsResponse(BillingClient.BillingResponse.OK, Collections.singletonList( TestData.getSkuDetail(skus.get(0)) )); return null; } }).when(api).getSkuDetails(eq(BillingClient.SkuType.INAPP), ArgumentMatchers.<String>anyList(), any(SkuDetailsResponseListener.class)); vendor.getProductDetails(context, TestData.productInappA.sku(), false, listener); ArgumentCaptor<List<String>> argumentSkus = ArgumentCaptor.forClass(List.class); verify(api).getSkuDetails(eq(BillingClient.SkuType.INAPP), argumentSkus.capture(), any(SkuDetailsResponseListener.class)); assertEquals(1, argumentSkus.getValue().size()); assertEquals(TestData.productInappA.sku(), argumentSkus.getValue().get(0)); ArgumentCaptor<Product> argumentProduct = ArgumentCaptor.forClass(Product.class); verify(listener).success(argumentProduct.capture()); assertEquals(TestData.productInappA, argumentProduct.getValue()); }
Example #21
Source File: InventoryQueryTest.java From Cashier with Apache License 2.0 | 5 votes |
@Before public void setup() throws Exception { MockitoAnnotations.initMocks(this); when(api.available()).thenReturn(true); when(api.getPurchases()).thenReturn(new ArrayList<Purchase>()); when(api.getPurchases(anyString())).thenReturn(new ArrayList<Purchase>()); TestHelper.mockSkuDetails(api, BillingClient.SkuType.INAPP, TestData.getSkuDetailsMap(TestData.allInAppSkus)); TestHelper.mockSkuDetails(api, BillingClient.SkuType.SUBS, TestData.getSkuDetailsMap(TestData.allSubSkus)); TestHelper.mockPurchases(api, Collections.singletonList(TestData.productInappA)); }
Example #22
Source File: BrowserDescriptorTest.java From AppAuth-Android with Apache License 2.0 | 5 votes |
@Test public void testEquals_differentSignatures() { BrowserDescriptor a = Browsers.Chrome.standaloneBrowser("45"); @SuppressWarnings("unchecked") BrowserDescriptor b = new BrowserDescriptor( a.packageName, Collections.singleton("DIFFERENT_SIGNATURE"), a.version, a.useCustomTab); assertThat(a).isNotEqualTo(b); }
Example #23
Source File: OrderBy.java From wandora with GNU General Public License v3.0 | 5 votes |
@Override public ResultIterator queryIterator(QueryContext context, ResultRow input) throws QueryException { ArrayList<ResultRow> res=directive.query(context, input); Collections.sort(res, new Comparator<ResultRow>(){ public int compare(ResultRow o1, ResultRow o2) { Object v1=o1.getActiveValue(); Object v2=o2.getActiveValue(); return comparator.compare(v1, v2); } }); return new ResultIterator.ListIterator(res); }
Example #24
Source File: RepositoryEntriesConfirmationEmailBuilder.java From olat with Apache License 2.0 | 5 votes |
/** * Builds the mail body by using for each type different translation key, and passing the variables into the translated string. <br/> * The variables is an array of parameters specific to each type. Please use exactly this order while defining new translation keys. <br/> * <p> * variables[0] //number of months to filter inactive repository entries <br/> * variables[1] //number of days till when inactive repository entries will be deleted <br/> */ @Override protected ConfirmationMailBody getMailBody(Locale recipientsLocale, RepositoryEntriesConfirmationInfo repositoryEntriesConfirmationInfo) { String content; String greeting; String greetingFrom; String footer; Translator translator = mailBuilderCommons.getEmailTranslator(ConfirmationMailBody.class, recipientsLocale); String[] variables = new String[] { String.valueOf(repositoryEntriesConfirmationInfo.getNumberOfMonths()), String.valueOf(repositoryEntriesConfirmationInfo.getNumberOfDays()) }; // choose the right translation key, the variables are the same for each template if (RepositoryEntriesConfirmationInfo.REPOSITORY_ENTRIES_CONFIRMATION_TYPE.DELETE_REPOSITORY_ENTRIES.equals(repositoryEntriesConfirmationInfo .getRepositoryEntriesConfirmationType())) { content = translator.translate("mail.body.confirmation.delete.repository.entries", variables); } else { content = "INVALID CONFIRMATION CONTENT"; // UNKNOWN CONFIRMATION TYPE } greeting = translator.translate("mail.body.greeting"); greetingFrom = translator.translate("mail.body.greeting.from"); String olatUrlAsHtmlHref = mailBuilderCommons.getOlatUrlAsHtmlHref(); footer = translator.translate("mail.footer.confirmation", getStringArray(olatUrlAsHtmlHref)); List<String> repositoryEntries = getRepositoryEntries(repositoryEntriesConfirmationInfo.getRepositoryEntries(), translator); Collections.sort(repositoryEntries); return new ResourceEntriesConfirmationMailBody(content, greeting, greetingFrom, footer, repositoryEntries); }
Example #25
Source File: SaganUpdater.java From spring-cloud-release-tools with Apache License 2.0 | 5 votes |
private Exception updateSaganForNonSnapshot(String branch, ProjectVersion originalVersion, ProjectVersion version, Projects projects) { Exception updateReleaseException = null; if (!version.isSnapshot()) { log.info( "Version is non snapshot [{}]. Will remove all older versions and mark this as current", version); Project project = this.saganClient.getProject(version.projectName); if (project != null) { removeAllSameMinorVersions(version, project); } String snapshot = toSnapshot(version.version); removeVersionFromSagan(version, snapshot); if (version.isRelease() || version.isServiceRelease()) { try { String bumpedSnapshot = toSnapshot(version.bumpedVersion()); ReleaseUpdate snapshotUpdate = releaseUpdate(branch, originalVersion, new ProjectVersion(version.projectName, bumpedSnapshot), projects); log.info("Updating Sagan with bumped snapshot \n\n[{}]", snapshotUpdate); this.saganClient.updateRelease(version.projectName, Collections.singletonList(snapshotUpdate)); } catch (Exception e) { log.warn("Failed to update [" + version.projectName + "/" + snapshot + "] from Sagan", e); updateReleaseException = e; } } } return updateReleaseException; }
Example #26
Source File: DefaultEditSupportRegistry.java From onedev with MIT License | 5 votes |
@Inject public DefaultEditSupportRegistry(Set<EditSupport> editSupports) { this.editSupports = new ArrayList<EditSupport>(editSupports); Collections.sort(this.editSupports, new Comparator<EditSupport>() { @Override public int compare(EditSupport o1, EditSupport o2) { return o1.getPriority() - o2.getPriority(); } }); }
Example #27
Source File: EntityCriteria.java From onedev with MIT License | 5 votes |
protected Predicate inManyValues(CriteriaBuilder builder, Path<Long> attribute, Collection<Long> inValues, Collection<Long> allValues) { List<Long> listOfInValues = new ArrayList<>(inValues); Collections.sort(listOfInValues); List<Long> listOfAllValues = new ArrayList<>(allValues); Collections.sort(listOfAllValues); List<Predicate> predicates = new ArrayList<>(); List<Long> discreteValues = new ArrayList<>(); for (List<Long> range: new RangeBuilder(listOfInValues, listOfAllValues).getRanges()) { if (range.size() <= 2) { discreteValues.addAll(range); } else { predicates.add(builder.and( builder.greaterThanOrEqualTo(attribute, range.get(0)), builder.lessThanOrEqualTo(attribute, range.get(range.size()-1)))); } } Collection<Long> inClause = new ArrayList<>(); for (Long value: discreteValues) { inClause.add(value); if (inClause.size() == IN_CLAUSE_LIMIT) { predicates.add(attribute.in(inClause)); inClause = new ArrayList<>(); } } if (!inClause.isEmpty()) predicates.add(attribute.in(inClause)); return builder.or(predicates.toArray(new Predicate[0])); }
Example #28
Source File: ChoiceInput.java From onedev with MIT License | 5 votes |
@SuppressWarnings("unchecked") public static List<String> convertToStrings(InputSpec inputSpec, Object value) { List<String> strings = new ArrayList<>(); if (inputSpec.isAllowMultiple()) { if (inputSpec.checkListElements(value, String.class)) strings.addAll((List<String>) value); Collections.sort(strings); } else if (value instanceof String) { strings.add((String) value); } return strings; }
Example #29
Source File: AllGroups.java From onedev with MIT License | 5 votes |
@Override public List<Group> getChoices(boolean allPossible) { List<Group> groups = OneDev.getInstance(GroupManager.class).query(); Collections.sort(groups, new Comparator<Group>() { @Override public int compare(Group o1, Group o2) { return o1.getName().compareTo(o2.getName()); } }); return groups; }
Example #30
Source File: MapRouteProgressChangeListenerTest.java From graphhopper-navigation-android with MIT License | 5 votes |
@Test public void onProgressChange_newRouteWithEmptyDirectionsRouteList() { NavigationMapRoute mapRoute = mock(NavigationMapRoute.class); when(mapRoute.retrieveDirectionsRoutes()).thenReturn(Collections.emptyList()); when(mapRoute.retrievePrimaryRouteIndex()).thenReturn(0); MapRouteProgressChangeListener progressChangeListener = new MapRouteProgressChangeListener(mapRoute); RouteProgress routeProgress = mock(RouteProgress.class); DirectionsRoute newRoute = mock(DirectionsRoute.class); when(routeProgress.directionsRoute()).thenReturn(newRoute); progressChangeListener.onProgressChange(mock(Location.class), routeProgress); verify(mapRoute).addRoute(eq(newRoute)); }