Skip to content

Commit 9c45195

Browse files
committed
Fix CompilationErrorsTest
1 parent 8c68173 commit 9c45195

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
1717
def meth(par: Any): Future[Unit]
1818
}
1919

20+
// TODO streaming add streaming tests
21+
2022
test("missing serializer for parameter") {
2123
val error = norm(typeErrorFor("object Api extends DefaultRestApiCompanion[MissingSerializerForParam]"))
2224
assert(error ==
@@ -41,7 +43,11 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
4143
| Cannot serialize Any into RestResponse, because:
4244
| Cannot serialize Any into HttpBody, because:
4345
| Cannot serialize Any into JsonValue, because:
44-
| No GenCodec found for Any""".stripMargin)
46+
| No GenCodec found for Any
47+
| * it cannot be translated into an HTTP stream method:
48+
| scala.concurrent.Future[Any] is not a valid result type because:
49+
| Cannot serialize Any into StreamedRestResponse, because:
50+
| Cannot serialize Any into io.udash.rest.raw.StreamedBody, appropriate AsRaw instance not found""".stripMargin)
4551
}
4652

4753
trait BadResultType {
@@ -56,6 +62,8 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
5662
| * it cannot be translated into a prefix method:
5763
| Unit is not a valid server REST API trait, does its companion extend DefaultRestApiCompanion, DefaultRestServerApiCompanion or other companion base?
5864
| * it cannot be translated into an HTTP method:
65+
| Unit is not a valid result type of HTTP REST method - it must be a Future
66+
| * it cannot be translated into an HTTP stream method:
5967
| Unit is not a valid result type of HTTP REST method - it must be a Future""".stripMargin)
6068
}
6169

@@ -71,6 +79,8 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
7179
| * it cannot be translated into a prefix method:
7280
| prefix methods cannot take @Body parameters
7381
| * it cannot be translated into an HTTP method:
82+
| CompilationErrorsTest.this.SubApi is not a valid result type of HTTP REST method - it must be a Future
83+
| * it cannot be translated into an HTTP stream method:
7484
| CompilationErrorsTest.this.SubApi is not a valid result type of HTTP REST method - it must be a Future""".stripMargin)
7585
}
7686

@@ -84,7 +94,11 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
8494
"""cannot translate between trait UnexpectedGETBodyParam and trait RawRest:
8595
|problem with method meth:
8696
| * it cannot be translated into an HTTP GET method:
87-
| GET methods cannot take @Body parameters""".stripMargin)
97+
| GET methods cannot take @Body parameters
98+
| * it cannot be translated into an HTTP GET stream method:
99+
| scala.concurrent.Future[Unit] is not a valid result type because:
100+
| Cannot serialize Unit into StreamedRestResponse, because:
101+
| Cannot serialize Unit into io.udash.rest.raw.StreamedBody, appropriate AsRaw instance not found""".stripMargin)
88102
}
89103

90104
trait MissingBodyParam {
@@ -97,7 +111,11 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
97111
"""cannot translate between trait MissingBodyParam and trait RawRest:
98112
|problem with method meth:
99113
| * it cannot be translated into an HTTP method with custom body:
100-
| expected exactly one @Body parameter but none was found""".stripMargin)
114+
| expected exactly one @Body parameter but none was found
115+
| * it cannot be translated into an HTTP stream method with custom body:
116+
| scala.concurrent.Future[Unit] is not a valid result type because:
117+
| Cannot serialize Unit into StreamedRestResponse, because:
118+
| Cannot serialize Unit into io.udash.rest.raw.StreamedBody, appropriate AsRaw instance not found""".stripMargin)
101119
}
102120

103121
trait MultipleBodyParams {
@@ -110,6 +128,10 @@ class CompilationErrorsTest extends AnyFunSuite with CompilationErrorAssertions
110128
"""cannot translate between trait MultipleBodyParams and trait RawRest:
111129
|problem with method meth:
112130
| * it cannot be translated into an HTTP method with custom body:
113-
| expected exactly one @Body parameter but more than one was found""".stripMargin)
131+
| expected exactly one @Body parameter but more than one was found
132+
| * it cannot be translated into an HTTP stream method with custom body:
133+
| scala.concurrent.Future[Unit] is not a valid result type because:
134+
| Cannot serialize Unit into StreamedRestResponse, because:
135+
| Cannot serialize Unit into io.udash.rest.raw.StreamedBody, appropriate AsRaw instance not found""".stripMargin)
114136
}
115137
}

0 commit comments

Comments
 (0)