package jbootweb.test;

import static org.junit.Assert.*;

import org.junit.Ignore;
import org.junit.Test;

import jbootweb.flask.Route;

public class QueryTest extends AbstractAppTest {

  @Route("/hello/:name")
  public String hello(String name) {
    return "Hello " + name;
  }

  @Route("/hello2")
  public String helloQuery() {
    return "Hello " + app.getRequest().getArg("name", null);
  }

  @Test
  public void testTrimQS() throws Exception {
    assertEquals("Hello world", get("/hello/world?foo=bar"));
  }

  @Test
  public void testGetArg() throws Exception {
    assertEquals("Hello world", get("/hello2?name=world"));
  }

  @Test
  @Ignore
  public void testGetArgSlash() throws Exception {
    assertEquals("Hello world", get("/hello2/?name=world"));
  }

}

@@ -385,32 +385,175 @@
 e%22, null);%0A  %7D%0A%0A
+  @Route(%22/hello_bytearray%22)%0A  public byte%5B%5D helloByteArray() %7B%0A    return (%22Hello %22 + app.getRequest().getArg(%22name%22, null)).getBytes();%0A  %7D%0A%0A
   @Test%0A  public
@@ -911,10 +911,147 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void testReturnByteArray() throws Exception %7B%0A    assertEquals(%22Hello world%22, get(%22/hello_bytearray?name=world%22));%0A  %7D%0A%0A
 %7D%0A

test method returning byte[]