Package smartrics.rest.client

Examples of smartrics.rest.client.RestData.addHeader()


    }

  @Test
  public void shouldReturnCorrectTypeGivenApplicationXml() {
    RestData d = new RestResponse();
    d.addHeader("Content-Type", "application/xml");
    assertEquals(ContentType.XML, ContentType.parse(d.getContentType()));
  }
 
  @Test
  public void shouldReturnCorrectTypeGivenApplicationJson() {
View Full Code Here


  }
 
  @Test
  public void shouldReturnCorrectTypeGivenApplicationJson() {
    RestData d = new RestResponse();
    d.addHeader("Content-Type", "application/json");
    assertEquals(ContentType.JSON, ContentType.parse(d.getContentType()));
  }

  @Test
  public void shouldReturnCorrectTypeGivenApplicationText() {
View Full Code Here

  }

  @Test
  public void shouldReturnCorrectTypeGivenApplicationText() {
    RestData d = new RestResponse();
    d.addHeader("Content-Type", "text/plain");

    assertEquals(ContentType.TEXT, ContentType.parse(d.getContentType()));
  }

  @Test
View Full Code Here

  }

  @Test
  public void shouldReturnCorrectTypeAndCharsetGivenApplicationTextWithCharset() {
    RestData d = new RestResponse();
    d.addHeader("Content-Type", "text/plain; charset= iso-8859-1");
    assertEquals(ContentType.TEXT, ContentType.parse(d.getContentType()));
    assertEquals("iso-8859-1", d.getCharset());
  }

  @Test
View Full Code Here

  }

  @Test
    public void shouldReturnDefaultGivenAnythingElse() {
    RestData d = new RestResponse();
    d.addHeader("Content-Type", "bla/bla");
        assertEquals(ContentType.typeFor("default"), ContentType.parse(d.getContentType()));
  }

  @Test
    public void shouldReturnDefaultGivenEmptyHeaders() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.