Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/816#discussion_r141605052
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/core/effector/EffectorSayHiTest.java ---
    @@ -99,6 +99,23 @@ public void testInvokeEffectors1() throws Exception {
         }
     
         @Test
    +    public void testInvocationSubmission() throws Exception {
    +        assertEquals(((EntityInternal)e).getExecutionContext()
    +            .submit( Effectors.invocation(e, MyEntity.SAY_HI_1, 
ImmutableMap.of("name", "Bob", "greeting", "hi")) ).get(), "hi Bob");
    +    }
    +    @Test
    +    public void testInvocationGet() throws Exception {
    +        assertEquals(((EntityInternal)e).getExecutionContext()
    +            .get( Effectors.invocation(e, MyEntity.SAY_HI_1, 
ImmutableMap.of("name", "Bob", "greeting", "hi")) ), "hi Bob");
    +    }
    +    
    +    @Test(groups="WIP")  // see comments at 
BasicExecutionContext.getImmediately
    +    public void testInvocationGetImmediately() throws Exception {
    +        assertEquals(((EntityInternal)e).getExecutionContext()
    +            .getImmediately( Effectors.invocation(e, MyEntity.SAY_HI_1, 
ImmutableMap.of("name", "Bob", "greeting", "hi")) ), "hi Bob");
    --- End diff --
    
    This feels like the wrong sort of test. What is the use-case for 
executionContext.getImmediately(...)`? I wouldn't expect someone to pass in an 
unsubmitted effector task.
    
    Looking at where `getImmediately` is used, so what kind of low-level 
`executionContext.getImmediately()` tests we should write, I can't see it ever 
being called with a task. If we really want to support that, we should test it 
with simple unsubmitted, submitted and completed tasks (that are either 
super-fast or that block with a `Thread.sleep()`), and we should check that the 
task isn't put into a broken state by calling `getImmediately(task)` (see one 
of my earlier comments, with an example test snippet).
    
    Also the assertion will always fail: getImmediately returns a Maybe, but 
you're asserting it equals a string.


---

Reply via email to