@Test
  public void testGetGallery() throws Exception {
    SUSEStudioRequester<Gallery> requester =
        new SUSEStudioRequester<Gallery>() {
          public Gallery request(SUSEStudio suseStudio) throws SUSEStudioException {
            return suseStudio.getGallery("latest");
          }
        };
    TestExampleResponder responder = new TestExampleResponder("gallery.xml");
    Gallery result = new HttpServerMock().getResult(requester, responder);

    assertNotNull(result);
    GalleryAppliances galleryAppliances = result.getAppliances();
    assertNotNull(galleryAppliances);
    assertEquals(7999, galleryAppliances.getCount());
    assertEquals(800, galleryAppliances.getPages());
    assertEquals(1, galleryAppliances.getCurrentPage());
    List<GalleryAppliance> list = galleryAppliances.getAppliances();
    assertNotNull(list);
    assertEquals(10, list.size());
    GalleryAppliance galleryAppliance = list.get(0);
    assertEquals(217901, galleryAppliance.getId());
    assertEquals("ownCloud in a box", galleryAppliance.getName());
    assertEquals("Cornelius Schumacher", galleryAppliance.getPublisher());
    assertEquals("cschumacher", galleryAppliance.getUsername());
    assertEquals("http://owncloud.org", galleryAppliance.getHomepage());
    assertEquals("OwnCloud Description", galleryAppliance.getDescription());
    assertEquals(53, galleryAppliance.getRatings());
    assertEquals(4.13207547169811, galleryAppliance.getAverageRating(), 0.001);
    assertEquals(183, galleryAppliance.getComments());
    assertEquals("12.2", galleryAppliance.getBasedOn());
    Date date = TestUtils.getDate(2013, 0, 28, 14, 35, 58);
    assertEquals(date, galleryAppliance.getDate());
  }
  @Test
  public void testGetUser() throws Exception {
    SUSEStudioRequester<User> requester =
        new SUSEStudioRequester<User>() {
          public User request(SUSEStudio suseStudio) throws SUSEStudioException {
            return suseStudio.getUser();
          }
        };
    TestExampleResponder responder = new TestExampleResponder("account.xml");
    User result = new HttpServerMock().getResult(requester, responder);

    assertNotNull(result);
    assertEquals("uexample", result.getUsername());
    assertEquals("User Example", result.getDisplayName());
    assertEquals("*****@*****.**", result.getEmail());
    Date created = TestUtils.getDate(2009, 4, 14, 14, 51, 7);
    assertEquals(0, created.compareTo(result.getCreatedAt()));
    assertNotNull(result.getDiskQuota());
    DiskQuota diskQuota = result.getDiskQuota();
    assertEquals("15GB", diskQuota.getAvailable());
    assertEquals("4%", diskQuota.getUsed());
    List<String> openIdUrls = result.getOpenIdUrls();
    assertNotNull(openIdUrls);
    assertEquals(1, openIdUrls.size());
    String openIdUrl = openIdUrls.get(0);
    assertEquals("http://user.example.com/", openIdUrl);
  }
  @Test
  public void testGetAppliance() throws Exception {
    SUSEStudioRequester<Appliance> requester =
        new SUSEStudioRequester<Appliance>() {
          public Appliance request(SUSEStudio suseStudio) throws SUSEStudioException {
            return suseStudio.getAppliance(0);
          }
        };
    TestExampleResponder responder = new TestExampleResponder("appliance.xml");
    Appliance result = new HttpServerMock().getResult(requester, responder);

    assertNotNull(result);
    assertEquals(24, result.getId());
    assertEquals("Cornelius' JeOS", result.getName());
    assertNull(result.getArch());
    assertNull(result.getType());
    Date lastEdited = TestUtils.getDate(2009, 3, 24, 12, 9, 42);
    assertEquals(lastEdited, result.getLastEdited());
    assertEquals(result.getEstimatedRawSize(), "560 MB");
    assertEquals(result.getEstimatedCompressedSize(), "160 MB");
    assertEquals("http://susestudio.com/appliance/edit/24", result.getEditUrl());
    assertEquals("http://susestudio.com/api/v1/user/appliance_icon/1234", result.getIconUrl());
    assertEquals("11.1", result.getBasesystem());
    assertNull(result.getUuid());
    Parent parent = result.getParent();
    assertEquals(1, parent.getId());
    assertEquals("openSUSE 11.1, Just enough OS (JeOS)", parent.getName());
    List<Build> builds = result.getBuilds();
    assertNotNull(builds);
    assertEquals(1, builds.size());
    Build build = builds.get(0);
    assertEquals(28, build.getId());
    assertEquals("0.0.1", build.getVersion());
    assertEquals("oem", build.getImageType());
    assertEquals(238, build.getImageSize());
    assertEquals(87, build.getCompressedImageSize());
    assertEquals(
        "http://susestudio.com/download/bf1a0f08884ebac13f30b0fc62dfc44a/Cornelius_JeOS.x86_64-0.0.1.oem.tar.gz",
        build.getDownloadUrl());
  }