We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Don't tryna be a smart-ass but here is my git repo with all the solutions:
Java: https://github.com/austinwa...
Kotlin: https://github.com/austinwa...
For the last part ( Blocking to Reactive )
one can use almost exact snippets from
Does not work anymore?
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/notification/RunListener
at com.codingame.codemachine.runner.junit.JUnitTestListRunner.main(JUnitTestListRunner.java:5)
Caused by: java.lang.ClassNotFoundException: org.junit.runner.notification.RunListener
Same error here.. Not able to see any code
Thanks for putting this together. Would definitely be nice to have some hints or solutions since it's easy to get stuck for a little while on small stuff. But overall can appreciate the time taken to provide this.
Say to capitalize, but assert for upper case
typo "in fact it can be though -> thought of as both a Subscriber to the operator upstream and a Publisher for downstream"
What hapen when the we subscriber request limited amount of data from publisher . for ex- request 10
then again subscriber requested 20 data form publisher..what will happen .
and mind it subscriber subscribe to publisher withe the limited request not with the Long.Max_Value .as per doc in the scenario
.
I guess all tests pass if you forget to use verify :( at least the expect3600Elements did, thanks to my intuition to make the test fail first. :D
this is really awesome, thank you!
Is anything supposed to happen when you click on the Run button ? (besides "Waiting" for a few seconds , and then the button reurning to its initial state)
It's possible there has been a temporary issue with the playgrounds. It seems to be working now.
Why I cannnot see any sample code..
any idea wy i am unable to import the org.junit packages
can seem to run the test cases
I have the same problem :-( Does anybody know?
I get an NPE clicking the "run this" button...
After Click Run button, where to see the results of each test case?
void expectFooBarError(Flux<string> flux) { StepVerifier.create(flux).expectNext("foo").expectNext("bar").verifyError(RuntimeException.class);
}
void expectFooBarComplete(Flux<string> flux) {
StepVerifier.create(flux.just("foo","bar")).expectNext("foo").expectNext("bar").expectComplete().verify();
}
I love the Breaking Bad theme :D
The field in User class is username
so getUsername
is correct.
Looking at the last problem on part 4 my expectation is that the supplier argument should be used. This is either not the case or I just don't know how to use it properly.
Maybe add some more information on what the expectation is in regards to the source of the data.
When you complete all of them are you going to receive a badge or achievement?
Is it a good idea to have pubisher and subscriber in the same app / Microservice and use Reactive-RabbitMq as reactive stream?
What is the answer for the last one. ? Unable to find. expect3600Elements
Flux<long> counter() {
Duration period = Duration.of(100L, ChronoUnit.MILLIS);
return Flux.interval(period).take(10L);
}
void expect3600Elements(Supplier<flux<long>> supplier) {
StepVerifier.withVirtualTime(supplier)
.expectSubscription()
.expectNoEvent(Duration.ofSeconds(1))
.thenAwait(Duration.ofHours(1))
.expectNextCount(3600)
.expectComplete()
.verify();
}
void expect3600Elements(Supplier<flux<long>> supplier) {
final Duration duration = StepVerifier
.withVirtualTime(() -> Mono.delay(Duration.ofHours(1)))
.expectSubscription()
.expectNoEvent(Duration.ofSeconds(1))
.thenAwait(Duration.ofHours(1))
.expectNextCount(1)
.expectComplete()
.verify();
System.out.println(duration.toMillis());
}
This works to me, but I don't know why. I think it should by `.expectNextCount(3600)` or something like that.
Flux<long> counter() {
return Flux.interval(Duration.ofMillis(100)).take(10);
}
Flux<long> counter() {
return Flux.generate(() -> 0l, (state, sink) -> {
sink.next(state++);
if (state == 10l)
sink.complete();
return state;
});
}
It is nice that
one can add
import static org.assertj.core.api.Assertions.*;
or
import static org.junit.Assert.*;
to this snippet
and this will work just fine .
Hi Alexander, do you think you can send your pull requests on the GitHub project? https://github.com/reactor/...
Hi,
I don't know .
Sometimes incomplete or slightly incorrect information
pushes your to discover what is actually goes on .
So, in this particular case it was beneficial, for me .
And I'm inclined to leave this part of the tutorial as it is
( more challenging ) .
Also clever typo in withVirtualTime()
I spend almost half an hour, reading error messages,
until I figured that out .
And it was a surprise, for me,
that java.util.function.Supplier
is lambda itself .
Namely,
the method signature (void|:Unit|side effects) ->|=>|to Flux<T>
is equivalent to java.util.function.Supplier<Flux<T>>
Thanks for the effort.
And could you provide the link to answer? just stucked on some questions