Package smartrics.rest.client

Examples of smartrics.rest.client.RestData


        ContentType.resetDefaultMapping();
    }

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


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

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

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

    assertEquals(ContentType.TEXT, ContentType.parse(d.getContentType()));
  }
View Full Code Here

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

  @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());
  }
View Full Code Here

    assertEquals("iso-8859-1", d.getCharset());
  }

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

        assertEquals(ContentType.typeFor("default"), ContentType.parse(d.getContentType()));
  }

  @Test
    public void shouldReturnDefaultGivenEmptyHeaders() {
    RestData d = new RestResponse();
        assertEquals(ContentType.typeFor("default"), ContentType.parse(d.getContentType()));
  }
View Full Code Here

TOP

Related Classes of smartrics.rest.client.RestData

Copyright © 2018 www.massapicom. 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.