1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package com.gisgraphy.domain.geoloc.importer;
24
25 import static org.junit.Assert.assertEquals;
26
27 import java.util.List;
28
29 import junit.framework.Assert;
30
31 import org.easymock.classextension.EasyMock;
32 import org.junit.Test;
33
34 import com.gisgraphy.domain.repository.ICountryDao;
35 import com.gisgraphy.domain.valueobject.NameValueDTO;
36
37 public class GeonamesCountryImporterTest {
38
39 @Test
40 public void rollbackShouldRollback() {
41 GeonamesCountryImporter geonamesCountryImporter = new GeonamesCountryImporter();
42 ICountryDao countryDao = EasyMock.createMock(ICountryDao.class);
43 EasyMock.expect(countryDao.deleteAll()).andReturn(5);
44 EasyMock.replay(countryDao);
45 geonamesCountryImporter.setCountryDao(countryDao);
46 List<NameValueDTO<Integer>> deleted = geonamesCountryImporter
47 .rollback();
48 assertEquals(1, deleted.size());
49 assertEquals(5, deleted.get(0).getValue().intValue());
50 }
51
52 @Test
53 public void shouldBeSkipShouldReturnCorrectValue(){
54 GeonamesCountryImporter geonamesCountryImporter = new GeonamesCountryImporter();
55
56 Assert.assertFalse("country importer should never be skiped",geonamesCountryImporter.shouldBeSkipped());
57
58
59 }
60
61 }