UpdaterTest.java 937 Bytes
package pl.labno.bernard.nbp.exchangerate;

import org.junit.Assert;
import org.junit.Test;
import pl.labno.bernard.nbp.exchangerate.rest.generated.ExchangeRate;
import pl.labno.bernard.nbp.exchangerate.rest.generated.ExchangeRateTable;
import yarfraw.core.datamodel.YarfrawException;

import javax.xml.bind.JAXBException;
import java.io.IOException;

public class UpdaterTest {

    @Test
    public void testGetRecentExchangeTable() throws YarfrawException, IOException, JAXBException {
        final ExchangeRateTable recentExchangeTable = new Updater().getRecentExchangeTable();
        Assert.assertNotNull(recentExchangeTable);
        for (ExchangeRate exchangeRate : recentExchangeTable.getItems()) {
            Assert.assertNotNull(exchangeRate.getCurrencyName());
            Assert.assertNotNull(exchangeRate.getCurrencySymbol());
            Assert.assertTrue(exchangeRate.getValue().doubleValue() != 0d);
        }
    }
}