public String toString() { //TODO SF add unit tests and integ test coverage for describeTo() return StringDescription.toString(matcher); } }
@Override public void describeTo(Description desc) { desc.appendText("a BeanDefinitionRegistry containing bean named ") .appendValue(beanName); }
@Override public void describeTo(Description description) { description.appendText("exception cause ").appendDescriptionOf(matcher); } };
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert that the resulting value is an array. * @param content the JSON content */ public void assertValueIsArray(String content) { Object value = assertExistsAndReturn(content); MatcherAssert.assertThat(failureReason("an array", value), value, CoreMatchers.instanceOf(List.class)); }
@Test public void getAttributes() { assertThat(SimpAttributesContextHolder.getAttributes(), nullValue()); SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.getAttributes(), sameInstance(this.simpAttributes)); }
@Test public void destroy() throws Exception { filter = new PatternMappingFilterProxy(delegate, "/"); filter.destroy(); assertThat(delegate.destroy, is(true)); }
@Test public void getWebConnectionDefaultNotNull() { assertThat(this.driver.getWebConnection(), notNullValue()); }
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert the resulting value with the given {@code Matcher}. * @param content the JSON content * @param matcher the matcher with which to assert the result */ @SuppressWarnings("unchecked") public <T> void assertValue(String content, Matcher<T> matcher) { T value = (T) evaluateJsonPath(content); MatcherAssert.assertThat("JSON path \"" + this.expression + "\"", value, matcher); }
@Override public void describeTo(final Description description) { description.appendText("Expected ring buffer with events matching: "); for (Matcher<?> expectedValueMatcher : expectedValueMatchers) { expectedValueMatcher.describeTo(description); } } }
@Test public void currentAttributes() { SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.currentAttributes(), sameInstance(this.simpAttributes)); }
private void expectContainerMissingValueAttribute() { exception.expect(AnnotationConfigurationException.class); exception.expectMessage(startsWith("Invalid declaration of container type")); exception.expectMessage(containsString(ContainerMissingValueAttribute.class.getName())); exception.expectMessage(containsString("for repeatable annotation")); exception.expectMessage(containsString(InvalidRepeatable.class.getName())); exception.expectCause(isA(NoSuchMethodException.class)); }
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert that the resulting value is a {@link Map}. * @param content the JSON content * @since 4.2.1 */ public void assertValueIsMap(String content) { Object value = assertExistsAndReturn(content); MatcherAssert.assertThat(failureReason("a map", value), value, CoreMatchers.instanceOf(Map.class)); }
@Test public void resetAttributes() { SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.getAttributes(), sameInstance(this.simpAttributes)); SimpAttributesContextHolder.resetAttributes(); assertThat(SimpAttributesContextHolder.getAttributes(), nullValue()); }
@Override public void describeTo(Description description) { description.appendText("Candidates with type ").appendValue(this.type); description.appendText(" and stereotypes ").appendValue(this.stereotypes); } }
/** * Parse the content as {@link Node} and apply a {@link Matcher}. */ public void assertNode(String content, Matcher<? super Node> matcher) throws Exception { Document document = parseXmlString(content); assertThat("Body content", document, matcher); }
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert that the resulting value is a {@link Boolean}. * @param content the JSON content * @since 4.2.1 */ public void assertValueIsBoolean(String content) { Object value = assertExistsAndReturn(content); MatcherAssert.assertThat(failureReason("a boolean", value), value, CoreMatchers.instanceOf(Boolean.class)); }
@Test public void setAttributes() { SimpAttributesContextHolder.setAttributes(this.simpAttributes); assertThat(SimpAttributesContextHolder.getAttributes(), sameInstance(this.simpAttributes)); SimpAttributesContextHolder.setAttributes(null); assertThat(SimpAttributesContextHolder.getAttributes(), nullValue()); }
@Override public void describeTo(Description description) { description.appendText("containing <" + count + "> occurrence of ").appendValue(this.substring); }
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert that the resulting value is a {@link String}. * @param content the JSON content * @since 4.2.1 */ public void assertValueIsString(String content) { Object value = assertExistsAndReturn(content); MatcherAssert.assertThat(failureReason("a string", value), value, CoreMatchers.instanceOf(String.class)); }
/** * Evaluate the JSON path expression against the supplied {@code content} * and assert that the resulting value is a {@link Number}. * @param content the JSON content * @since 4.2.1 */ public void assertValueIsNumber(String content) { Object value = assertExistsAndReturn(content); MatcherAssert.assertThat(failureReason("a number", value), value, CoreMatchers.instanceOf(Number.class)); }