chore: Add the missing EmptySource case to TraversalBuilder (#1743)
This commit is contained in:
parent
864777ef62
commit
ba639f68a2
2 changed files with 18 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ import org.apache.pekko
|
||||||
import pekko.NotUsed
|
import pekko.NotUsed
|
||||||
import pekko.stream._
|
import pekko.stream._
|
||||||
import pekko.stream.impl.TraversalTestUtils._
|
import pekko.stream.impl.TraversalTestUtils._
|
||||||
import pekko.stream.scaladsl.Keep
|
import pekko.stream.scaladsl.{ Keep, Source }
|
||||||
import pekko.testkit.PekkoSpec
|
import pekko.testkit.PekkoSpec
|
||||||
|
|
||||||
class TraversalBuilderSpec extends PekkoSpec {
|
class TraversalBuilderSpec extends PekkoSpec {
|
||||||
|
|
@ -447,4 +447,20 @@ class TraversalBuilderSpec extends PekkoSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"find Source.empty via TraversalBuilder with isEmptySource" in {
|
||||||
|
val emptySource = EmptySource
|
||||||
|
TraversalBuilder.isEmptySource(emptySource) should be(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
"find javadsl Source.empty via TraversalBuilder with isEmptySource" in {
|
||||||
|
import pekko.stream.javadsl.Source
|
||||||
|
val emptySource = Source.empty()
|
||||||
|
TraversalBuilder.isEmptySource(emptySource) should be(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
"find scaldsl Source.empty via TraversalBuilder with isEmptySource" in {
|
||||||
|
val emptySource = Source.empty
|
||||||
|
TraversalBuilder.isEmptySource(emptySource) should be(true)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,7 @@ import pekko.util.unused
|
||||||
def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match {
|
def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match {
|
||||||
case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true
|
case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true
|
||||||
case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true
|
case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true
|
||||||
|
case EmptySource => true
|
||||||
case _ => false
|
case _ => false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue