Created
July 5, 2017 06:23
-
-
Save deepakazad/ba4436b22d4b7a0f515d2dce294e094b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class RxJavaExceptionTesting { | |
public Observable<String> foo1() { | |
return Observable.empty(); | |
} | |
public Observable<String> foo2() { | |
return Observable.error(new MyException()); | |
} | |
public Observable<String> foo3() { | |
return Observable.error(new MyException("This is a custom exception.")); | |
} | |
} | |
class MyException extends Exception { | |
private String message; | |
public MyException() { | |
super(); | |
this.message =""; | |
} | |
public MyException(String message) { | |
super(message); | |
this.message = message; | |
} | |
@Override | |
public boolean equals(final Object obj) { | |
return obj != null | |
&& obj instanceof MyException | |
&& Objects.equals(message, ((MyException) obj).message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment