package org.opengroupware.jope.appserver.tests;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.opengroupware.jope.appserver.WORequest;
import org.opengroupware.jope.appserver.WOResponse;
import static org.junit.Assert.*;

public class WOResponseTest {

  protected WORequest  request  = null;
  protected WOResponse response = null;
  
  @Before
  public void setUp() {
    this.request = new WORequest("GET", "/", "HTTP/1.1", 
                                 null /* headers  */,
                                 null /* content  */,
                                 null /* userinfo */);
    
    this.response = new WOResponse(this.request);
  }

  @After
  public void tearDown() {
    this.response = null;
    this.request = null;
  }

  @Test
  public void testSimpleAppend() {
    this.response.appendContentString("Hello World!");
    assertEquals(this.response.contentString(), "Hello World!");
  }

  @Test
  public void testSimpleEscapedAppend() {
    this.response.appendContentHTMLString("hello <b>world</b>");
    assertEquals("hello &lt;b&gt;world&lt;/b&gt;",
                 this.response.contentString());
  }
}
