Skip to content

Commit 2d7b966

Browse files
committed
Adding missing javadocs to TestSubject (#1322)
1 parent bf29c61 commit 2d7b966

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

rxjava-core/src/main/java/rx/subjects/TestSubject.java

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,20 @@
2626
import rx.subjects.SubjectSubscriptionManager.SubjectObserver;
2727

2828
/**
29-
* Subject that, once an {@link Observer} has subscribed, publishes all subsequent events to the subscriber.
30-
* <p>
31-
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/S.PublishSubject.png">
32-
* <p>
33-
* Example usage:
34-
* <p>
35-
* <pre> {@code
36-
37-
PublishSubject<Object> subject = PublishSubject.create();
38-
// observer1 will receive all onNext and onCompleted events
39-
subject.subscribe(observer1);
40-
subject.onNext("one");
41-
subject.onNext("two");
42-
// observer2 will only receive "three" and onCompleted
43-
subject.subscribe(observer2);
44-
subject.onNext("three");
45-
subject.onCompleted();
46-
47-
} </pre>
48-
*
29+
* A variety of Subject that is useful for testing purposes. It operates on a {@link TestScheduler} and allows
30+
* you to precisely time emissions and notifications to the Subject's subscribers.
31+
*
4932
* @param <T>
5033
* the type of item observed by and emitted by the subject
51-
* @warn javadoc seems misleading
5234
*/
5335
public final class TestSubject<T> extends Subject<T, T> {
5436

5537
/**
56-
* @warn javadoc missing
57-
* @return
38+
* Creates and returns a new {@code TestSubject}.
39+
*
40+
* @param <T> the value type
41+
* @param scheduler a {@link TestScheduler} on which to operate this Subject
42+
* @return the new {@code TestSubject}
5843
*/
5944
public static <T> TestSubject<T> create(TestScheduler scheduler) {
6045
final SubjectSubscriptionManager<T> state = new SubjectSubscriptionManager<T>();
@@ -95,8 +80,11 @@ private void _onCompleted() {
9580
}
9681

9782
/**
98-
* @warn javadoc missing
83+
* Schedule a call to the {@code onCompleted} methods of all of the subscribers to this Subject to begin at
84+
* a particular time.
85+
*
9986
* @param timeInMilliseconds
87+
* the time at which to begin calling the {@code onCompleted} methods of the subscribers
10088
*/
10189
public void onCompleted(long timeInMilliseconds) {
10290
innerScheduler.schedule(new Action0() {
@@ -123,9 +111,13 @@ private void _onError(final Throwable e) {
123111
}
124112

125113
/**
126-
* @warn javadoc missing
114+
* Schedule a call to the {@code onError} methods of all of the subscribers to this Subject to begin at
115+
* a particular time.
116+
*
127117
* @param e
118+
* the {@code Throwable} to pass to the {@code onError} methods of the subscribers
128119
* @param timeInMilliseconds
120+
* the time at which to begin calling the {@code onError} methods of the subscribers
129121
*/
130122
public void onError(final Throwable e, long timeInMilliseconds) {
131123
innerScheduler.schedule(new Action0() {
@@ -150,9 +142,13 @@ private void _onNext(T v) {
150142
}
151143

152144
/**
153-
* @warn javadoc missing
145+
* Emit an item to all of the subscribers to this Subject at a particular time.
146+
*
154147
* @param v
148+
* the item to emit
155149
* @param timeInMilliseconds
150+
* the time at which to begin calling the {@code onNext} methods of the subscribers in order to emit
151+
* the item
156152
*/
157153
public void onNext(final T v, long timeInMilliseconds) {
158154
innerScheduler.schedule(new Action0() {

0 commit comments

Comments
 (0)