summaryrefslogtreecommitdiffstats
path: root/simple/simple-http/src/test/java/org/simpleframework/http/core/MockObserver.java
blob: cb4b41ed7807a94fea90b929640e49101798cf64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package org.simpleframework.http.core;

import java.io.IOException;

import org.simpleframework.transport.ByteWriter;


public class MockObserver implements BodyObserver {
   
   private boolean close;
   
   private boolean error;
   
   private boolean ready;
   
   private boolean commit;
   
   public MockObserver() {
      super();
   }
   
   public void close(ByteWriter sender) {
      close = true;
   }
   
   public boolean isClose() {
      return close;
   }
   
   public boolean isError() {
      return error;
   }
   
   public void ready(ByteWriter sender) {
      ready = true;
   }
   
   public boolean isReady() {
      return ready;
   }

   public void error(ByteWriter sender) {
      error = true;      
   }

   public boolean isClosed() {
      return close || error;
   }

   public long getTime() {
      return 0;
   }

   public void commit(ByteWriter sender) {
      this.commit = commit;
   }

   public boolean isCommitted() {
      return commit;
   }

}