本文整理汇总了Java中org.hamcrest.collection.IsIterableContainingInAnyOrder类的典型用法代码示例。如果您正苦于以下问题:Java IsIterableContainingInAnyOrder类的具体用法?Java IsIterableContainingInAnyOrder怎么用?Java IsIterableContainingInAnyOrder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IsIterableContainingInAnyOrder类属于org.hamcrest.collection包,在下文中一共展示了IsIterableContainingInAnyOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTraverseGraph
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testTraverseGraph() throws CouldNotReceiveResultException, ColumnNameMismatchException {
// Setup
List<PositionListIndex> pliList = fixture.getPLIList();
LinkedList<String> columnNames = new LinkedList<>();
Integer i;
for (i = 0; i < pliList.size(); i++) {
columnNames.add(i.toString());
}
ImmutableList<String> immutableColumnNames = ImmutableList.copyOf(columnNames);
UccGraphTraverser graph = new UccGraphTraverser();
graph.init(fixture.getPLIList(), mock(UniqueColumnCombinationResultReceiver.class), "relation",
immutableColumnNames);
Collection<ColumnCombinationBitset>
expectedUniqueColumnCombinations =
fixture.getExpectedBitset();
//Execute functionality
graph.traverseGraph();
//Check result
assertThat(graph.getMinimalPositiveColumnCombinations(), IsIterableContainingInAnyOrder
.containsInAnyOrder(expectedUniqueColumnCombinations.toArray(
new ColumnCombinationBitset[expectedUniqueColumnCombinations.size()])));
}
示例2: testCalculateConditions
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testCalculateConditions() throws Exception {
//Setup
PositionListIndex uniquePLI = fixture.getUniquePLIForConditionTest();
PositionListIndex conditionPLI = fixture.getConditionPLIForConditionTest();
List<LongArrayList> expectedConditions = fixture.getExpectedConditions();
//Execute functionality
List<LongArrayList> unsatisfiedClusters = new LinkedList<>();
AndConditionTraverser traverser = new AndConditionTraverser(new Dcucc());
List<LongArrayList>
actualConditions =
traverser
.calculateConditions(uniquePLI, conditionPLI, fixture.getFrequency(),
unsatisfiedClusters);
//Check result
assertThat(actualConditions,
IsIterableContainingInAnyOrder.containsInAnyOrder(
expectedConditions.toArray()
)
);
assertEquals(unsatisfiedClusters.get(0), fixture.getExpectedUnsatisfiedClusters().get(0));
}
示例3: getGroups
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void getGroups() throws Exception {
PowerMockito.mockStatic(AzureADGraphClient.class);
Mockito.when(AzureADGraphClient.getUserMembershipsV1(Constants.BEARER_TOKEN))
.thenReturn(Constants.USERGROUPS_JSON);
final UserPrincipal principal = new UserPrincipal();
final List<UserGroup> groups = principal.getGroups(Constants.BEARER_TOKEN);
final List<UserGroup> targetedGroups = new ArrayList<UserGroup>();
targetedGroups.add(new UserGroup("12345678-7baf-48ce-96f4-a2d60c26391e", "group1"));
targetedGroups.add(new UserGroup("12345678-e757-4474-b9c4-3f00a9ac17a0", "group2"));
targetedGroups.add(new UserGroup("12345678-86a4-4237-aeb0-60bad29c1de0", "group3"));
Assert.assertThat(groups, IsIterableContainingInAnyOrder.containsInAnyOrder(groups.toArray()));
}
示例4: downGradeTypeTest
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void downGradeTypeTest() {
TypesModel typesModel = new TypesModel(new HashSet<>(
Arrays.asList(
ModelClassBase.class,
ModelClassWithTypeParameter.class,
ModelClassWithoutTypeParameter.class
)), null, null);
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(NonModelClassWithoutTypeParameter.class),
IsIterableContainingInAnyOrder.containsInAnyOrder(ModelClassWithoutTypeParameter.class));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(TypeUtils.parameterize(NonModelClassWithTypeParameter.class, Float.class)),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(ModelClassWithTypeParameter.class, Float.class, Date.class)));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(NonModelClassWithoutTypeParameterExtendingModelClassWithTypeParameter.class),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(ModelClassWithTypeParameter.class, BigInteger.class, Date.class)));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(NonModelClassWithTypeParameterExtendingNonModelClass.class),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(ModelClassWithTypeParameter.class, Float.class, Date.class)));
}
示例5: getClassHierarchyNodeForType
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void getClassHierarchyNodeForType() throws Exception {
TypesModel.ClassHierarchyNode classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(A.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 6); // all
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(AB.class);
assertNotNull(classHierarchyNodeForType);
assertFalse(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 1); // AB
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(AA.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertEquals(classHierarchyNodeForType.getAllConcreteChildren().size(), 4); // AA, AAA, AAB, AAAA
classHierarchyNodeForType = typesModel.getClassHierarchyNodeForType(X.class);
assertNotNull(classHierarchyNodeForType);
assertTrue(classHierarchyNodeForType.isPolymorphic());
assertThat(classHierarchyNodeForType.getAllConcreteChildren(),
IsIterableContainingInAnyOrder.containsInAnyOrder(A.class, AA.class, AB.class, AAA.class, AAB.class, AAAA.class, AAX.class, AX.class, ABX.class));
}
示例6: getAssignableTypesWithinClassHierarchy
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void getAssignableTypesWithinClassHierarchy() throws Exception {
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(TypeUtils.parameterize(A.class, Integer.class)),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(A.class, Integer.class)));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(TypeUtils.parameterize(XY.class, Float.class)),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(A.class, Float.class)));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(TypeUtils.parameterize(XY.class, Integer.class)),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(A.class, Integer.class),
AAX.class));
assertThat(typesModel.getAssignableTypesWithinClassHierarchy(TypeUtils.parameterize(XY.class, BigInteger.class)),
IsIterableContainingInAnyOrder.containsInAnyOrder(
TypeUtils.parameterize(A.class, BigInteger.class),
TypeUtils.parameterize(AA.class, BigInteger.class),
AAB.class,
AAA.class,
ABX.class,
AAAA.class));
}
示例7: testConjunctFutureValue
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
/**
* Tests that the conjunct future returns upon completion the collection of all future values
*/
@Test
public void testConjunctFutureValue() throws ExecutionException, InterruptedException {
java.util.concurrent.CompletableFuture<Integer> future1 = java.util.concurrent.CompletableFuture.completedFuture(1);
java.util.concurrent.CompletableFuture<Long> future2 = java.util.concurrent.CompletableFuture.completedFuture(2L);
java.util.concurrent.CompletableFuture<Double> future3 = new java.util.concurrent.CompletableFuture<>();
ConjunctFuture<Collection<Number>> result = FutureUtils.combineAll(Arrays.asList(future1, future2, future3));
assertFalse(result.isDone());
future3.complete(.1);
assertTrue(result.isDone());
assertThat(result.get(), IsIterableContainingInAnyOrder.<Number>containsInAnyOrder(1, 2L, .1));
}
示例8: testUpdateCommits
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testUpdateCommits() throws IOException
{
when(repositoryPullRequestDao.findRequestByRemoteId(eq(repository), anyLong())).thenReturn(null);
RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
when(commitMapping.getNode()).thenReturn("original");
when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
target.setCommits(new RepositoryCommitMapping[] { commitMapping });
RepositoryCommit repositoryCommit = mockCommit("aaa");
when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
verify(notificationService, times(1)).broadcast(anyObject());
}
示例9: testUpdateCommitRetargeted
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testUpdateCommitRetargeted() throws IOException
{
final PullRequestMarker destination = mockRef("destinationBranch2");
when(pullRequest.getBase()).thenReturn(destination);
RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
when(commitMapping.getNode()).thenReturn("original");
when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
target.setCommits(new RepositoryCommitMapping[] { commitMapping });
RepositoryCommit repositoryCommit = mockCommit("aaa");
when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
}
示例10: testUpdateCommitStatusChanged
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testUpdateCommitStatusChanged() throws IOException
{
when(pullRequest.getState()).thenReturn("closed");
RepositoryCommitMapping commitMapping = mock(RepositoryCommitMapping.class);
when(commitMapping.getNode()).thenReturn("original");
when(pullRequestMapping.getCommits()).thenReturn(new RepositoryCommitMapping[] { commitMapping });
target.setCommits(new RepositoryCommitMapping[] { commitMapping });
RepositoryCommit repositoryCommit = mockCommit("aaa");
when(gitHubPullRequestService.getCommits(any(IRepositoryIdProvider.class), anyInt())).thenReturn(Arrays.asList(repositoryCommit));
testedClass.processPullRequest(repository, pullRequest);
verify(repositoryPullRequestDao).saveCommit(eq(repository), saveCommitCaptor.capture());
assertEquals(saveCommitCaptor.getValue().get(RepositoryCommitMapping.NODE), "aaa");
verify(repositoryPullRequestDao).unlinkCommits(eq(repository), eq(target), argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
verify(repositoryPullRequestDao).removeCommits(argThat(IsIterableContainingInAnyOrder.containsInAnyOrder(commitMapping)));
}
示例11: should_return_common_and_specific_parameters
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void should_return_common_and_specific_parameters() {
// when
final List<Parameter> actionParams = action.getParameters(Locale.US);
// then
assertThat(actionParams, hasSize(8));
final List<String> paramNames = actionParams.stream().map(Parameter::getName).collect(toList());
assertThat(paramNames, IsIterableContainingInAnyOrder.containsInAnyOrder(COLUMN_ID.getKey(), //
ActionsUtils.CREATE_NEW_COLUMN, //
ROW_ID.getKey(), //
SCOPE.getKey(), //
FILTER.getKey(), //
CELL_VALUE_PARAMETER, //
REPLACE_VALUE_PARAMETER, //
REPLACE_ENTIRE_CELL_PARAMETER));
}
示例12: test_parameters
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void test_parameters() {
// when
final List<Parameter> actionParams = action.getParameters(Locale.US);
// then
assertThat(actionParams, hasSize(7));
final List<String> paramNames = actionParams.stream().map(Parameter::getName).collect(toList());
assertThat(paramNames, IsIterableContainingInAnyOrder.containsInAnyOrder( //
ActionsUtils.CREATE_NEW_COLUMN,
COLUMN_ID.getKey(), //
SCOPE.getKey(), //
ROW_ID.getKey(), //
ORIGINAL_VALUE_PARAMETER, //
FILTER.getKey(), //
NEW_VALUE_PARAMETER) //
);
}
示例13: testPun
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testPun() {
Node i = getNode("http://example.org/i");
Node j = getNode("http://example.org/j");
Node k = getNode("http://example.org/k");
RelationshipType p = RelationshipType.withName("http://example.org/p");
Relationship relationship = getOnlyElement(GraphUtil.getRelationships(i, j, p));
assertThat("OPE edge should start with the subject.", relationship.getStartNode(), is(i));
assertThat("OPE edge should end with the target.", relationship.getEndNode(), is(j));
relationship = getOnlyElement(GraphUtil.getRelationships(i, k, OwlRelationships.RDFS_SUBCLASS_OF));
assertThat("Subclass edge should start with i.", relationship.getStartNode(), is(i));
assertThat("Subclass edge should end with k.", relationship.getEndNode(), is(k));
assertThat("i is both a class an a named individual" , i.getLabels(),
is(IsIterableContainingInAnyOrder.containsInAnyOrder(OwlLabels.OWL_CLASS, OwlLabels.OWL_NAMED_INDIVIDUAL)));
}
示例14: filter_elements_by_type
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
/**
* Filter by class type
*/
@Test
public void filter_elements_by_type () {
List<Object> randomObjects = Lists.newArrayList();
randomObjects.add(new Integer(15));
randomObjects.add(new Double(12));
randomObjects.add("hello");
randomObjects.add(Lists.newArrayList());
randomObjects.add(Maps.newConcurrentMap());
randomObjects.add("world");
Iterable<String> strings = Iterables.filter(randomObjects, String.class);
assertThat(strings, IsIterableContainingInAnyOrder.
<String>containsInAnyOrder("hello", "world"));
}
示例15: testGetUngroundedLoops2
import org.hamcrest.collection.IsIterableContainingInAnyOrder; //导入依赖的package包/类
@Test
public void testGetUngroundedLoops2()
{
BehaviourBlock bb = new BehaviourBlock();
bb.readXML("<bml "+TestUtil.getDefNS()+"id=\"bml1\"><gesture id=\"g1\" start=\"g2:start\" lexeme=\"BEAT\"/>"
+ "<gesture id=\"g2\" lexeme=\"BEAT\" end=\"g3:end\"/>" +
"<gesture id=\"g3\" stroke=\"g1:stroke\" lexeme=\"BEAT\"/></bml>");
parser.addBehaviourBlock(bb);
List<List<Behaviour>> list = parser.getUngroundedLoops("bml1", "g1");
assertEquals(1, list.size());
assertThat(list.get(0),
IsIterableContainingInAnyOrder.containsInAnyOrder(parser.getBehaviour("bml1", "g2"), parser.getBehaviour("bml1", "g3")));
list = parser.getUngroundedLoops("bml1", "g2");
assertEquals(1, list.size());
assertThat(list.get(0),
IsIterableContainingInAnyOrder.containsInAnyOrder(parser.getBehaviour("bml1", "g1"), parser.getBehaviour("bml1", "g3")));
list = parser.getUngroundedLoops("bml1", "g3");
assertEquals(1, list.size());
assertThat(list.get(0),
IsIterableContainingInAnyOrder.containsInAnyOrder(parser.getBehaviour("bml1", "g1"), parser.getBehaviour("bml1", "g2")));
}