Spr-17211 - async tests refactoring #1941
Conversation
@antkorwin Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@antkorwin Thank you for signing the Contributor License Agreement! |
Thanks for the PR. I've requested a few changes to reduce the noise in this PR. So let's see how it looks after you've made those changes. |
import org.springframework.context.ApplicationContext; | ||
import org.springframework.tests.sample.beans.TestBean; | ||
import org.springframework.util.asyncassert.AsyncAssert; | ||
|
||
import java.util.concurrent.TimeUnit; |
sbrannen
Aug 24, 2018
Member
Please undo all changes to import ordering and use of import wildcards in this PR.
See the following for details: https://github.com/spring-projects/spring-framework/wiki/Code-Style#import-statements
Please undo all changes to import ordering and use of import wildcards in this PR.
See the following for details: https://github.com/spring-projects/spring-framework/wiki/Code-Style#import-statements
@@ -78,40 +79,35 @@ public void asyncMethods() throws Exception { | |||
try { | |||
asyncTest.returnSomething(0).get(); | |||
fail("Should have thrown ExecutionException"); | |||
} | |||
catch (ExecutionException ex) { | |||
} catch (ExecutionException ex) { |
sbrannen
Aug 24, 2018
Member
Please undo all removal of newlines before catch
statements.
See the following for details: https://github.com/spring-projects/spring-framework/wiki/Code-Style#braces
Please undo all removal of newlines before catch
statements.
See the following for details: https://github.com/spring-projects/spring-framework/wiki/Code-Style#braces
* @param unit unit of time | ||
* @return AsyncAssert with new settings of polling. | ||
*/ | ||
public AsyncAssert polling(long amount, TimeUnit unit) { |
sbrannen
Aug 24, 2018
Member
Please use java.time.Duration
instead of implementing a custom type.
Please use java.time.Duration
instead of implementing a custom type.
* @param unit unit of time | ||
* @return AsyncAssert with new settings of timeout | ||
*/ | ||
public AsyncAssert timeout(long amount, TimeUnit unit) { |
sbrannen
Aug 24, 2018
Member
Please use java.time.Duration
instead of implementing a custom type.
Please use java.time.Duration
instead of implementing a custom type.
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* Created on 23.08.2018. |
sbrannen
Aug 24, 2018
Member
Please remove all such "Created on" JavaDoc entries in this PR.
Please remove all such "Created on" JavaDoc entries in this PR.
This has been merged into Thanks |
I fixed the problem with a fragile tests for asynchronous events.
Also I add the AsyncAssert utility for write an asynchronous test with a better performance than test which use a Thread.sleep(1000)
I've a next result for pass of changed tests on my computer:
before ~30 sec.
after ~12 sec.