コード例 #1
0
 @Test
 public void getResponse() throws ApiException {
   SkillQueueParser parser = new SkillQueueParser();
   SkillQueueResponse response = parser.getResponse(auth);
   assertNotNull(response);
   Set<SkillQueueItem> skillQueueItems = response.getAll();
   assertEquals(2, skillQueueItems.size());
   SkillQueueItem skillQueueItem = skillQueueItems.iterator().next();
   assertEquals(0, skillQueueItem.getQueuePosition());
   assertEquals(25739, skillQueueItem.getTypeID());
   assertEquals(5, skillQueueItem.getLevel());
   assertEquals(362039, skillQueueItem.getStartSP());
   assertEquals(2048000, skillQueueItem.getEndSP());
   assertDate(2010, 03, 28, 11, 00, 01, skillQueueItem.getStartTime());
   assertDate(2010, 04, 30, 4, 59, 46, skillQueueItem.getEndTime());
 }
コード例 #2
0
  @Test
  public void getResponse() throws ApiException, IOException {
    PrintStream defaultStdout = System.out;
    ByteArrayOutputStream temp = new ByteArrayOutputStream();
    PrintStream printStream = new PrintStream(temp);
    System.setOut(printStream);

    SkillQueueParser parser = new SkillQueueParser();
    SkillQueueResponse response = parser.getResponse(auth);
    assertNotNull(response);
    printStream.flush();
    printStream.close();
    temp.flush();
    temp.close();
    String result = temp.toString();
    System.setOut(defaultStdout);
    String[] lines = result.split("\n");
    assertTrue(
        lines[0].contains("INFO  [main] com.beimin.eveapi.connectors.LoggingConnector.execute:"));
    assertEquals("Request:", lines[1]);
    assertEquals("Path: /char", lines[2]);
    assertEquals("Page: SkillQueue", lines[3]);
    assertEquals("Version: 2", lines[4]);
    assertEquals("Auth: keyID: 123, characterID: 456", lines[5]);
    assertTrue(
        lines[7].contains(
            "INFO  [main] com.beimin.eveapi.connectors.LoggingConnector.getApiResponse:"));
    assertEquals("Response:", lines[8]);
    assertEquals("<?xml version='1.0' encoding='UTF-8'?>", lines[9]);
    assertEquals("<eveapi version=\"2\">", lines[10]);
    assertEquals("  <currentTime>2010-04-03 16:33:20</currentTime>", lines[11]);
    assertEquals("  <result>", lines[12]);
    assertEquals(
        "    <rowset name=\"skillqueue\" key=\"queuePosition\" columns=\"queuePosition,typeID,level,startSP,endSP,startTime,endTime\">",
        lines[13]);
    assertEquals(
        "      <row queuePosition=\"0\" typeID=\"25739\" level=\"5\" startSP=\"362039\" endSP=\"2048000\" startTime=\"2010-03-28 11:00:01\" endTime=\"2010-04-30 04:59:46\" />",
        lines[14]);
    assertEquals(
        "      <row queuePosition=\"1\" typeID=\"20533\" level=\"4\" startSP=\"112000\" endSP=\"633542\" startTime=\"2010-04-30 04:59:46\" endTime=\"2010-05-12 15:19:21\" />",
        lines[15]);
    assertEquals("    </rowset>", lines[16]);
    assertEquals("  </result>", lines[17]);
    assertEquals("  <cachedUntil>2010-04-03 16:48:20</cachedUntil>", lines[18]);
  }