brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
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:

    https://github.com/apache/incubator-brooklyn/pull/1066#discussion_r45842448
  
    --- Diff: usage/test-framework/src/main/java/org/apache/brooklyn/test/framework/SimpleShellCommandTestImpl.java
---
    @@ -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()));
             support.validate();
         }
     
    +    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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message