Refine search
@Test public void getWritableMediaTypes() throws Exception { assertThat(this.writer.getWritableMediaTypes(), containsInAnyOrder(MimeTypeUtils.APPLICATION_OCTET_STREAM, MimeTypeUtils.ALL)); }
@Override public Object answer(InvocationOnMock invocation) throws Exception { Collection<W> windows = (Collection<W>) invocation.getArguments()[0]; MergingWindowAssigner.MergeCallback callback = (MergingWindowAssigner.MergeCallback) invocation.getArguments()[1]; // verify the expected windows assertThat(windows, containsInAnyOrder(expectedWindows.toArray())); callback.merge(toMerge, mergeResult); return null; } })
@Override protected boolean matchesSafely( RecentK<Integer> recentK ) { assertThat( recentK.recentItems(), containsInAnyOrder( expectedItems ) ); assertThat( recentK.recentItems().size(), equalTo( expectedItems.length ) ); return true; }
@Test public void shouldGetRelatedIndexForProperty() { assertThat( indexMap.getRelatedIndexes( noEntityToken, entityTokens( 3, 4, 5 ), properties( 4 ), NODE ), containsInAnyOrder( schema3_4 ) ); }
@Test public void loadIndexSeveralMatches() { CandidateComponentsIndex index = CandidateComponentsIndexLoader.loadIndex( CandidateComponentsTestClassLoader.index(getClass().getClassLoader(), new ClassPathResource("spring.components", getClass()))); Set<String> components = index.getCandidateTypes("org.springframework", "foo"); assertThat(components, containsInAnyOrder( "org.springframework.context.index.Sample1", "org.springframework.context.index.Sample2")); }
@Test public void shouldGetRelatedIndexForLabel() { assertThat( indexMap.getRelatedIndexes( entityTokens( 3 ), noEntityToken, IntSets.immutable.empty(), NODE ), containsInAnyOrder( schema3_4, node35_8 ) ); }
private void assertKeyIsArray( ResourceIterator<Map<String,Object>> r, String key, String[] items ) { List<Object> results = getObjectsAsList( r, key ); assertEquals( Arrays.asList( items ).size(), results.size() ); assertThat( results, containsInAnyOrder( items ) ); }
private void testDefaultDomain() { SpringPersistenceUnitInfo puInfo = buildDefaultPersistenceUnitInfo(); assertThat(puInfo.getManagedClassNames(), containsInAnyOrder( "org.springframework.orm.jpa.domain.Person", "org.springframework.orm.jpa.domain.DriversLicense")); }
@Test public void loadIndexSingleMatch() { CandidateComponentsIndex index = CandidateComponentsIndexLoader.loadIndex( CandidateComponentsTestClassLoader.index(getClass().getClassLoader(), new ClassPathResource("spring.components", getClass()))); Set<String> components = index.getCandidateTypes("org.springframework", "biz"); assertThat(components, containsInAnyOrder( "org.springframework.context.index.Sample3")); }
@Test public void shouldGetRelatedIndexOnce() { assertThat( indexMap.getRelatedIndexes( entityTokens( 3 ), noEntityToken, properties( 4 ), NODE ), containsInAnyOrder( schema3_4, node35_8 ) ); assertThat( indexMap.getRelatedIndexes( noEntityToken, entityTokens( 5 ), properties( 6, 7 ), NODE ), containsInAnyOrder( schema5_6_7 ) ); }
private void verifyVerifyUniqueness( SchemaIndex index, SchemaDescriptor descriptor, Object... values ) throws IOException, IndexEntryConflictException { @SuppressWarnings( "unchecked" ) ArgumentCaptor<List<Value[]>> captor = ArgumentCaptor.forClass( List.class ); verify( index ).verifyUniqueness( any(), eq( descriptor.getPropertyIds() ), captor.capture() ); assertThat( captor.getValue(), containsInAnyOrder( valueTupleList( values ).toArray() ) ); } }
@Test public void getCandidateTypes() { CandidateComponentsIndex index = new CandidateComponentsIndex( Collections.singletonList(createSampleProperties())); Set<String> actual = index.getCandidateTypes("com.example.service", "service"); assertThat(actual, containsInAnyOrder("com.example.service.One", "com.example.service.sub.Two", "com.example.service.Three")); }
@Test public void shouldGetMultiLabelForAnyOfTheLabels() { assertThat( indexMap.getRelatedIndexes( entityTokens( 3 ), noEntityToken, IntSets.immutable.empty(), NODE ), containsInAnyOrder( schema3_4, node35_8 ) ); assertThat( indexMap.getRelatedIndexes( entityTokens( 5 ), noEntityToken, IntSets.immutable.empty(), NODE ), containsInAnyOrder( schema5_8, schema5_6_7, node35_8 ) ); }
@Test void streamFilesRecursiveFilePathsMustBeCanonical() throws Exception { File sub = existingDirectory( "sub" ); File a = new File( new File( new File( sub, ".." ), "sub" ), "a" ); ensureExists( a ); Stream<FileHandle> stream = fsa.streamFilesRecursive( sub.getParentFile() ); List<File> filepaths = stream.map( FileHandle::getFile ).collect( toList() ); assertThat( filepaths, containsInAnyOrder( a.getCanonicalFile() ) );// file in our sub directory }
@Test public void getCandidateTypesSubPackage() { CandidateComponentsIndex index = new CandidateComponentsIndex( Collections.singletonList(createSampleProperties())); Set<String> actual = index.getCandidateTypes("com.example.service.sub", "service"); assertThat(actual, containsInAnyOrder("com.example.service.sub.Two")); }
@Test public void shouldOnlyGetRelIndexesForRelUpdates() { assertThat( indexMap.getRelatedIndexes( entityTokens( 3 ), noEntityToken, IntSets.immutable.empty(), RELATIONSHIP ), containsInAnyOrder( rel35_8 ) ); assertThat( indexMap.getRelatedIndexes( entityTokens( 5 ), noEntityToken, IntSets.immutable.empty(), RELATIONSHIP ), containsInAnyOrder( rel35_8 ) ); }
@Test void shouldHandlePathThatLooksVeryDifferentWhenCanonicalized() throws Exception { File dir = existingDirectory( "/././home/.././././home/././.././././././././././././././././././home/././" ); File a = existingFile( "/home/a" ); List<File> filepaths = fsa.streamFilesRecursive( dir ).map( FileHandle::getRelativeFile ).collect( toList() ); assertThat( filepaths, containsInAnyOrder( new File( a.getName() ) ) ); }
@Test public void should_getPluginsInterestedIn_Correctly() { assertThat(notificationPluginRegistry.getPluginsInterestedIn(PIPELINE_STATUS), containsInAnyOrder(PLUGIN_ID_1, PLUGIN_ID_2)); assertThat(notificationPluginRegistry.getPluginsInterestedIn(STAGE_STATUS), containsInAnyOrder(PLUGIN_ID_1, PLUGIN_ID_3)); assertThat(notificationPluginRegistry.getPluginsInterestedIn(JOB_STATUS), containsInAnyOrder(PLUGIN_ID_1)); assertThat(notificationPluginRegistry.getPluginsInterestedIn(UNKNOWN_NOTIFICATION), containsInAnyOrder()); }
@Test public void shouldListPropertyKeys() throws Throwable { // Given givenPropertyKeys( "name", "age" ); // When/Then assertThat( call( "db.propertyKeys" ), containsInAnyOrder( record( "age" ), record( "name" ) ) ); }
private void checkContainsInOrder(Cache<Integer, Integer> cache, Integer... expect) { cache.cleanUp(); List<Integer> evictionList = ImmutableList.copyOf( cache.policy().eviction().get().coldest(Integer.MAX_VALUE).keySet()); assertThat(cache.asMap().size(), is(equalTo(expect.length))); assertThat(cache.asMap().keySet(), containsInAnyOrder(expect)); assertThat(evictionList, is(equalTo(asList(expect)))); }