Package net.jodah.concurrentunit
Class ConcurrentTestCase
java.lang.Object
net.jodah.concurrentunit.ConcurrentTestCase
Convenience support class, wrapping a
Copyright 2010-2016 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License
Waiter
.Copyright 2010-2016 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License
- Author:
- Jonathan Halterman
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
await()
protected void
await
(long delay) protected void
await
(long delay, int expectedResumes) protected void
protected void
protected void
resume()
void
void
threadAssertEquals
(Object expected, Object actual) void
threadAssertFalse
(boolean b) void
threadAssertNotNull
(Object object) void
void
threadAssertTrue
(boolean b) void
void
threadFail
(String reason) void
threadFail
(Throwable reason)
-
Constructor Details
-
ConcurrentTestCase
public ConcurrentTestCase()
-
-
Method Details
-
threadAssertEquals
- Parameters:
expected
- the expected valueactual
- the actual value- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadAssertFalse
public void threadAssertFalse(boolean b) - Parameters:
b
- boolean to test to be false- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadAssertNotNull
- Parameters:
object
- the object to test- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadAssertNull
- Parameters:
x
- the object to test- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadAssertTrue
public void threadAssertTrue(boolean b) - Parameters:
b
- boolean to test to be true- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadFail
public void threadFail()- See Also:
-
threadFail
- Parameters:
reason
- the reason for failure- Throws:
AssertionError
- when the assertion fails- See Also:
-
threadFail
- Parameters:
reason
- the reason for failure- Throws:
AssertionError
- wrapping thereason
- See Also:
-
rethrow
- Parameters:
reason
- the reason for failure throws Throwable thefailure
- See Also:
-
await
- Throws:
TimeoutException
- if the operation times out while waitingInterruptedException
- if the operations is interrupted while waitingAssertionError
- if any assertion fails while waiting- See Also:
-
await
- Parameters:
delay
- Delay to wait for- Throws:
TimeoutException
- if the operation times out while waitingInterruptedException
- if the operations is interrupted while waitingAssertionError
- if any assertion fails while waiting- See Also:
-
await
- Parameters:
delay
- Delay to wait forexpectedResumes
- Number of timesresume()
is expected to be called before the awaiting thread is resumed- Throws:
TimeoutException
- if the operation times out while waitingInterruptedException
- if the operations is interrupted while waitingAssertionError
- if any assertion fails while waiting- See Also:
-
await
- Parameters:
delay
- Delay to wait fortimeUnit
- TimeUnit to delay for- Throws:
TimeoutException
- if the operation times out while waitingInterruptedException
- if the operations is interrupted while waitingAssertionError
- if any assertion fails while waiting- See Also:
-
await
protected void await(long delay, TimeUnit timeUnit, int expectedResumes) throws TimeoutException, InterruptedException - Parameters:
delay
- Delay to wait fortimeUnit
- TimeUnit to delay forexpectedResumes
- Number of timesresume()
is expected to be called before the awaiting thread is resumed- Throws:
TimeoutException
- if the operation times out while waitingInterruptedException
- if the operations is interrupted while waitingAssertionError
- if any assertion fails while waiting- See Also:
-
resume
protected void resume()- See Also:
-