1 package com.mockobjects.servlet; 2 3 import com.mockobjects.util.AssertMo; 4 import com.mockobjects.Verifiable; 5 import com.mockobjects.ExpectationValue; 6 import com.mockobjects.ReturnValue; 7 8 import javax.servlet.jsp.JspWriter ; 9 import javax.servlet.jsp.tagext.BodyContent ; 10 import java.io.IOException ; 11 import java.io.Reader ; 12 import java.io.Writer ; 13 14 public class MockBodyContent extends BodyContent implements Verifiable{ 15 private final ReturnValue myEnclosingWriter = new ReturnValue("enclosing writer"); 16 private final ExpectationValue myWriter = new ExpectationValue("writer"); 17 18 public int getBufferSize() { 19 notImplemented(); 20 return super.getBufferSize(); 21 } 22 23 public MockBodyContent() { 24 super(null); 25 } 26 27 public void write(int c) throws IOException { 28 notImplemented(); 29 super.write(c); 30 } 31 32 public void flush() throws IOException { 33 notImplemented(); 34 super.flush(); 35 } 36 37 public boolean isAutoFlush() { 38 notImplemented(); 39 return super.isAutoFlush(); 40 } 41 42 public void write(char cbuf[]) throws IOException { 43 notImplemented(); 44 super.write(cbuf); 45 } 46 47 public boolean equals(Object obj) { 48 notImplemented(); 49 return super.equals(obj); 50 } 51 52 public void clearBody() { 53 notImplemented(); 54 super.clearBody(); 55 } 56 57 public void write(String str) throws IOException { 58 notImplemented(); 59 super.write(str); 60 } 61 62 public void setupGetEnclosingWriter(JspWriter aJspWriter){ 63 myEnclosingWriter.setValue(aJspWriter); 64 } 65 66 public JspWriter getEnclosingWriter() { 67 return (JspWriter )myEnclosingWriter.getValue(); 68 } 69 70 private void notImplemented() { 71 AssertMo.notImplemented(MockBodyContent.class.getName()); 72 } 73 74 public Reader getReader() { 75 notImplemented(); 76 return null; 77 } 78 79 public void newLine() throws IOException { 80 notImplemented(); 81 } 82 83 public void write(char cbuf[], int off, int len) throws IOException { 84 notImplemented(); 85 } 86 87 public void print(boolean b) throws IOException { 88 notImplemented(); 89 } 90 91 public void setExpectedWriteOut(Writer aWriter){ 92 myWriter.setExpected(aWriter); 93 } 94 95 public void writeOut(Writer aWriter) throws IOException { 96 myWriter.setActual(aWriter); 97 } 98 99 public void print(char c) throws IOException { 100 notImplemented(); 101 } 102 103 public void print(int i) throws IOException { 104 notImplemented(); 105 } 106 107 public void print(long l) throws IOException { 108 notImplemented(); 109 } 110 111 public void print(float v) throws IOException { 112 notImplemented(); 113 } 114 115 public void print(double v) throws IOException { 116 notImplemented(); 117 } 118 119 public void print(char[] chars) throws IOException { 120 notImplemented(); 121 } 122 123 public void print(String s) throws IOException { 124 notImplemented(); 125 } 126 127 public void print(Object o) throws IOException { 128 notImplemented(); 129 } 130 131 public void println() throws IOException { 132 notImplemented(); 133 } 134 135 public void println(boolean b) throws IOException { 136 notImplemented(); 137 } 138 139 public void println(char c) throws IOException { 140 notImplemented(); 141 } 142 143 public void println(int i) throws IOException { 144 notImplemented(); 145 } 146 147 public void println(long l) throws IOException { 148 notImplemented(); 149 } 150 151 public void println(float v) throws IOException { 152 notImplemented(); 153 } 154 155 public void println(double v) throws IOException { 156 notImplemented(); 157 } 158 159 public void println(char[] chars) throws IOException { 160 notImplemented(); 161 } 162 163 public void println(String s) throws IOException { 164 notImplemented(); 165 } 166 167 public void println(Object o) throws IOException { 168 notImplemented(); 169 } 170 171 public void clear() throws IOException { 172 notImplemented(); 173 } 174 175 public void clearBuffer() throws IOException { 176 notImplemented(); 177 } 178 179 public void close() throws IOException { 180 notImplemented(); 181 } 182 183 public int getRemaining() { 184 notImplemented(); 185 return 0; 186 } 187 188 public void write(String str, int off, int len) throws IOException { 189 notImplemented(); 190 super.write(str, off, len); 191 } 192 193 public String getString() { 194 notImplemented(); 195 return null; 196 } 197 198 public void verify() { 199 } 200 } 201 | Popular Tags |