Пример #1
0
  @Test
  public void canReturnProperToString() throws Exception {
    final Multimap<String, ComponentFile> assets = ArrayListMultimap.create();
    assets.put(
        ComponentFile.CSS, new ComponentFile("http://www.api.no/foo.css", ComponentFile.CSS));

    ComponentManifest asset =
        new ComponentManifest(
            assets,
            ArrayListMultimap.create(),
            new ComponentInformation(
                "test/foo", "description", new Markup("http://www.foo.no", placeHolders)));
    assertThat(
        asset.toString(),
        is(equalTo("componentFiles={}, resources={text/css=[http://www.api.no/foo.css]}")));
  }
Пример #2
0
  @Test
  public void serializesToJSON() throws Exception {

    final Multimap<String, ComponentFile> assets = ArrayListMultimap.create();
    assets.put(ComponentFile.CSS, new ComponentFile("http://foo.bar/", ComponentFile.CSS));
    assets.put(ComponentFile.JS, new ComponentFile("http://bar.foo/", ComponentFile.JS));

    final ComponentManifest manifest =
        new ComponentManifest(
            assets,
            ArrayListMultimap.create(),
            new ComponentInformation(
                "test/foo", "description", new Markup("http://www.foo.no", placeHolders)));
    assertThat(
        "a component manifest can be serialized to JSON",
        asJson(manifest),
        is(equalTo(asJson(fixture("fixtures/manifest.json")))));
  }