Refine search
@Test public void getAttributeOverrideNameFromWrongTargetAnnotation() throws Exception { Method attribute = AliasedComposedContextConfig.class.getDeclaredMethod("xmlConfigFile"); assertThat("xmlConfigFile is not an alias for @Component.", getAttributeOverrideName(attribute, Component.class), is(nullValue())); }
@Test public void createMapWithNullElements() throws Exception { TypeDescriptor typeDescriptor = TypeDescriptor.map(LinkedHashMap.class, null, null); assertThat(typeDescriptor.getMapKeyTypeDescriptor(), nullValue()); assertThat(typeDescriptor.getMapValueTypeDescriptor(), nullValue()); }
private void assertSingleSessionCookie(String expected) { com.gargoylesoftware.htmlunit.util.Cookie jsessionidCookie = webClient.getCookieManager().getCookie("JSESSIONID"); if (expected == null || expected.contains("Expires=Thu, 01-Jan-1970 00:00:01 GMT")) { assertThat(jsessionidCookie, nullValue()); return; } String actual = jsessionidCookie.getValue(); assertThat("JSESSIONID=" + actual + "; Path=/test; Domain=example.com", equalTo(expected)); }
@Test public void setAttributes() { SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.getAttributes(), sameInstance(this.simpAttributes)); SimpAttributesContextHolder.setAttributes(null); assertThat(SimpAttributesContextHolder.getAttributes(), nullValue()); }
@Test public void getAttributeOverrideNameForNonAliasedAttribute() throws Exception { Method nonAliasedAttribute = ImplicitAliasesContextConfig.class.getDeclaredMethod("nonAliasedAttribute"); assertThat(getAttributeOverrideName(nonAliasedAttribute, ContextConfig.class), is(nullValue())); }
@Test public void resolveVariableNotFound() throws Exception { ResolvableType type = ResolvableType.forMethodReturnType(Methods.class.getMethod("typedReturn")); assertThat(type.resolve(), nullValue()); }
@Test public void resetAttributes() { SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.getAttributes(), sameInstance(this.simpAttributes)); SimpAttributesContextHolder.resetAttributes(); assertThat(SimpAttributesContextHolder.getAttributes(), nullValue()); }
public void testUnlessExpression(CacheableService<?> service) throws Exception { Cache cache = this.cm.getCache("testCache"); cache.clear(); service.unless(10); service.unless(11); assertThat(cache.get(10).get(), equalTo(10L)); assertThat(cache.get(11), nullValue()); }
@Test public void createDateTimeFormatterWithNullFallback() { DateTimeFormatter formatter = factory.createDateTimeFormatter(null); assertThat(formatter, is(nullValue())); }
@Test public void resolveTypeVaraibleFromMethodReturn() throws Exception { ResolvableType type = ResolvableType.forMethodReturnType(Methods.class.getMethod("typedReturn")); assertThat(type.resolve(), nullValue()); }
@Test public void shouldPutIfAbsentWithNullValue() { assertThat(this.map.putIfAbsent(123, null), is(nullValue())); assertThat(this.map.putIfAbsent(123, "123"), is(nullValue())); assertThat(this.map.get(123), is(nullValue())); }
@Test public void createCollectionWithNullElement() throws Exception { TypeDescriptor typeDescriptor = TypeDescriptor.collection(List.class, null); assertThat(typeDescriptor.getElementTypeDescriptor(), nullValue()); }
@Test public void validateIndexIsDisabledByDefault() { CandidateComponentsIndex index = CandidateComponentsIndexLoader.loadIndex(null); assertThat("No spring.components should be available at the default location", index, is(nullValue())); }
@Test public void resolveTypeVariableFromType() throws Exception { Type sourceType = Methods.class.getMethod("typedReturn").getGenericReturnType(); ResolvableType type = ResolvableType.forType(sourceType); assertThat(type.resolve(), nullValue()); assertThat(type.getType().toString(), equalTo("T")); }
@Test public void createDateTimeFormatterWithNullFallback() { DateTimeFormatter formatter = factory.createDateTimeFormatter(null); assertThat(formatter, is(nullValue())); }
@Test public void buildRequestCookiesNull() { MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); assertThat(actualRequest.getCookies(), nullValue()); }
@Test public void shouldGetWithNoItems() { assertThat(this.map.get(123), is(nullValue())); }
@Test public void setContextPathNull() { requestBuilder.setContextPath(null); assertThat(getContextPath(), nullValue()); }
@Test public void shouldRemoveWhenKeyIsNotInMap() { assertThat(this.map.remove(123), is(nullValue())); assertThat(this.map.remove(null), is(nullValue())); assertThat(this.map.isEmpty(), is(true)); }
@Test public void resolveTypeVariableFromMethodParameter() throws Exception { Method method = Methods.class.getMethod("typedParameter", Object.class); ResolvableType type = ResolvableType.forMethodParameter(method, 0); assertThat(type.resolve(), nullValue()); assertThat(type.getType().toString(), equalTo("T")); }