brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <>
Subject [GitHub] incubator-brooklyn pull request: Updates to Test framework asserti...
Date Wed, 25 Nov 2015 09:06:05 GMT
Github user ahgittin commented on a diff in the pull request:
    --- Diff: usage/test-framework/src/main/java/org/apache/brooklyn/test/framework/
    @@ -107,13 +107,23 @@ protected void handle(Result result) {
             LOG.debug("{}, Result is {}\nwith output [\n{}\n] and error [\n{}\n]", new Object[]
                 this, result.getExitCode(), shorten(result.getStdout()), shorten(result.getStderr())
    +        ImmutableMap<String, Duration> flags = ImmutableMap.of("timeout", getConfig(TIMEOUT));
             AssertionSupport support = new AssertionSupport();
    -        checkAssertions(support, exitCodeAssertions(), "exit code", result.getExitCode());
    -        checkAssertions(support, getConfig(ASSERT_OUT), "stdout", result.getStdout());
    -        checkAssertions(support, getConfig(ASSERT_ERR), "stderr", result.getStderr());
    +        TestFrameworkAssertions.checkAssertions(support, flags, exitCodeAssertions(),
"exit code", supply(result.getExitCode()));
    +        TestFrameworkAssertions.checkAssertions(support, flags, getConfig(ASSERT_OUT),
"stdout", supply(result.getStdout()));
    +        TestFrameworkAssertions.checkAssertions(support, flags, getConfig(ASSERT_ERR),
"stderr", supply(result.getStderr()));
    +    private static <T> Supplier<T> supply(final T t) {
    --- End diff --
    see `Suppliers.ofInstance`.  in fact for most such helpers you'll probably find it exists.
 worth asking.
    also, avoid anonymous classes except for very transient operations.  if they get in to
config values and get persisted the persistence gets ugly!

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message