Java API tests use Scala APIs in some cases
- Dominant language
- Scala
- Stars
- 196
- Forks
- 55
- Avg merge
- 4d 52m
- Merged PRs (30d)
- 74
Description
I am working on fixing some of this but some issues look like they need improvements in our APIs to facilitate npt needing Scala DSL or Scala lib classes in some places in Java samples.
Java DSL RouteTest that is inherited directly or indirectly by most Java tests uses Scala Durations for waits.
https://github.com/apache/pekko-http/blob/d5f56da907257296f0399cc3ce027c4be5d7671d/http-testkit/src/main/scala/org/apache/pekko/http/javadsl/testkit/RouteTest.scala#L48-L49
So far, Java users need to extend the ScalaDSL CustomHeader class or use RawHeader.
https://github.com/apache/pekko-http/blob/d5f56da907257296f0399cc3ce027c4be5d7671d/http-tests/src/test/java/org/apache/pekko/http/javadsl/server/JavaRouteTest.java#L32-L33
Scala Either used in JavaDSL authenticateOrRejectWithChallenge.
Java does provide an easy replacement and our sample code that demos this shows that the Scala Either, Left and Right classes are easy to use from Java.
example:
https://github.com/apache/pekko-http/blob/d5f56da907257296f0399cc3ce027c4be5d7671d/docs/src/test/java/docs/http/javadsl/server/directives/SecurityDirectivesExamplesTest.java#L320-L328
Contributor guide
Research direction
Start by reading http-testkit/src/main/scala/org/apache/pekko/http/javadsl/testkit/RouteTest.scala, http-tests/src/test/java/org/apache/pekko/http/javadsl/server/JavaRouteTest.java, and docs/src/test/java/docs/http/javadsl/server/directives/SecurityDirectivesExamplesTest.java. Compare the Java-facing usage of Scala Durations, CustomHeader or RawHeader, and Either, then identify which cases need API improvements. Done means the affected Java tests and samples no longer require Scala DSL or library classes where a suitable Java API is available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- api, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100