Refine search
/** * SPR-10517 */ @Test public void findsFactoryBeanNameByTypeWithoutInstantiation() { String[] names = bf.getBeanNamesForType(AnInterface.class, false, false); assertThat(Arrays.asList(names), hasItem("&foo")); Map<String, AnInterface> beans = bf.getBeansOfType(AnInterface.class, false, false); assertThat(beans.size(), is(1)); assertThat(beans.keySet(), hasItem("&foo")); }
private synchronized void doTest() { if (!doTest) { return; } assertThat(logs, hasItem(allOf( containsString(" has been blocked for "), containsString(" time limit is " + maxExecuteTimeUnit.toMillis(maxExecuteTime) + " ms"), containsString("Thread[" + poolName + "-")) )); } }
@SuppressWarnings("unchecked") @Test public void testServiceWithWorkspace() throws Exception { assertThat(geoServer.getService(ServiceInfo.class), equalTo(globalService)); assertThat(geoServer.getService(ws1, ServiceInfo.class), equalTo(newService1)); assertThat(geoServer.getService(ws2, ServiceInfo.class), equalTo(newService2)); assertThat( (Collection<ServiceInfo>) geoServer.getServices(), allOf(hasItem(globalService), not(hasItems(newService1, newService2)))); assertThat( (Collection<ServiceInfo>) geoServer.getServices(ws1), allOf(hasItem(newService1), not(hasItems(globalService, newService2)))); assertThat( (Collection<ServiceInfo>) geoServer.getServices(ws2), allOf(hasItem(newService2), not(hasItems(newService1, globalService))));
@Test public void shouldListFunctions() { // When: final FunctionNameList functionList = makeSingleRequest( "LIST FUNCTIONS;", FunctionNameList.class); // Then: assertThat(functionList.getFunctions(), hasItems( new SimpleFunctionInfo("EXTRACTJSONFIELD", FunctionType.scalar), new SimpleFunctionInfo("ARRAYCONTAINS", FunctionType.scalar), new SimpleFunctionInfo("CONCAT", FunctionType.scalar), new SimpleFunctionInfo("TOPK", FunctionType.aggregate), new SimpleFunctionInfo("MAX", FunctionType.aggregate))); assertThat("shouldn't contain internal functions", functionList.getFunctions(), not(hasItem(new SimpleFunctionInfo("FETCH_FIELD_FROM_STRUCT", FunctionType.scalar)))); }
@Test public void findsBeansByTypeIfNotInstantiated() { assertThat(bf.isTypeMatch("&foo", FactoryBean.class), is(true)); @SuppressWarnings("rawtypes") Map<String, FactoryBean> fbBeans = bf.getBeansOfType(FactoryBean.class); assertThat(1, equalTo(fbBeans.size())); assertThat("&foo", equalTo(fbBeans.keySet().iterator().next())); Map<String, AnInterface> aiBeans = bf.getBeansOfType(AnInterface.class); assertThat(aiBeans.size(), is(1)); assertThat(aiBeans.keySet(), hasItem("&foo")); }
@Test public void shouldListServerOverriddenKsqlProperty() { // Given: givenKsqlConfigWith(ImmutableMap.<String, Object>builder() .put(StreamsConfig.STATE_DIR_CONFIG, "/tmp/other") .build()); // When: final PropertiesList props = makeSingleRequest("list properties;", PropertiesList.class); // Then: assertThat(props.getDefaultProperties(), not(hasItem(containsString(StreamsConfig.STATE_DIR_CONFIG)))); }
@Test public void frenchLocaleString() throws Exception { params.put("localeString", "fr"); List<Map<String, String>> res = runScript(); assertThat(localeStrings(res), both(hasItems("fr", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_CH")).and(not(hasItem("en_ZA")))); }
private void assertRels( Iterator<Long> it, long ... rels ) { List<Matcher<? super Iterable<Long>>> all = new ArrayList<>( rels.length ); for ( long element : rels ) { all.add(hasItem(element)); } List<Long> list = Iterators.asList( it ); assertThat( list, allOf(all)); } }
@Test public void repro() { assertThat(bf.getBean("foo"), instanceOf(Foo.class)); assertThat(bf.getBean("&foo"), instanceOf(FooFactoryBean.class)); assertThat(bf.isTypeMatch("&foo", FactoryBean.class), is(true)); @SuppressWarnings("rawtypes") Map<String, FactoryBean> fbBeans = bf.getBeansOfType(FactoryBean.class); assertThat(fbBeans.size(), is(1)); assertThat(fbBeans.keySet(), hasItem("&foo")); Map<String, AnInterface> aiBeans = bf.getBeansOfType(AnInterface.class); assertThat(aiBeans.size(), is(1)); assertThat(aiBeans.keySet(), hasItem("&foo")); }
@Test public void shouldListServerOverriddenStreamProperty() { // Given: givenKsqlConfigWith(ImmutableMap.<String, Object>builder() .put(StreamsConfig.STATE_CLEANUP_DELAY_MS_CONFIG, STATE_CLEANUP_DELAY_MS_DEFAULT + 1) .build()); // When: final PropertiesList props = makeSingleRequest("list properties;", PropertiesList.class); // Then: assertThat(props.getDefaultProperties(), not(hasItem(containsString(StreamsConfig.STATE_CLEANUP_DELAY_MS_CONFIG)))); }
private synchronized void doTest() { if (!doTest) { return; } assertThat(logs, hasItem(allOf( containsString(" has been blocked for "), containsString(" time limit is " + maxExecuteTimeUnit.toMillis(maxExecuteTime) + " ms"), containsString("Thread[" + poolName + "-")) )); } }
@Test public void bindNamespaceUri() { context.bindNamespaceUri(prefix, namespaceUri); assertThat("The Namespace URI was bound to the prefix", context.getNamespaceURI(prefix), is(namespaceUri)); assertThat("The prefix was bound to the namespace URI", getItemSet(context.getPrefixes(namespaceUri)), hasItem(prefix)); }
@Override public void doAssert(DelegateExecution execution) { IdentityService identityService = execution.getProcessEngineServices().getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); assertThat(currentAuthentication, is(notNullValue())); assertThat(currentAuthentication.getTenantIds(), hasItem(expectedTenantId)); } };
@Test public void testGetAllKnownRegions() throws Exception { prepareRemoteRegionRegistry(); EurekaClient client = discoveryClientResource.getClient(); Set<String> allKnownRegions = client.getAllKnownRegions(); assertThat(allKnownRegions.size(), is(equalTo(2))); assertThat(allKnownRegions, hasItem(TEST_REMOTE_REGION)); }
@Test public void shouldListDefaultKsqlProperty() { // Given: givenKsqlConfigWith(ImmutableMap.<String, Object>builder() .put(StreamsConfig.STATE_DIR_CONFIG, "/tmp/kafka-streams") .build()); // When: final PropertiesList props = makeSingleRequest("list properties;", PropertiesList.class); // Then: assertThat(props.getDefaultProperties(), hasItem(KsqlConfig.KSQL_STREAMS_PREFIX + StreamsConfig.STATE_DIR_CONFIG)); }
@Test public void testRetrieveMissingKeys() throws Exception { InputStream defaultBundleIS = this.getClass().getResourceAsStream(BundleSynchronizedMatcher.L10N_PATH + "myPlugin.properties"); InputStream frBundleIS = this.getClass().getResourceAsStream(BundleSynchronizedMatcher.L10N_PATH + "myPlugin_fr.properties"); InputStream qbBundleIS = this.getClass().getResourceAsStream(BundleSynchronizedMatcher.L10N_PATH + "myPlugin_fr_QB.properties"); try { SortedMap<String, String> diffs = BundleSynchronizedMatcher.retrieveMissingTranslations(frBundleIS, defaultBundleIS); assertThat(diffs.size(), is(1)); assertThat(diffs.keySet(), hasItem("second.prop")); diffs = BundleSynchronizedMatcher.retrieveMissingTranslations(qbBundleIS, defaultBundleIS); assertThat(diffs.size(), is(0)); } finally { IOUtils.closeQuietly(defaultBundleIS); IOUtils.closeQuietly(frBundleIS); IOUtils.closeQuietly(qbBundleIS); } }
@Test public void shouldListServerOverriddenConsumerConfig() { // Given: givenKsqlConfigWith(ImmutableMap.<String, Object>builder() .put(KsqlConfig.KSQL_STREAMS_PREFIX + StreamsConfig.CONSUMER_PREFIX + ConsumerConfig.FETCH_MIN_BYTES_CONFIG, FETCH_MIN_BYTES_DEFAULT + 1) .build()); // When: final PropertiesList props = makeSingleRequest("list properties;", PropertiesList.class); // Then: assertThat(props.getDefaultProperties(), not(hasItem(containsString(ConsumerConfig.FETCH_MIN_BYTES_CONFIG)))); }
@Test public void describeDatabases() { InfluxDB actual = influxDBContainer.getNewInfluxDB(); assertThat(actual, notNullValue()); assertThat(actual.describeDatabases(), hasItem(DATABASE)); }