Refine search
@SuppressWarnings( "WeakerAccess" ) public void assertBuffer( Object... writeEvents ) { assertThat( buffer, Matchers.contains( writeEvents ) ); }
@Test @Ignore // SPR-15122 public void listenersReceiveEarlyEvents() { load(EventOnPostConstruct.class, OrderedTestListener.class); OrderedTestListener listener = this.context.getBean(OrderedTestListener.class); assertThat(listener.order, contains("first", "second", "third")); }
@Test public void fromMethodCallWithPathVariableAndMultiValueRequestParams() { UriComponents uriComponents = fromMethodCall( on(ControllerWithMethods.class).methodWithMultiValueRequestParams("1", Arrays.asList(3, 7), 5)).build(); assertThat(uriComponents.getPath(), is("/something/1/foo")); MultiValueMap<String, String> queryParams = uriComponents.getQueryParams(); assertThat(queryParams.get("limit"), contains("5")); assertThat(queryParams.get("items"), containsInAnyOrder("3", "7")); }
@Test public void shouldReturnListWithValueForPresentWithValue() { assertThat(PRESENT_WITH_VALUE.asList(), contains(VALUE)); } }
@Test public void fromMethodNameWithPathVarAndRequestParam() { UriComponents uriComponents = fromMethodName( ControllerWithMethods.class, "methodForNextPage", "1", 10, 5).build(); assertThat(uriComponents.getPath(), is("/something/1/foo")); MultiValueMap<String, String> queryParams = uriComponents.getQueryParams(); assertThat(queryParams.get("limit"), contains("5")); assertThat(queryParams.get("offset"), contains("10")); }
@Test public void shouldListSystemComponents() throws Throwable { // When/Then assertThat( call( "dbms.components" ), contains( record( "Neo4j Kernel", singletonList( "1.3.37" ), "enterprise" ) ) ); }
private void assertContainsInOrder( Iterable<NodeWithPropertyValues> iterable, NodeWithPropertyValues... expected ) { if ( expected.length == 0 ) { assertThat( iterable, emptyIterable() ); } else { assertThat( iterable, contains( expected ) ); } }
@Test public void orderedListeners() { load(OrderedTestListener.class); OrderedTestListener listener = this.context.getBean(OrderedTestListener.class); assertTrue(listener.order.isEmpty()); this.context.publishEvent("whatever"); assertThat(listener.order, contains("first", "second", "third")); }
@Test public void shouldMatchOnSingleProperty() { // when List<IndexDescriptor> matched = new ArrayList<>(); NodeSchemaMatcher.onMatchingSchema( iterator( index1 ), node, new StubPropertyCursor(), unIndexedPropId, ( schema, props ) -> matched.add( schema ) ); // then assertThat( matched, contains( index1 ) ); }
private void assertContainsInOrder( LongIterable iterable, long... nodeIds ) { assertThat( Arrays.asList( iterable.toArray() ), contains( nodeIds ) ); }
@Test public void mergeCandidateStereotypes() { CandidateComponentsIndex index = new CandidateComponentsIndex(Arrays.asList( createProperties("com.example.Foo", "service"), createProperties("com.example.Foo", "entity"))); assertThat(index.getCandidateTypes("com.example", "service"), contains("com.example.Foo")); assertThat(index.getCandidateTypes("com.example", "entity"), contains("com.example.Foo")); }
@Test public void shouldMatchOnTwoProperties() { // when List<IndexDescriptor> matched = new ArrayList<>(); NodeSchemaMatcher.onMatchingSchema( iterator( index1_2 ), node, new StubPropertyCursor(), unIndexedPropId, ( schema, props ) -> matched.add( schema ) ); // then assertThat( matched, contains( index1_2 ) ); }
@Test(dataProvider = "empty") public void addAll_withPopulated(LinkedDeque<LinkedValue> deque) { List<LinkedValue> expected = new ArrayList<>(); populate(expected); assertThat(deque.addAll(expected), is(true)); assertThat(deque, contains(expected.toArray(new LinkedValue[0]))); }
@Test public void ifNoneMatchList() { String ifNoneMatch1 = "\"v2.6\""; String ifNoneMatch2 = "\"v2.7\", \"v2.8\""; List<String> ifNoneMatchList = new ArrayList<>(2); ifNoneMatchList.add(ifNoneMatch1); ifNoneMatchList.add(ifNoneMatch2); headers.setIfNoneMatch(ifNoneMatchList); assertThat(headers.getIfNoneMatch(), Matchers.contains("\"v2.6\"", "\"v2.7\"", "\"v2.8\"")); assertEquals("Invalid If-None-Match header", "\"v2.6\", \"v2.7\", \"v2.8\"", headers.getFirst("If-None-Match")); }
@Test public void shouldMatchOnSpecialProperty() { // when List<IndexDescriptor> matched = new ArrayList<>(); NodeSchemaMatcher.onMatchingSchema( iterator( indexOnSpecialProperty ), node, new StubPropertyCursor(), specialPropId, ( schema, props ) -> matched.add( schema ) ); // then assertThat( matched, contains( indexOnSpecialProperty ) ); }
@Test void streamFilesRecursiveMustNotSeeFilesLaterCreatedBaseDirectory() throws Exception { File a = existingFile( "a" ); Stream<FileHandle> stream = fsa.streamFilesRecursive( a.getParentFile() ); File b = existingFile( "b" ); Set<File> files = stream.map( FileHandle::getFile ).collect( toSet() ); assertThat( files, contains( a ) ); assertThat( files, not( contains( b ) ) ); }
@Test public void ifMatchMultipleHeaders() { headers.add(HttpHeaders.IF_MATCH, "\"v2,0\""); headers.add(HttpHeaders.IF_MATCH, "W/\"v2,1\", \"v2,2\""); assertEquals("Invalid If-Match header", "\"v2,0\"", headers.get(HttpHeaders.IF_MATCH).get(0)); assertEquals("Invalid If-Match header", "W/\"v2,1\", \"v2,2\"", headers.get(HttpHeaders.IF_MATCH).get(1)); assertThat(headers.getIfMatch(), Matchers.contains("\"v2,0\"", "W/\"v2,1\"", "\"v2,2\"")); }
@Test public void head_tail_grabs_correct() { List<Integer> result = JsonPath.parse(JSON).read("$[0:3]"); assertThat(result, Matchers.contains(1, 3, 5)); }
@Test(dataProvider = "caches") @CacheSpec(implementation = Implementation.Caffeine, population = {Population.PARTIAL, Population.FULL}, expiry = CacheExpiry.ACCESS, removalListener = { Listener.DEFAULT, Listener.REJECTING }) public void youngest_order(CacheContext context, VarExpiration<Integer, Integer> expireAfterVar) { Map<Integer, Integer> youngest = expireAfterVar.youngest(Integer.MAX_VALUE); Set<Integer> keys = new LinkedHashSet<>(ImmutableList.copyOf(youngest.keySet()).reverse()); assertThat(keys, contains(Iterables.toArray(keys, Integer.class))); }
@Test public void fromMethodCallWithPathVariableAndRequestParams() { UriComponents uriComponents = fromMethodCall( on(ControllerWithMethods.class).methodForNextPage("1", 10, 5)).build(); assertThat(uriComponents.getPath(), is("/something/1/foo")); MultiValueMap<String, String> queryParams = uriComponents.getQueryParams(); assertThat(queryParams.get("limit"), contains("5")); assertThat(queryParams.get("offset"), contains("10")); }