1 7 package com.inversoft.junit.internal.http; 8 9 10 import javax.servlet.ServletOutputStream ; 11 12 13 20 public class MockServletOutputStream extends ServletOutputStream { 21 22 private StringBuffer buf; 23 24 27 public MockServletOutputStream() { 28 buf = new StringBuffer (); 29 } 30 31 public void print(String a) { 32 buf.append(a); 33 } 34 35 public void print(boolean a) { 36 buf.append(a); 37 } 38 39 public void print(float a) { 40 buf.append(a); 41 } 42 43 public void print(char a) { 44 buf.append(a); 45 } 46 47 public void print(int a) { 48 buf.append(a); 49 } 50 51 public void println(String a) { 52 buf.append(a + "\n"); 53 } 54 55 public void print(double a) { 56 buf.append(a + "\n"); 57 } 58 59 public void println() { 60 buf.append("\n"); 61 } 62 63 public void println(boolean a) { 64 buf.append(a + "\n"); 65 } 66 67 public void println(char a) { 68 buf.append(a + "\n"); 69 } 70 71 public void println(int a) { 72 buf.append(a + "\n"); 73 } 74 75 public void println(float a) { 76 buf.append(a + "\n"); 77 } 78 79 public void println(double a) { 80 buf.append(a + "\n"); 81 } 82 83 public void write(int a) { 84 buf.append(a + "\n"); 85 } 86 87 public void write(byte[] a) { 88 buf.append(new String (a)); 89 } 90 91 public void write(byte[] a, int b, int c) { 92 buf.append(new String (a, b, c)); 93 } 94 95 public void flush() { 96 } 98 99 public void close() { 100 } 102 103 public String getText() { 104 return buf.toString(); 105 } 106 } 107 | Popular Tags |