Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add the missing EmptySource case to TraversalBuilder #1743

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.apache.pekko
import pekko.NotUsed
import pekko.stream._
import pekko.stream.impl.TraversalTestUtils._
import pekko.stream.scaladsl.Keep
import pekko.stream.scaladsl.{ Keep, Source }
import pekko.testkit.PekkoSpec

class TraversalBuilderSpec extends PekkoSpec {
Expand Down Expand Up @@ -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)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ import pekko.util.unused
def isEmptySource(graph: Graph[SourceShape[_], _]): Boolean = graph match {
case source: scaladsl.Source[_, _] if source eq scaladsl.Source.empty => true
case source: javadsl.Source[_, _] if source eq javadsl.Source.empty() => true
case EmptySource => true
case _ => false
}

Expand Down
Loading