Search in sources :

Example 1 with Item

use of br.com.caelum.restbucks.model.Item in project restfulie-java by caelum.

the class MappingConfigTest method shouldSerializeSimpleOrder.

@Test
public void shouldSerializeSimpleOrder() {
    String expected = "<?xml version='1.0' encoding='utf-8'?>" + "<order>" + "<location>takeAway</location>" + "<items></items>" + "<status>unpaid</status>" + "</order>";
    Resources resources = new MappingConfig().getServer();
    Order order = new Order("unpaid", new ArrayList<Item>(), Location.takeAway);
    StringWriter w = new StringWriter();
    resources.getSerializerFor(w, order).serialize();
    assertEquals(expected, w.getBuffer().toString());
}
Also used : Order(br.com.caelum.restbucks.model.Order) Item(br.com.caelum.restbucks.model.Item) StringWriter(java.io.StringWriter) Resources(br.com.caelum.restfulie.Resources) Test(org.junit.Test)

Aggregations

Item (br.com.caelum.restbucks.model.Item)1 Order (br.com.caelum.restbucks.model.Order)1 Resources (br.com.caelum.restfulie.Resources)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1