Exemplo n.º 1
0
  @Test
  public void testconvertGithubRequestToJsonWithAValidRequest() {
    String expect =
        "{\"ref\":\"refs/heads/master\",\"repository\":{\"forks\":1,\"created_at\":\"2010/12/30 20:28:05 -0800\",\"has_wiki\":true,\"url\":\"https://github.com/bennyn/JiraButler\",\"open_issues\":0,\"description\":\"Test\",\"fork\":false,\"pushed_at\":\"2011/01/03 20:43:07 -0800\",\"has_issues\":true,\"private\":false,\"has_downloads\":true,\"owner\":{\"email\":\"[email protected]\",\"name\":\"bennyn\"},\"watchers\":4,\"name\":\"JiraButler\",\"homepage\":\"\"},\"commits\":[{\"author\":{\"email\":\"[email protected]\",\"username\":\"bennyn\",\"name\":\"Benny Neugebauer\"},\"timestamp\":\"2011-01-03T20:42:35-08:00\",\"removed\":[\"build/jar/html/favicon.ico\",\"build2.xml\"],\"url\":\"https://github.com/bennyn/JiraButler/commit/b2f42f15cf91de9fa6702f70a3412c15438e91f3\",\"message\":\"SWQ-11@Cobertura inside!\",\"added\":[],\"modified\":[\"build.properties\",\"build.xml\",\"cobertura.ser\",\"test/de/angelcode/jirabutler/hook/JiraServiceHookTest.java\"],\"id\":\"b2f42f15cf91de9fa6702f70a3412c15438e91f3\"}],\"forced\":false,\"before\":\"3e55fd24b662a02498be1f6a0c334f712012290d\",\"pusher\":{\"email\":\"[email protected]\",\"name\":\"bennyn\"},\"after\":\"b2f42f15cf91de9fa6702f70a3412c15438e91f3\",\"compare\":\"https://github.com/bennyn/JiraButler/compare/3e55fd2...b2f42f1\"}";

    this.githubRequest = RequestValues.getRequest8();
    this.hook = new JiraServiceHook(this.githubRequest);
    this.hook.convertGithubRequestToJson();

    String result = this.hook.getPayloadUnicode();

    assertEquals("Returns a valid JSON string", expect, result);
  }