/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, when whitespace differences are (mostly) ignored. To be * exact, the following whitespace rules are applied: * <ul> * <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li> * <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li> * </ul> * <p/> * For example: * <pre>assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))</pre> * * @param expectedString * the expected value of matched strings */ public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expectedString); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, when whitespace differences are (mostly) ignored. To be * exact, the following whitespace rules are applied: * <ul> * <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li> * <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li> * </ul> * <p/> * For example: * <pre>assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))</pre> * * @param expectedString * the expected value of matched strings */ @Factory public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString) { return new IsEqualIgnoringWhiteSpace(expectedString); }
@Override public boolean matchesSafely(String item) { return stripSpace(string).equalsIgnoreCase(stripSpace(item)); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, when whitespace differences are (mostly) ignored. To be * exact, the following whitespace rules are applied: * <ul> * <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li> * <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li> * </ul> * For example: * <pre>assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))</pre> * * @param expectedString * the expected value of matched strings */ public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String expectedString) { return org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expectedString); }
@Override public void describeMismatchSafely(String item, Description mismatchDescription) { mismatchDescription.appendText("was ").appendText(stripSpace(item)); }
/** * Creates a matcher of {@link String} that matches when the examined string is equal to * the specified expectedString, when whitespace differences are (mostly) ignored. To be * exact, the following whitespace rules are applied: * <ul> * <li>all leading and trailing whitespace of both the expectedString and the examined string are ignored</li> * <li>any remaining whitespace, appearing within either string, is collapsed to a single space before comparison</li> * </ul> * For example: * <pre>assertThat(" my\tfoo bar ", equalToIgnoringWhiteSpace(" my foo bar"))</pre> * * @param expectedString * the expected value of matched strings */ public static Matcher<String> equalToIgnoringWhiteSpace(String expectedString) { return new IsEqualIgnoringWhiteSpace(expectedString); }
public static org.hamcrest.Matcher<java.lang.String> equalToIgnoringWhiteSpace(java.lang.String string) { return org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(string); }
@Override public boolean matchesSafely(String item) { return stripSpace(string).equalsIgnoreCase(stripSpace(item)); }
@Factory public static Matcher<String> equalToIgnoringWhiteSpace(String string) { return new IsEqualIgnoringWhiteSpace(string); }
public ExpectationsBuilder archives(String fileName, String content) { return buildMatches(HasArchived.hasArchivedString(equalTo(fileName), equalToIgnoringWhiteSpace(content))); }
@Override public void describeMismatchSafely(String item, Description mismatchDescription) { mismatchDescription.appendText("was ").appendText(stripSpace(item)); }
@Test public void createModel() throws IOException, SAXException { final Optional<MetadataType> root = new JavaTypeLoader(this.getClass().getClassLoader()).load(def); assertThat(root.isPresent(), is(true)); final String actual = new MetadataTypeWriter().toString(root.get()); assertThat(actual, equalToIgnoringWhiteSpace(IOUtils.toString(new FileInputStream(expected)))); } }
public boolean matchesSafely(String item) { return stripSpace(string).equalsIgnoreCase(stripSpace(item)); }