Skip to content

Commit 37bacbb

Browse files
committed
Get rid of stray thread 'Fiesta del Mar' when ConductorSuite is executed.
1 parent 2590b88 commit 37bacbb

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scalatest-test/src/test/scala/org/scalatest/concurrent/ConductorSuite.scala

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,19 @@ class ConductorSuite extends FunSuite with Matchers with Conductors with Severed
9898
"must have a unique name") {
9999

100100
val conductor = new Conductor
101-
conductor.threadNamed("Fiesta del Mar") { 1 should be (1) }
102-
val caught =
103-
intercept[NotAllowedException] {
104-
conductor.threadNamed("Fiesta del Mar") { 2 should be (2) }
101+
try {
102+
conductor.threadNamed("Fiesta del Mar") { 1 should be (1) }
103+
val caught =
104+
intercept[NotAllowedException] {
105+
conductor.threadNamed("Fiesta del Mar") { 2 should be (2) }
106+
}
107+
caught.getMessage should be ("Cannot register two threads with the same name. Duplicate name: Fiesta del Mar.")
108+
caught.failedCodeFileNameAndLineNumberString match {
109+
case Some(s) => s should equal ("ConductorSuite.scala:" + (thisLineNumber - 4))
110+
case None => fail("Didn't produce a file name and line number string: ", caught)
105111
}
106-
caught.getMessage should be ("Cannot register two threads with the same name. Duplicate name: Fiesta del Mar.")
107-
caught.failedCodeFileNameAndLineNumberString match {
108-
case Some(s) => s should equal ("ConductorSuite.scala:" + (thisLineNumber - 4))
109-
case None => fail("Didn't produce a file name and line number string: ", caught)
110112
}
113+
finally conductor.conduct
111114
}
112115

113116
test("waitForBeat throws NotAllowedException if is called with zero or a negative number") {

0 commit comments

Comments
 (0)