org.fest.assertions.Condition Java Examples
The following examples show how to use
org.fest.assertions.Condition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TemplatingTestUtils.java From roboconf-platform with Apache License 2.0 | 6 votes |
/** * Creates a condition that matches {@code File}s with a content equal to the given value. * @param expectedContent the expected content of the file. * @return the created matcher. */ public static Condition<File> hasContent( final String expectedContent ) { return new Condition<File>("file has content \"" + expectedContent + "\"") { @Override public boolean matches( File value ) { String actualContent; try { actualContent = Utils.readFileContent(value); } catch (final IOException e) { // Hum... Embarrassing! actualContent = null; } return Objects.equals(expectedContent, actualContent); } }; }
Example #2
Source File: PmdProfileExporterTest.java From sonar-p3c-pmd with MIT License | 5 votes |
public static Condition<String> equalsIgnoreEOL(String text) { final String strippedText = EOLS.removeFrom(text); return new Condition<String>() { @Override public boolean matches(String value) { return EOLS.removeFrom(value).equals(strippedText); } }.as("equal to " + strippedText); }
Example #3
Source File: ClassCacheVersusClassReloadingTest.java From astor with GNU General Public License v2.0 | 5 votes |
private Condition<Throwable> thatCceIsThrownFrom(final String stacktraceElementDescription) { return new Condition<Throwable>() { @Override public boolean matches(Throwable throwable) { StackTraceElement[] stackTrace = throwable.getStackTrace(); for (StackTraceElement stackTraceElement : stackTrace) { if (stackTraceElement.toString().contains(stacktraceElementDescription)) { return true; } } return false; } }; }
Example #4
Source File: TestBase.java From astor with GNU General Public License v2.0 | 5 votes |
protected void assertContainsType(final Collection<?> list, final Class<?> clazz) { Assertions.assertThat(list).satisfies(new Condition<Collection<?>>() { @Override public boolean matches(Collection<?> objects) { for (Object object : objects) { if (clazz.isAssignableFrom(object.getClass())) { return true; } } return false; } }); }