Skip to content

Commit 0f7f123

Browse files
ddworakclaude
andcommitted
Drop mockito-scala-scalatest test dependency
RestServletTest was the only consumer; its 13 scenarios are already covered end-to-end by JettyRestCallTest, SttpRestCallTest, and EndpointsIntegrationTest, which run the real RestServlet behind a real Jetty server. The one previously-unique scenario (mid-stream failure closing the servlet output stream) is ported to StreamingRestApiTestScenarios via the existing errorStream fixture, so JettyRestCallTest now verifies it against a real HTTP client. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d7e2672 commit 0f7f123

3 files changed

Lines changed: 19 additions & 354 deletions

File tree

project/Dependencies.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ object Dependencies {
3232
val fontAwesomeVersion = "5.10.1"
3333

3434
val scalatestVersion = "3.2.20"
35-
val mockitoScalaVersion = "2.1.0"
3635
val scalaJsSecureRandomVersion = "1.0.0" // Tests only
3736
val bootstrap4Version = "4.1.3"
3837
val bootstrap4DatepickerVersion = "5.39.0"
@@ -100,7 +99,6 @@ object Dependencies {
10099
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
101100
"org.eclipse.jetty" % "jetty-server" % jettyVersion % Test,
102101
"org.eclipse.jetty.ee8" % "jetty-ee8-servlet" % jettyVersion % Test,
103-
"org.mockito" %% "mockito-scala-scalatest" % mockitoScalaVersion % Test,
104102
))
105103

106104
val restSjsDeps = restCrossDeps

rest/.jvm/src/test/scala/io/udash/rest/RestServletTest.scala

Lines changed: 0 additions & 352 deletions
This file was deleted.

rest/src/test/scala/io/udash/rest/RestApiTest.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,23 @@ trait StreamingRestApiTestScenarios extends RestApiTest {
238238
fail("Expected UnsupportedOperationException but operation succeeded")
239239
}
240240
}
241+
242+
"mid-stream server error propagates to client" in {
243+
// Regression guard: the servlet must close the response output stream when the source Observable
244+
// fails after some items were already committed; otherwise the client would hang indefinitely.
245+
streamingProxy
246+
.errorStream(immediate = false)
247+
.toListL
248+
.timeout(5.seconds)
249+
.materialize
250+
.runToFuture
251+
.map {
252+
case Failure(_: TimeoutException) =>
253+
fail("Server did not terminate the response on mid-stream error (client hung waiting for data)")
254+
case Failure(_) =>
255+
succeed
256+
case Success(list) =>
257+
fail(s"Expected failure from mid-stream error, but stream completed successfully with: $list")
258+
}
259+
}
241260
}

0 commit comments

Comments
 (0)