org.hamcrest.core.IsAnything Java Examples

The following examples show how to use org.hamcrest.core.IsAnything. 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: MapOfTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void createsMapWithFunctions() {
    MatcherAssert.assertThat(
        "Can't create a map with functions as values",
        new MapOf<Integer, Scalar<Boolean>>(
            new MapEntry<>(0, () -> true),
            new MapEntry<>(
                1,
                () -> {
                    throw new IOException("oops");
                }
            )
        ),
        new IsMapContaining<>(new IsEqual<>(0), new IsAnything<>())
    );
}
 
Example #2
Source File: StickyTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void extendsExistingMap() throws Exception {
    MatcherAssert.assertThat(
        "Can't extend an existing map",
        new Sticky<String, String>(
            new Sticky<String, String>(
                new MapEntry<>("make", "Mercedes-Benz"),
                new MapEntry<>("cost", "$95,000")
            ),
            new MapEntry<>("year", "2017"),
            new MapEntry<>("mileage", "12,000")
        ),
        new IsMapContaining<>(
            new IsAnything<>(),
            new StringEndsWith(",000")
        )
    );
}
 
Example #3
Source File: StickyTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void extendsExistingMapWithFunc() throws Exception {
    MatcherAssert.assertThat(
        "Can't transform and decorate a list of entries",
        new Sticky<>(
            color -> new MapEntry<>(
                color, color.toUpperCase(Locale.ENGLISH)
            ),
            new Sticky<String, String>(
                new MapEntry<>("black", "BLACK"),
                new MapEntry<>("white", "WHITE")
            ),
            new IterableOf<>("yellow", "red", "blue")
        ),
        new IsMapContaining<>(
            new IsAnything<>(),
            new IsEqual<>("BLUE")
        )
    );
}
 
Example #4
Source File: StickyTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void extendsExistingMapWithTwoFuncs() throws Exception {
    MatcherAssert.assertThat(
        "Can't transform and decorate a list of entries with two funcs",
        new Sticky<>(
            color -> new FormattedText("[%s]", color).asString(),
            String::toUpperCase,
            new Sticky<String, String>(
                new MapEntry<>("black!", "Black!"),
                new MapEntry<>("white!", "White!")
            ),
            new IterableOf<>("yellow!", "red!", "blue!")
        ),
        new IsMapContaining<>(
            new IsAnything<>(),
            new IsEqual<>("BLUE!")
        )
    );
}
 
Example #5
Source File: StickyTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void decoratesEntries() throws Exception {
    MatcherAssert.assertThat(
        "Can't decorate a list of entries",
        new Sticky<String, String>(
            new MapEntry<>("first", "Jeffrey"),
            new MapEntry<>("last", "Lebowski")
        ),
        new IsMapContaining<>(
            new IsAnything<>(),
            new StringEndsWith("ski")
        )
    );
}
 
Example #6
Source File: CameraViewTest.java    From cameraview with Apache License 2.0 4 votes vote down vote up
@Override
public Matcher<View> getConstraints() {
    return new IsAnything<>();
}
 
Example #7
Source File: HttpJmapAuthentication.java    From james-project with Apache License 2.0 4 votes vote down vote up
public static AccessToken authenticateJamesUser(URIBuilder uriBuilder, Username username, String password) {
    return calmlyAwait.until(
        () -> doAuthenticate(uriBuilder, username, password), IsAnything.anything());
}
 
Example #8
Source File: AsyncMatchers.java    From mapper with Apache License 2.0 4 votes vote down vote up
public static <T> Matcher<Async<T>> succeeded() {
  return result(new IsAnything<T>());
}
 
Example #9
Source File: AsyncMatchers.java    From mapper with Apache License 2.0 4 votes vote down vote up
public static Matcher<Async<?>> failed() {
  return failure(new IsAnything<>());
}