Need help with RxBasicsKata?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

sergiiz
449 Stars 88 Forks MIT License 23 Commits 3 Opened issues

Description

Practical challenges for RxJava learners

Services available

!
?

Need anything else?

Contributors list

# 111,030
rxjava
unittes...
Kotlin
JavaScr...
17 commits
# 105,498
TypeScr...
unittes...
Node.js
swagger
2 commits
# 319,366
Java
unittes...
Neo4j
1 commit
# 355,802
Java
rxjava
unittes...
1 commit
# 360,623
Java
rxjava
unittes...
Shell
1 commit

Practical challenges for RxJava learners

A set of simple code challenges to learn RxJava using JUnit tests as an acceptance criteria. Focused on some basic concepts and doesn't cover any Android topics yet.

"Solved" branch

Current implementation

Dependencies:

  • RxJava 2.1.7 
  • JUnit 4.12

Reactive types covered:

  • Observable: the heart of Rx, a class that emits a stream of data or events
  • Single : a version of an Observable that emits a single item or fails
  • Maybe: lazy emission pattern, can emit 1 or 0 items or an error signal

Operators covered:

  • map: transforms the items by applying a function to each item
  • flatMap: takes the emissions of one Observable and returns merged emissions in another Observable to take its place
  • filter: emits only those items from that pass a criteria (predicate test)
  • skip/take: suppress or takes the first n items 
  • all: determines whether all items meet some criteria
  • reduce: applies a function to each item sequentially, and emit the final value. For example, it can be used to sum up all emitted items
  • toMap: converts an Observable into another object or data structure
  • merge: combine multiple Observables into one by merging their emissions
  • sequenceEqual: determine whether two Observables emit the same sequence of items
  • test: returns TestObserver with current Observable subscribed
  • timeout: to handle timeouts, e.g. deliver some fallback data

Testing approach:

  • The set of test cases are defined in a separate java file
  • As a “receiver” of emitted test events we use TestObserver. It records events and allows to make assertions about them
  • All tests are failing when you just took them from the repo. This is expected behaviour. You should make tests pass by implementing the logic in CountriesServiceSolved class

Blog post

See my blog post at Medium for more details: https://proandroiddev.com/practical-challenges-for-rxjava-learners-1821c454de9.

Contribution

Pull requests and new code challenges are really welcome.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.