package de.bmarwell.ffb.depot.tests;

import de.bmarwell.ffb.depot.client.FfbMobileClient;
import de.bmarwell.ffb.depot.client.err.FfbClientError;
import de.bmarwell.ffb.depot.client.json.FfbPerformanceResponse;

import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.threeten.bp.LocalDate;

import java.net.MalformedURLException;

public class TestGetPerformance {

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

  @Test
  public void testGetPerformance() throws FfbClientError, MalformedURLException {
    FfbMobileClient mobileAgent = new FfbMobileClient(TestMobileGetDepotwert.LOGIN, TestMobileGetDepotwert.PIN);
    mobileAgent.logon();
    Assert.assertTrue(mobileAgent.loginInformation().isPresent());

    LOG.debug("Performance: [{}].", mobileAgent.loginInformation().toString());

    FfbPerformanceResponse performance = mobileAgent.getPerformance();
    LOG.debug("Performance: [{}].", performance.toString());

    /* Die Felder mit Umwandlungen testen */
    Assert.assertEquals(true, performance.isLogin());
    Assert.assertEquals(LocalDate.of(2013, 12, 2), performance.getErsterZufluss());
    Assert.assertTrue(performance.getPerformanceDurchschnitt() != 0.00);
    Assert.assertTrue(performance.getPerformanceGesamt() != 0.00);
    Assert.assertTrue(performance.getErrormessage().equals(""));
  }

}

@@ -1412,10 +1412,399 @@
 );%0A  %7D%0A%0A
+  @Test(expected = IllegalStateException.class)%0A  public void testGetPerformance_noLogin() throws MalformedURLException, FfbClientError %7B%0A    FfbMobileClient mobileAgent = new FfbMobileClient(TestMobileGetDepotwert.LOGIN, TestMobileGetDepotwert.PIN);%0A%0A    FfbPerformanceResponse performance = mobileAgent.getPerformance();%0A    LOG.debug(%22Performance: %5B%7B%7D%5D.%22, performance.toString());%0A  %7D%0A%0A
 %7D%0A

Test not being logged in.