package net.faintedge.mangaedenclient;

import com.google.common.collect.Iterables;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class IntegrationTest {

  private static final Logger LOG = LoggerFactory.getLogger(IntegrationTest.class);

  @Test
  public void testGetMangaList() throws Exception {
    MangaEdenClient client = getClient();
    List<Manga> mangaList = client.getMangaList();
    Assert.assertFalse(mangaList.isEmpty());

    Iterable<Manga> limitedMangaList = Iterables.limit(mangaList, 10);
    for (Manga manga : limitedMangaList) {
      LOG.info(manga.toString());
    }
  }

  @Test
  public void testGetMangaInfo() throws Exception {
    MangaEdenClient client = getClient();
    String mangaId = "4e70e91ac092255ef70016d6";
    MangaDetails mangaDetails = client.getMangaDetails(mangaId);
    Assert.assertNotNull(mangaDetails);
    Assert.assertNotNull(mangaDetails.getChapters());

    LOG.info(mangaDetails.toString());
    Chapter[] chapters = mangaDetails.getChapters();
    for (int i = 0; i < Math.min(chapters.length, 10); i++) {
      LOG.info(chapters[i].toString());
    }
  }

  @Test
  public void testGetChapterPage() throws Exception {
    MangaEdenClient client = getClient();
    ChapterDetails chapterDetails = client.getChapterDetails("4e711f96c09225616d03b3ba");
    Assert.assertNotNull(chapterDetails);
    Assert.assertNotNull(chapterDetails.getPages());

    ChapterPage[] pages = chapterDetails.getPages();
    for (int i = 0; i < Math.min(pages.length, 10); i++) {
      LOG.info(pages[i].toString());
    }
  }

  private MangaEdenClient getClient() {
    return new MangaEdenClient();
  }
}

@@ -369,20 +369,11 @@
 test
-GetMangaList
+All
 () t
@@ -416,36 +416,92 @@
 nt client = 
-getClien
+new MangaEdenClient();%0D%0A%0D%0A    // test MangaEdenClient.getMangaLis
 t()
-;
 %0D%0A    List%3CM
@@ -752,118 +752,55 @@
  %7D%0D%0A
-  %7D%0D%0A%0D%0A  @Test%0D%0A  public void testGetMangaInfo() throws Exception %7B%0D%0A    MangaEdenClient client = getClient
+%0D%0A    // test MangaEdenClient.getMangaDetails
 ()
-;
 %0D%0A  
@@ -822,34 +822,32 @@
 d = 
-%224e70e91ac092255ef70016d6%22
+mangaList.get(0).getId()
 ;%0D%0A 
@@ -1218,120 +1218,52 @@
  %7D%0D%0A
-  %7D%0D%0A%0D%0A  @Test%0D%0A  public void testGetChapterPage() throws Exception %7B%0D%0A    MangaEdenClient client = getClien
+%0D%0A    // test MangaEdenClient.getMangaLis
 t()
-;
 %0D%0A  
@@ -1325,34 +1325,45 @@
 ils(
-%224e711f96c09225616d03b3ba%22
+mangaDetails.getChapters()%5B0%5D.getId()
 );%0D%0A
@@ -1628,91 +1628,8 @@
   %7D%0D
-%0A%0D%0A  private MangaEdenClient getClient() %7B%0D%0A    return new MangaEdenClient();%0D%0A  %7D%0D
 %0A%7D%0D%0A

Improve IntegrationTest