本文整理匯總了Java中org.mockito.internal.util.collections.Sets類的典型用法代碼示例。如果您正苦於以下問題:Java Sets類的具體用法?Java Sets怎麽用?Java Sets使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Sets類屬於org.mockito.internal.util.collections包,在下文中一共展示了Sets類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPersonalNamespaces_withForceListAll
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void getPersonalNamespaces_withForceListAll() throws Exception {
when(storeConfig.subscribedFoldersOnly()).thenReturn(true);
ImapConnection imapConnection = mock(ImapConnection.class);
List<ImapResponse> imapResponses = Arrays.asList(
createImapResponse("* LIST (\\HasNoChildren) \".\" \"INBOX\""),
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"Folder\""),
createImapResponse("* LIST (\\HasNoChildren) \".\" \"Folder.SubFolder\""),
createImapResponse("6 OK Success")
);
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
imapStore.enqueueImapConnection(imapConnection);
List<? extends Folder> result = imapStore.getFolders(true);
assertNotNull(result);
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderIds(result));
}
示例2: getPersonalNamespaces_withPathPrefix
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void getPersonalNamespaces_withPathPrefix() throws Exception {
when(storeConfig.getStoreUri()).thenReturn("imap://user:[email protected]/0%7CpathPrefix/");
imapStore = new TestImapStore(storeConfig, trustedSocketFactory, connectivityManager, oauth2TokenProvider);
ImapConnection imapConnection = mock(ImapConnection.class);
List<ImapResponse> imapResponses = Arrays.asList(
createImapResponse("* LIST (\\HasNoChildren) \".\" \"pathPrefix/INBOX\""),
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"pathPrefix/.Folder\""),
createImapResponse("* LIST (\\HasNoChildren) \".\" \"pathPrefix/.Folder.SubFolder\""),
createImapResponse("6 OK Success")
);
when(imapConnection.executeSimpleCommand("LIST \"\" \"pathPrefix/*\"")).thenReturn(imapResponses);
imapStore.enqueueImapConnection(imapConnection);
List<? extends Folder> result = imapStore.getFolders(true);
assertNotNull(result);
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderIds(result));
}
示例3: getPersonalNamespaces_withoutForceListAllAndWithoutSubscribedFoldersOnly
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void getPersonalNamespaces_withoutForceListAllAndWithoutSubscribedFoldersOnly() throws Exception {
when(storeConfig.subscribedFoldersOnly()).thenReturn(false);
ImapConnection imapConnection = mock(ImapConnection.class);
List<ImapResponse> imapResponses = Arrays.asList(
createImapResponse("* LIST (\\HasNoChildren) \".\" \"INBOX\""),
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"Folder\""),
createImapResponse("* LIST (\\HasNoChildren) \".\" \"Folder.SubFolder\""),
createImapResponse("6 OK Success")
);
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
imapStore.enqueueImapConnection(imapConnection);
List<? extends Folder> result = imapStore.getFolders(false);
assertNotNull(result);
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderIds(result));
}
示例4: testVariousPartitionSizes
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
public void testVariousPartitionSizes() throws Exception {
for (int shards = 1; shards <= 4; shards++) {
for (int partitionSize = 1; partitionSize < shards; partitionSize++) {
String index = "index_" + shards + "_" + partitionSize;
client().admin().indices().prepareCreate(index)
.setSettings(Settings.builder()
.put("index.number_of_shards", shards)
.put("index.routing_partition_size", partitionSize))
.addMapping("type", "{\"type\":{\"_routing\":{\"required\":true}}}", XContentType.JSON)
.execute().actionGet();
ensureGreen();
Map<String, Set<String>> routingToDocumentIds = generateRoutedDocumentIds(index);
verifyGets(index, routingToDocumentIds);
verifyBroadSearches(index, routingToDocumentIds, shards);
verifyRoutedSearches(index, routingToDocumentIds, Sets.newSet(partitionSize));
}
}
}
示例5: testParse_tutorCorrectlyFormed
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testParse_tutorCorrectlyFormed() {
JsonObject mockObject = formMockJson();
ParsedULCResponse response = DataParse.parse(mockObject);
// Verify correctly formed Tutor
Tutor tutor = response.getTutors().get(0);
assertThat(tutor.getId(), is(4850785));
assertThat(tutor.getFirstName(), is("Luke"));
assertThat(tutor.getLastName(), is("Skywalker"));
assertThat(tutor.getTutorPreferences().getCoursePreferences().get(Rank.PREFER).stream().map(Course::getId).collect(Collectors.toSet()),
is(Sets.newSet(11995, 11996)));
assertThat(tutor.getTutorPreferences().getCoursePreferences().get(Rank.WILLING).stream().map(Course::getId).collect(Collectors.toSet()),
is(Sets.newSet(2749, 2750, 11991, 15599, 15600, 15602, 15606)));
assertThat(tutor.getTutorPreferences().getShiftPreferences().get(Rank.PREFER).stream().map(Shift::getId).collect(Collectors.toSet()),
is(Sets.newSet(5)));
assertThat(tutor.getTutorPreferences().getShiftPreferences().get(Rank.WILLING).stream().map(Shift::getId).collect(Collectors.toSet()),
is(Sets.newSet(1, 2)));
assertThat(tutor.getTutorPreferences().getShiftFrequencyPreferences().get(Rank.PREFER), is(1));
assertThat(tutor.getTutorPreferences().getShiftFrequencyPreferences().get(Rank.WILLING), is(3));
assertThat(tutor.getTutorStatus(), is(TutorStatus.ACTIVE));
}
示例6: testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind_From_Org() {
thrown.expect(IllegalArgumentException.class);
// To Org
Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets
.newSet("mockOrganizationalProvidersDisclosureIsMadeTo");
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
// From Ind
Set<String> mockProvidersPermittedToDisclose = Sets
.newSet("mockProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo);
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
mockConsentDto
.setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例7: testAssertConsentDto_Fail_With_To_Org_From_Ind_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Fail_With_To_Org_From_Ind_From_Org() {
thrown.expect(IllegalArgumentException.class);
// To Org
Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets
.newSet("mockOrganizationalProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
// From Ind
Set<String> mockProvidersPermittedToDisclose = Sets
.newSet("mockProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
mockConsentDto
.setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例8: testAssertConsentDto_Fail_With_To_Ind_From_Ind_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Fail_With_To_Ind_From_Ind_From_Org() {
thrown.expect(IllegalArgumentException.class);
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
// From Ind
Set<String> mockProvidersPermittedToDisclose = Sets
.newSet("mockProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
mockConsentDto
.setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例9: testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Org() {
thrown.expect(IllegalArgumentException.class);
// To Org
Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets
.newSet("mockOrganizationalProvidersDisclosureIsMadeTo");
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo);
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例10: testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Fail_With_To_Ind_To_Org_From_Ind() {
thrown.expect(IllegalArgumentException.class);
// To Org
Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets
.newSet("mockOrganizationalProvidersDisclosureIsMadeTo");
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Ind
Set<String> mockProvidersPermittedToDisclose = Sets
.newSet("mockProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo);
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例11: testAssertConsentDto_Success_With_To_Ind_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Success_With_To_Ind_From_Org() {
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例12: testAssertConsentDto_Success_With_To_Org_From_Org
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Success_With_To_Org_From_Org() {
// To Org
Set<String> mockOrganizationalProvidersDisclosureIsMadeTo = Sets
.newSet("mockOrganizationalProvidersDisclosureIsMadeTo");
// From Org
Set<String> mockOrganizationalProvidersPermittedToDisclose = Sets
.newSet("mockOrganizationalProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setOrganizationalProvidersDisclosureIsMadeTo(mockOrganizationalProvidersDisclosureIsMadeTo);
mockConsentDto
.setOrganizationalProvidersPermittedToDisclose(mockOrganizationalProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例13: testAssertConsentDto_Success_With_To_Ind_From_Ind
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void testAssertConsentDto_Success_With_To_Ind_From_Ind() {
// To Ind
Set<String> mockProvidersDisclosureIsMadeTo = Sets
.newSet("mockProvidersDisclosureIsMadeTo");
// From Ind
Set<String> mockProvidersPermittedToDisclose = Sets
.newSet("mockProvidersPermittedToDisclose");
ConsentDto mockConsentDto = new ConsentDto();
mockConsentDto
.setProvidersDisclosureIsMadeTo(mockProvidersDisclosureIsMadeTo);
mockConsentDto
.setProvidersPermittedToDisclose(mockProvidersPermittedToDisclose);
sut.assertConsentDto(mockConsentDto);
}
示例14: getPersonalNamespaces_withForceListAll
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void getPersonalNamespaces_withForceListAll() throws Exception {
when(storeConfig.subscribedFoldersOnly()).thenReturn(true);
ImapConnection imapConnection = mock(ImapConnection.class);
List<ImapResponse> imapResponses = Arrays.asList(
createImapResponse("* LIST (\\HasNoChildren) \".\" \"INBOX\""),
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"Folder\""),
createImapResponse("* LIST (\\HasNoChildren) \".\" \"Folder.SubFolder\""),
createImapResponse("6 OK Success")
);
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
imapStore.enqueueImapConnection(imapConnection);
List<? extends Folder> result = imapStore.getPersonalNamespaces(true);
assertNotNull(result);
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderNames(result));
}
示例15: getPersonalNamespaces_withoutForceListAllAndWithoutSubscribedFoldersOnly
import org.mockito.internal.util.collections.Sets; //導入依賴的package包/類
@Test
public void getPersonalNamespaces_withoutForceListAllAndWithoutSubscribedFoldersOnly() throws Exception {
when(storeConfig.subscribedFoldersOnly()).thenReturn(false);
ImapConnection imapConnection = mock(ImapConnection.class);
List<ImapResponse> imapResponses = Arrays.asList(
createImapResponse("* LIST (\\HasNoChildren) \".\" \"INBOX\""),
createImapResponse("* LIST (\\Noselect \\HasChildren) \".\" \"Folder\""),
createImapResponse("* LIST (\\HasNoChildren) \".\" \"Folder.SubFolder\""),
createImapResponse("6 OK Success")
);
when(imapConnection.executeSimpleCommand("LIST \"\" \"*\"")).thenReturn(imapResponses);
imapStore.enqueueImapConnection(imapConnection);
List<? extends Folder> result = imapStore.getPersonalNamespaces(false);
assertNotNull(result);
assertEquals(Sets.newSet("INBOX", "Folder.SubFolder"), extractFolderNames(result));
}