Example usage for org.springframework.core.serializer.support SerializingConverter convert

List of usage examples for org.springframework.core.serializer.support SerializingConverter convert

Introduction

In this page you can find the example usage for org.springframework.core.serializer.support SerializingConverter convert.

Prototype

@Override
public byte[] convert(Object source) 

Source Link

Document

Serializes the source object and returns the byte array result.

Usage

From source file:io.pivotal.cla.service.github.MylynGitHubApiITests.java

@Test
@EnqueueRequests({ "getContributingUrls302", "getContributingUrls200", "getContributingUrls404",
        "getContributingUrls404", "getContributingUrls302", "getContributingUrls200",
        "getContributingUrls404" })
public void getContributingUrls() {
    // make sure we use GitHubHost and not the GitHubApiHost
    oauthConfig.setGitHubApiHost("donotuse");
    oauthConfig.setGitHubHost(server.getServer().getHostName());

    service = new MylynGitHubApi(oauthConfig);

    List<String> repositoryIds = Arrays.asList("spring-projects/has-md", "spring-projects/has-adoc",
            "spring-projects/no-contributor");

    ContributingUrlsResponse urls = service.getContributingUrls(repositoryIds);

    assertThat(urls.getAsciidoc()).containsExactly(
            server.getServerUrl() + "/spring-projects/has-adoc/edit/master/CONTRIBUTING.adoc",
            server.getServerUrl() + "/spring-projects/no-contributor/new/master?filename=CONTRIBUTING.adoc");
    assertThat(urls.getMarkdown())/*w w w. jav  a  2s. co  m*/
            .containsOnly(server.getServerUrl() + "/spring-projects/has-md/edit/master/CONTRIBUTING.md");

    SerializingConverter converter = new SerializingConverter();
    // ensure we can serialize the result as it is placed in FlashMap
    assertThat(converter.convert(urls.getMarkdown())).isNotNull();
    assertThat(converter.convert(urls.getAsciidoc())).isNotNull();
}