Search in sources :

Example 11 with GovernmentBodyAnnualSummary

use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.

the class EsvApiTest method getDataFinanceMinistry1999SuccessTest.

/**
 * Gets the data finance ministry 1999 success test.
 *
 * @return the data finance ministry 1999 success test
 */
@Test
public void getDataFinanceMinistry1999SuccessTest() {
    final List<GovernmentBodyAnnualSummary> list = esvApi.getDataPerMinistryAndYear("Finansdepartementet", 1999);
    assertNotNull(list);
    assertEquals(36, list.size());
    for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
        assertNotNull(governmentBodyAnnualSummary);
    }
}
Also used : GovernmentBodyAnnualSummary(com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary) Test(org.junit.Test)

Example 12 with GovernmentBodyAnnualSummary

use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.

the class EsvApiTest method getDataFinanceMinistry2017SuccessTest.

@Test
public void getDataFinanceMinistry2017SuccessTest() {
    final List<GovernmentBodyAnnualSummary> list = esvApi.getDataPerMinistryAndYear("Finansdepartementet", 2017);
    assertNotNull(list);
    assertEquals(44, list.size());
    for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
        assertNotNull(governmentBodyAnnualSummary);
    }
}
Also used : GovernmentBodyAnnualSummary(com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary) Test(org.junit.Test)

Example 13 with GovernmentBodyAnnualSummary

use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.

the class EsvApiTest method getDataForeignMinistrySuccessTest.

/**
 * Gets the data foreign ministry success test.
 *
 * @return the data foreign ministry success test
 */
@Test
public void getDataForeignMinistrySuccessTest() {
    final Map<Integer, List<GovernmentBodyAnnualSummary>> governmentBodyAnnualSummaryData = esvApi.getDataPerMinistry("Utrikesdepartementet");
    assertNotNull(governmentBodyAnnualSummaryData);
    assertEquals(20, governmentBodyAnnualSummaryData.size());
    for (final List<GovernmentBodyAnnualSummary> list : governmentBodyAnnualSummaryData.values()) {
        for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
            assertNotNull(governmentBodyAnnualSummary);
        }
    }
}
Also used : List(java.util.List) GovernmentBodyAnnualSummary(com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary) Test(org.junit.Test)

Example 14 with GovernmentBodyAnnualSummary

use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.

the class EsvApiImpl method getMinistryNames.

@Override
public List<String> getMinistryNames() {
    final Set<String> ministryNameSet = new HashSet<>();
    final Map<Integer, List<GovernmentBodyAnnualSummary>> data = getData();
    for (final List<GovernmentBodyAnnualSummary> list : data.values()) {
        for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
            if (!ministryNameSet.contains(governmentBodyAnnualSummary.getMinistry()) && governmentBodyAnnualSummary.getHeadCount() > 0 && !NO_MINISTRY.equalsIgnoreCase(governmentBodyAnnualSummary.getMinistry())) {
                ministryNameSet.add(governmentBodyAnnualSummary.getMinistry());
            }
        }
    }
    return new ArrayList<>(ministryNameSet);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) GovernmentBodyAnnualSummary(com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary) HashSet(java.util.HashSet)

Aggregations

GovernmentBodyAnnualSummary (com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary)14 List (java.util.List)9 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 DCharts (org.dussan.vaadin.dcharts.DCharts)2 XYseries (org.dussan.vaadin.dcharts.base.elements.XYseries)2 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)2 Series (org.dussan.vaadin.dcharts.options.Series)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1 HSSFSheet (org.apache.poi.hssf.usermodel.HSSFSheet)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1