Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nelson Tavares de Sousa
TeeTime-Framework
Commits
0cd7d63b
Commit
0cd7d63b
authored
9 years ago
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
fixes #221
parent
ed99b620
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/teetime/framework/Execution.java
+13
-5
13 additions, 5 deletions
src/main/java/teetime/framework/Execution.java
src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
+21
-2
21 additions, 2 deletions
...me/framework/exceptionHandling/ExceptionHandlingTest.java
with
34 additions
and
7 deletions
src/main/java/teetime/framework/Execution.java
+
13
−
5
View file @
0cd7d63b
...
...
@@ -15,7 +15,9 @@
*/
package
teetime.framework
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
...
...
@@ -106,13 +108,19 @@ public final class Execution<T extends Configuration> {
* @since 2.0
*/
public
void
waitForTermination
()
{
int
numExceptions
=
0
;
configurationContext
.
waitForConfigurationToTerminate
();
for
(
Entry
<
Thread
,
List
<
Exception
>>
entry
:
configuration
.
getFactory
().
getThreadExceptionsMap
().
entrySet
())
{
numExceptions
+=
entry
.
getValue
().
size
();
Map
<
Thread
,
List
<
Exception
>>
threadExceptionsMap
=
configuration
.
getFactory
().
getThreadExceptionsMap
();
Iterator
<
Entry
<
Thread
,
List
<
Exception
>>>
iterator
=
threadExceptionsMap
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Entry
<
Thread
,
List
<
Exception
>>
entry
=
iterator
.
next
();
if
(
entry
.
getValue
().
isEmpty
())
{
iterator
.
remove
();
}
}
if
(
numExceptions
!=
0
)
{
throw
new
ExecutionException
(
configuration
.
getFactory
().
getThreadExceptionsMap
());
if
(!
threadExceptionsMap
.
isEmpty
())
{
throw
new
ExecutionException
(
threadExceptionsMap
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/test/java/teetime/framework/exceptionHandling/ExceptionHandlingTest.java
+
21
−
2
View file @
0cd7d63b
...
...
@@ -15,6 +15,14 @@
*/
package
teetime.framework.exceptionHandling
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
teetime
.
testutil
.
AssertHelper
.
assertInstanceOf
;
import
java.util.List
;
import
java.util.Map.Entry
;
import
org.junit.Test
;
import
teetime.framework.Execution
;
...
...
@@ -22,9 +30,20 @@ import teetime.framework.ExecutionException;
public
class
ExceptionHandlingTest
{
@Test
(
expected
=
ExecutionException
.
class
)
@Test
public
void
testException
()
{
new
Execution
<
ExceptionPassingTestConfig
>(
new
ExceptionPassingTestConfig
()).
executeBlocking
();
Execution
<
ExceptionPassingTestConfig
>
execution
=
new
Execution
<
ExceptionPassingTestConfig
>(
new
ExceptionPassingTestConfig
());
try
{
execution
.
executeBlocking
();
}
catch
(
ExecutionException
e
)
{
Entry
<
Thread
,
List
<
Exception
>>
entry
=
e
.
getThrownExceptions
().
entrySet
().
iterator
().
next
();
List
<
Exception
>
exceptions
=
entry
.
getValue
();
IllegalStateException
exception
=
assertInstanceOf
(
IllegalStateException
.
class
,
exceptions
.
get
(
0
));
assertThat
(
exception
.
getMessage
(),
is
(
equalTo
(
"Correct exception"
)));
assertThat
(
exceptions
.
size
(),
is
(
1
));
assertThat
(
e
.
getThrownExceptions
().
size
(),
is
(
1
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment