/razpub/test_src/com/razie/pub/draw/test/TestStreams.java

http://razpub.googlecode.com/ · Java · 32 lines · 21 code · 7 blank · 4 comment · 0 complexity · c36342d9f69b3280eea0e08570f39d1e MD5 · raw file

  1. /**
  2. * Razvan's public code.
  3. * Copyright 2008 based on Apache license (share alike) see LICENSE.txt for details.
  4. */
  5. package com.razie.pub.draw.test;
  6. import java.io.ByteArrayOutputStream;
  7. import java.io.IOException;
  8. import junit.framework.TestCase;
  9. import razie.draw.HttpDrawStream;
  10. import razie.draw.JsonDrawStream;
  11. import com.razie.pub.base.log.Log;
  12. public class TestStreams extends TestCase {
  13. public void setUp() {
  14. }
  15. public void testAllStreams() throws IOException {
  16. ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  17. HttpDrawStream http = new HttpDrawStream (bytes);
  18. http.write("11");
  19. assertTrue (bytes.toString().contains("HTTP"));
  20. JsonDrawStream json = new JsonDrawStream (bytes);
  21. json.write("11");
  22. assertTrue (bytes.toString().contains("/json"));
  23. }
  24. static final Log logger = Log.factory.create(TestStreams.class.getName());
  25. }