Re: Testing RichAsyncFunction with TestHarness

Posted by KristoffSC on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Testing-RichAsyncFunction-with-TestHarness-tp33947p33963.html

HI :) I have finally figured it out :)

On top of changes from last email,
in my test method, I had to wrap "testHarness.processElement" in
synchronized block, like this:

  @Test
 public void foo() throws Exception {
    synchronized (this.testHarness.getCheckpointLock()) {
      testHarness.processElement(MyMessage.builder().build(), 1L);
    }
  }

That worked.

I think that this could be added to official documentation in [1].


[1]
https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/testing.html



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/