Package br.com.caelum.vraptor.restfulie.relation

Examples of br.com.caelum.vraptor.restfulie.relation.Relation


    assertThat(xml, not(containsString("atom:link")));
  }

  @Test
  public void shouldSerializeOneLinkIfThereIsATransition() {
    Relation kill = mock(Relation.class);
    when(kill.getName()).thenReturn("kill");
    when(kill.getUri()).thenReturn("/kill");

    when(builder.getRelations()).thenReturn(Arrays.asList(kill));
    String xml = xstream.toXML(resource);
    assertThat(xml, containsString("<atom:link rel=\"kill\" href=\"http://www.caelum.com.br/kill\" xmlns:atom=\"http://www.w3.org/2005/Atom\"/>"));
  }
View Full Code Here


    assertThat(xml, containsString("<atom:link rel=\"kill\" href=\"http://www.caelum.com.br/kill\" xmlns:atom=\"http://www.w3.org/2005/Atom\"/>"));
  }

  @Test
  public void shouldSerializeAllLinksIfThereAreTransitions() {
    Relation kill = mock(Relation.class);
    when(kill.getName()).thenReturn("kill");
    when(kill.getUri()).thenReturn("/kill");

    Relation ressurect = mock(Relation.class);
    when(ressurect.getName()).thenReturn("ressurect");
    when(ressurect.getUri()).thenReturn("/ressurect");

    when(builder.getRelations()).thenReturn(Arrays.asList(kill, ressurect));
    String xml = xstream.toXML(resource);
    assertThat(xml, containsString("<atom:link rel=\"kill\" href=\"http://www.caelum.com.br/kill\" xmlns:atom=\"http://www.w3.org/2005/Atom\"/>"));
    assertThat(xml, containsString("<atom:link rel=\"ressurect\" href=\"http://www.caelum.com.br/ressurect\" xmlns:atom=\"http://www.w3.org/2005/Atom\"/>"));
View Full Code Here

    assertThat(json, not(containsString("links")));
  }

  @Test
  public void shouldSerializeOneLinkIfThereIsATransition() {
    Relation kill = mock(Relation.class);
    when(kill.getName()).thenReturn("kill");
    when(kill.getUri()).thenReturn("/kill");

    when(builder.getRelations()).thenReturn(Arrays.asList(kill));
    String json = xstream.toXML(resource);
    String expectedLinks = "\"links\": [\n    {\n      \"rel\": \"kill\",\n      \"href\": \"http://www.caelum.com.br/kill\"\n    }\n  ]";
    assertThat(json, containsString(expectedLinks));
View Full Code Here

    assertThat(json, containsString(expectedLinks));
  }
 
  @Test
  public void shouldSerializeAllLinksIfThereAreTransitions() {
    Relation kill = mock(Relation.class);
    when(kill.getName()).thenReturn("kill");
    when(kill.getUri()).thenReturn("/kill");

    Relation ressurect = mock(Relation.class);
    when(ressurect.getName()).thenReturn("ressurect");
    when(ressurect.getUri()).thenReturn("/ressurect");

    when(builder.getRelations()).thenReturn(Arrays.asList(kill, ressurect));
    String json = xstream.toXML(resource);
    String expectedLinks = "\"links\": [\n    {\n      \"rel\": \"kill\",\n      \"href\": \"http://www.caelum.com.br/kill\"\n    },\n    {\n      \"rel\": \"ressurect\",\n      \"href\": \"http://www.caelum.com.br/ressurect\"\n    }\n  ]";
    assertThat(json, containsString(expectedLinks));
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.restfulie.relation.Relation

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.