Instantly share code, notes, and snippets.

View RxJavaExceptionTestingTest.java
public class RxJavaExceptionTestingTest {
private RxJavaExceptionTesting exceptionTesting;
@Before
public void initialize(){
exceptionTesting = new RxJavaExceptionTesting();
}
@Test
View RxJavaExceptionTesting.java
public final class RxJavaExceptionTesting {
public Observable<String> foo1() {
return Observable.empty();
}
public Observable<String> foo2() {
return Observable.error(new MyException());
}
View EmptyFlowableToSingle.java
@Test
public void testEmptyFlowableToSingle() {
Flowable.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertValueCount(0)
.assertNoErrors();
//There should have been an error
}
View EmptyObservableToSingle.java
@Test
public void testEmptyObservableToSingle() {
Observable.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertValueCount(0)
.assertNoErrors();
//Should there be an error?
}
View EmptyMaybeToSingle1.java
@Test
public void testEmptyMaybeToSingle1() {
Maybe.empty()
.flatMapSingle(o -> Single.just("result"))
.test()
.assertError(NoSuchElementException.class);
}
View CompletableToSingle.java
@Test
public void testCompletableToSingle() {
Completable.complete()
.toSingle(() -> Single.just("result"))
.test()
.assertValueCount(1)
.assertNoErrors();
}
View index.html
<html>
<head>
<title>Example | Your Custom Page Title</title>
<meta property="og:title" content="Example | Your Custom Page Title" />
<meta property="og:site_name" content="Example" />
<meta property="og:type" content="blog" />
<meta property="og:url" content="https://example.com/path/index.html" />
<meta property="og:description" content="Your Custom Page Description" />
<meta property="og:image" content="https://example.com/nice-image.jpg" />
View Gruntfile.js
var modRewrite = require('connect-modrewrite'); //Make sure to declare this at top of the file
.
.
.
livereload: {
options: {
open: true,
middleware: function(connect) {
return [
View app.js
app.config(function($locationProvider) {
$locationProvider.html5Mode({
enabled: true
});
});