本文整理匯總了Java中org.mockito.internal.util.collections.Sets.newSet方法的典型用法代碼示例。如果您正苦於以下問題:Java Sets.newSet方法的具體用法?Java Sets.newSet怎麽用?Java Sets.newSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.mockito.internal.util.collections.Sets
的用法示例。
在下文中一共展示了Sets.newSet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: testSerializeAddressList
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void testSerializeAddressList() throws IOException {
Address addr1 = new Address.Builder()
.setName("addr1")
.setAddressSpace("a1")
.setType(new AddressType("queue"))
.setPlan(new Plan("myplan"))
.build();
Address addr2 = new Address.Builder()
.setName("a2")
.setAddressSpace("a1")
.setAddress("addr2")
.setType(new AddressType("anycast"))
.setPlan(new Plan("myplan"))
.build();
AddressList list = new AddressList(Sets.newSet(addr1, addr2));
String serialized = CodecV1.getMapper().writeValueAsString(list);
List<Address> deserialized = CodecV1.getMapper().readValue(serialized, AddressList.class);
assertThat(deserialized, is(list));
}
示例10: testHashBaseForItemAnswersPreservesNullsLiterally
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void testHashBaseForItemAnswersPreservesNullsLiterally()
throws IOException, NoSuchAlgorithmException, ServerOverloadException {
final ItemData item = new ItemData();
item.setTypeId(TypeIfc.FILL_IN_BLANK);
// sequence, at least, is required, else ordering is completely non-deterministic
final Pair<Answer,String> answer1 = answerAndExpectedHashBaseFor(item, 1L, null, null, null, null, null, null);
final Pair<Answer,String> answer2 = answerAndExpectedHashBaseFor(item, 2L, null, null, null, null, null, null);
final ItemText itemText1 = new ItemText(item, 1L, null, Sets.newSet(answerFrom(answer1), answerFrom(answer2)));
answerFrom(answer1).setItemText(itemText1);
answerFrom(answer2).setItemText(itemText1);
item.setItemTextSet(Sets.newSet(itemText1));
final StringBuilder expectedHashBase = new StringBuilder()
.append(stringFrom(answer1))
.append(stringFrom(answer2));
final StringBuilder actualHashBase = new StringBuilder();
itemHashUtil.hashBaseForItemAnswers(item, actualHashBase);
assertThat(actualHashBase.toString(), equalTo(expectedHashBase.toString()));
}
示例11: randomEnumInSet
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void shouldReturnDoesNotHaveMissingComparisonValues_withConditionWhichRequiresComparisonValuesAndNonNullOrEmptyValues() {
// Given
final Set<Operators> operatorsWhichRequireNonNullOrEmptyValues = Sets.newSet(Operators.EQUALS,
Operators.GREATER_THAN_OR_EQUALS, Operators.LESS_THAN_OR_EQUALS);
final Operators operatorWhichRequiresNonNullOrEmptyValue = randomEnumInSet(
operatorsWhichRequireNonNullOrEmptyValues);
final String value = randomString(10);
final Condition condition = new Condition(operatorWhichRequiresNonNullOrEmptyValue, value);
// When
final boolean hasMissingComparisonValues = condition.hasMissingComparisonValues();
// Then
assertFalse(hasMissingComparisonValues);
}
示例12: shouldFetch_withQueryAndItemClass
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void shouldFetch_withQueryAndItemClass() throws Exception {
// Given
final Query query = mock(Query.class);
final Set<StubItem> items = Sets.newSet(randomStubItem(), randomStubItem(), randomStubItem());
when(mockDatabaseTemplate.fetch(any(Query.class), any(Class.class))).thenReturn(items);
final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate(
mockDatabaseTemplate);
// When
final Collection<StubItem> returnedItems = transactionalDatabaseTemplate.fetch(query, StubItem.class);
// Then
verify(mockDatabaseTemplate).fetch(query, StubItem.class);
assertEquals(items, returnedItems);
}
示例13: shouldUpdate_withSingleItem
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void shouldUpdate_withSingleItem() {
// Given
final InMemoryDatabaseTemplate databaseTemplate = new InMemoryDatabaseTemplate(databaseSchemaHolder);
final StubItem createdItem = dataGenerator.randomStubItem();
databaseTemplate.create(createdItem);
final Long originalVersion = createdItem.getVersion();
final String stringProperty = randomString(10);
final String stringProperty2 = randomString(10);
final Set<String> newStringSetProperty = Sets.newSet(randomString(10), randomString(10), randomString(10));
createdItem.setStringProperty(stringProperty);
createdItem.setStringProperty2(stringProperty2);
createdItem.setStringSetProperty(newStringSetProperty);
final Long newVersion = originalVersion + 1;
// When
final StubItem updatedItem = databaseTemplate.update(createdItem);
// Then
assertEquals(newVersion, updatedItem.getVersion());
assertEquals(createdItem.getId(), updatedItem.getId());
assertEquals(stringProperty, updatedItem.getStringProperty());
assertEquals(stringProperty2, updatedItem.getStringProperty2());
assertEquals(newStringSetProperty, updatedItem.getStringSetProperty());
}
示例14: shouldUpdate_withSingleItemWithCompoundPk
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void shouldUpdate_withSingleItemWithCompoundPk() {
// Given
final InMemoryDatabaseTemplate databaseTemplate = new InMemoryDatabaseTemplate(databaseSchemaHolder);
final StubWithRangeItem createdItem = dataGenerator.randomStubWithRangeItem();
databaseTemplate.create(createdItem);
final Long originalVersion = createdItem.getVersion();
final String stringProperty = randomString(10);
final boolean booleanProperty = randomBoolean();
final Set<String> newStringSetProperty = Sets.newSet(randomString(10), randomString(10), randomString(10));
createdItem.setStringProperty(stringProperty);
createdItem.setBooleanProperty(booleanProperty);
createdItem.setStringSetProperty(newStringSetProperty);
final Long newVersion = originalVersion + 1;
// When
final StubWithRangeItem updatedItem = databaseTemplate.update(createdItem);
// Then
assertEquals(newVersion, updatedItem.getVersion());
assertEquals(createdItem.getId(), updatedItem.getId());
assertEquals(stringProperty, updatedItem.getStringProperty());
assertEquals(booleanProperty, updatedItem.isBooleanProperty());
assertEquals(newStringSetProperty, updatedItem.getStringSetProperty());
}
示例15: shouldUpdate_withSingleItem
import org.mockito.internal.util.collections.Sets; //導入方法依賴的package包/類
@Test
public void shouldUpdate_withSingleItem() {
// Given
final DynamoDbTemplate dynamoDbTemplate = new DynamoDbTemplate(databaseSchemaHolder);
dynamoDbTemplate.initialize(amazonDynamoDbClient);
final StubItem createdItem = dataGenerator.createStubItem();
final Long originalVersion = createdItem.getVersion();
final String stringProperty = randomString(10);
final String stringProperty2 = randomString(10);
final Set<String> newStringSetProperty = Sets.newSet(randomString(10), randomString(10), randomString(10));
createdItem.setStringProperty(stringProperty);
createdItem.setStringProperty2(stringProperty2);
createdItem.setStringSetProperty(newStringSetProperty);
final Long newVersion = originalVersion + 1;
// When
final StubItem updatedItem = dynamoDbTemplate.update(createdItem);
// Then
assertEquals(newVersion, updatedItem.getVersion());
assertEquals(createdItem.getId(), updatedItem.getId());
assertEquals(stringProperty, updatedItem.getStringProperty());
assertEquals(stringProperty2, updatedItem.getStringProperty2());
assertEquals(newStringSetProperty, updatedItem.getStringSetProperty());
}