/**
   * Main method used to run integration tests with real JIRA call.
   *
   * @param args not used
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {

    String username = null;
    String pwd = null;
    IJIRAClient tested =
        new JIRA5RestClient(
            mockEsIntegrationComponent(), "https://issues.jboss.org", username, pwd, 50000, null);

    // List<String> projects = tested.getAllJIRAProjects();
    // System.out.println(projects);

    ChangedIssuesResults ret =
        tested.getJIRAChangedIssues(
            "ORG", 0, DateTimeUtils.parseISODateTime("2014-09-01T01:00:00Z"), null);
    System.out.println("total: " + ret.getTotal());
    // System.out.println(ret);
  }
  @Test
  public void getJIRAChangedIssues() throws Exception {
    final Date ua = new Date();
    final Date ub = new Date();

    IJIRAClient tested =
        new JIRA5RestClient(mockEsIntegrationComponent(), TEST_JIRA_URL, null, null, 5000, null) {
          @Override
          protected byte[] performJIRAChangedIssuesREST(
              String projectKey, int startAt, Date updatedAfter, Date updatedBefore)
              throws Exception {
            Assert.assertEquals("ORG", projectKey);
            Assert.assertEquals(ua, updatedAfter);
            Assert.assertEquals(ub, updatedBefore);
            Assert.assertEquals(10, startAt);
            return "{\"startAt\": 5, \"maxResults\" : 10, \"total\" : 50, \"issues\" : [{\"key\" : \"ORG-45\"}]}"
                .getBytes("UTF-8");
          };
        };

    ChangedIssuesResults ret = tested.getJIRAChangedIssues("ORG", 10, ua, ub);
    Assert.assertEquals(5, ret.getStartAt());
    Assert.assertEquals(10, ret.getMaxResults());
    Assert.assertEquals(50, ret.getTotal());
    Assert.assertNotNull(ret.getIssues());
    Assert.assertEquals(1, ret.getIssuesCount());
  }