org.springframework.test.context.junit4.statements.SpringFailOnTimeout Java Examples
The following examples show how to use
org.springframework.test.context.junit4.statements.SpringFailOnTimeout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringFailOnTimeoutTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void userExceptionPropagates() throws Throwable { doThrow(new Boom()).when(statement).evaluate(); exception.expect(Boom.class); new SpringFailOnTimeout(statement, 1).evaluate(); }
Example #2
Source File: SpringFailOnTimeoutTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void timeoutExceptionThrownIfNoUserException() throws Throwable { doAnswer((Answer<Void>) invocation -> { TimeUnit.MILLISECONDS.sleep(50); return null; }).when(statement).evaluate(); exception.expect(TimeoutException.class); new SpringFailOnTimeout(statement, 1).evaluate(); }
Example #3
Source File: SpringFailOnTimeoutTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void noExceptionThrownIfNoUserExceptionAndTimeoutDoesNotOccur() throws Throwable { doAnswer((Answer<Void>) invocation -> { return null; }).when(statement).evaluate(); new SpringFailOnTimeout(statement, 100).evaluate(); }
Example #4
Source File: SpringFailOnTimeoutTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void nullNextStatement() throws Throwable { exception.expect(IllegalArgumentException.class); new SpringFailOnTimeout(null, 1); }
Example #5
Source File: SpringFailOnTimeoutTests.java From java-technology-stack with MIT License | 4 votes |
@Test public void negativeTimeout() throws Throwable { exception.expect(IllegalArgumentException.class); new SpringFailOnTimeout(statement, -1); }
Example #6
Source File: SpringMethodRule.java From spring-analysis-note with MIT License | 2 votes |
/** * Wrap the supplied {@link Statement} with a {@code SpringFailOnTimeout} statement. * <p>Supports Spring's {@link org.springframework.test.annotation.Timed @Timed} * annotation. * @see SpringFailOnTimeout */ private Statement withPotentialTimeout(Statement next, Method testMethod, Object testInstance) { return new SpringFailOnTimeout(next, testMethod); }
Example #7
Source File: SpringMethodRule.java From java-technology-stack with MIT License | 2 votes |
/** * Wrap the supplied {@link Statement} with a {@code SpringFailOnTimeout} statement. * <p>Supports Spring's {@link org.springframework.test.annotation.Timed @Timed} * annotation. * @see SpringFailOnTimeout */ private Statement withPotentialTimeout(Statement next, Method testMethod, Object testInstance) { return new SpringFailOnTimeout(next, testMethod); }
Example #8
Source File: SpringMethodRule.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Wrap the supplied {@link Statement} with a {@code SpringFailOnTimeout} statement. * <p>Supports Spring's {@link org.springframework.test.annotation.Timed @Timed} * annotation. * @see SpringFailOnTimeout */ private Statement withPotentialTimeout(Statement next, FrameworkMethod frameworkMethod, Object testInstance) { return new SpringFailOnTimeout(next, frameworkMethod.getMethod()); }