// Path: src/main/java/de/otto/edison/hal/Curies.java
// public static Curies curies(final Links links) {
//     List<Link> curies = links.getLinksBy("curies");
//     return curies(curies);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Embedded.java
// public static Embedded embedded(final String rel,
//                                 final HalRepresentation embeddedItem) {
//     return new Embedded(singletonMap(rel, embeddedItem));
// }
// 
// Path: src/main/java/de/otto/edison/hal/Embedded.java
// public static Embedded emptyEmbedded() {
//     return new Embedded(null);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Link.java
// public static Link curi(final String name, final String relTemplate) {
//     if (!relTemplate.contains("{rel}")) {
//         throw new IllegalArgumentException("Not a CURI template. Template is required to contain a {rel} placeholder");
//     }
//     return new Link("curies", relTemplate, null, null, null, name, null, null);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Link.java
// public static Link link(final String rel, final String href) {
//     return new Link(rel, href);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Links.java
// public static Links emptyLinks() {
//     return new Links();
// }
// 
// Path: src/main/java/de/otto/edison/hal/Links.java
// public static Builder linkingTo() {
//     return new Builder();
// }


import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import static de.otto.edison.hal.Curies.curies;
import static de.otto.edison.hal.Embedded.embedded;
import static de.otto.edison.hal.Embedded.emptyEmbedded;
import static de.otto.edison.hal.Link.curi;
import static de.otto.edison.hal.Link.link;
import static de.otto.edison.hal.Links.emptyLinks;
import static de.otto.edison.hal.Links.linkingTo;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
        assertThat(json, is("{\"_links\":{\"curies\":[{\"href\":\"http://example.org/rels/{rel}\",\"templated\":true,\"name\":\"x\"}],\"x:foo\":{\"href\":\"http://example.org/test\"}}}"));
    }

    @Test
    public void shouldConstructWithCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(emptyLinks(), emptyEmbedded(), curies);
        assertThat(hal.getCuries().resolve("http://example.com/rels/foo"), is("x:foo"));
    }

    @Test
    public void shouldConstructWithLinksAndCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(
                linkingTo().single(link("http://example.com/rels/foo", "http://example.com")).build(),
                emptyEmbedded(),
                curies);
        assertThat(hal.getLinks().getRels(), contains("x:foo"));
        assertThat(hal.getLinks().getLinkBy("x:foo").isPresent(), is(true));
        assertThat(hal.getLinks().getLinkBy("http://example.com/rels/foo").isPresent(), is(true));
    }

    @Test
    public void shouldConstructWithEmbeddedAndCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(
                emptyLinks(),
                embedded(
                        "http://example.com/rels/nested",
                        singletonList(new HalRepresentation(
// Path: src/main/java/de/otto/edison/hal/Curies.java
// public static Curies curies(final Links links) {
//     List<Link> curies = links.getLinksBy("curies");
//     return curies(curies);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Embedded.java
// public static Embedded embedded(final String rel,
//                                 final HalRepresentation embeddedItem) {
//     return new Embedded(singletonMap(rel, embeddedItem));
// }
// 
// Path: src/main/java/de/otto/edison/hal/Embedded.java
// public static Embedded emptyEmbedded() {
//     return new Embedded(null);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Link.java
// public static Link curi(final String name, final String relTemplate) {
//     if (!relTemplate.contains("{rel}")) {
//         throw new IllegalArgumentException("Not a CURI template. Template is required to contain a {rel} placeholder");
//     }
//     return new Link("curies", relTemplate, null, null, null, name, null, null);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Link.java
// public static Link link(final String rel, final String href) {
//     return new Link(rel, href);
// }
// 
// Path: src/main/java/de/otto/edison/hal/Links.java
// public static Links emptyLinks() {
//     return new Links();
// }
// 
// Path: src/main/java/de/otto/edison/hal/Links.java
// public static Builder linkingTo() {
//     return new Builder();
// }


// Path: src/test/java/de/otto/edison/hal/HalRepresentationCuriesTest.java
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import static de.otto.edison.hal.Curies.curies;
import static de.otto.edison.hal.Embedded.embedded;
import static de.otto.edison.hal.Embedded.emptyEmbedded;
import static de.otto.edison.hal.Link.curi;
import static de.otto.edison.hal.Link.link;
import static de.otto.edison.hal.Links.emptyLinks;
import static de.otto.edison.hal.Links.linkingTo;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;

        assertThat(json, is("{\"_links\":{\"curies\":[{\"href\":\"http://example.org/rels/{rel}\",\"templated\":true,\"name\":\"x\"}],\"x:foo\":{\"href\":\"http://example.org/test\"}}}"));
    }

    @Test
    public void shouldConstructWithCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(emptyLinks(), emptyEmbedded(), curies);
        assertThat(hal.getCuries().resolve("http://example.com/rels/foo"), is("x:foo"));
    }

    @Test
    public void shouldConstructWithLinksAndCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(
                linkingTo().single(link("http://example.com/rels/foo", "http://example.com")).build(),
                emptyEmbedded(),
                curies);
        assertThat(hal.getLinks().getRels(), contains("x:foo"));
        assertThat(hal.getLinks().getLinkBy("x:foo").isPresent(), is(true));
        assertThat(hal.getLinks().getLinkBy("http://example.com/rels/foo").isPresent(), is(true));
    }

    @Test
    public void shouldConstructWithEmbeddedAndCuries() {
        final Curies curies = curies(asList(curi("x", "http://example.com/rels/{rel}")));
        final HalRepresentation hal = new HalRepresentation(
                emptyLinks(),
                embedded(
                        "http://example.com/rels/nested",
                        singletonList(new HalRepresentation(
                                linkingTo().single(link("http://example.com/rels/foo", "http://example.com")).build(),