288 |
benjamin |
1 |
package org.tela_botanica.del.test.vues.comparaisoneflore;
|
|
|
2 |
|
|
|
3 |
import static org.junit.Assert.assertTrue;
|
534 |
benjamin |
4 |
import static org.mockito.Mockito.doAnswer;
|
288 |
benjamin |
5 |
import static org.mockito.Mockito.mock;
|
|
|
6 |
|
|
|
7 |
import org.junit.Before;
|
|
|
8 |
import org.junit.Test;
|
534 |
benjamin |
9 |
import org.mockito.Mockito;
|
|
|
10 |
import org.mockito.invocation.InvocationOnMock;
|
|
|
11 |
import org.mockito.stubbing.Answer;
|
|
|
12 |
import org.tela_botanica.del.client.services.rest.ImageService;
|
|
|
13 |
import org.tela_botanica.del.client.services.rest.VoteProtocoleService;
|
|
|
14 |
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
|
345 |
aurelien |
15 |
import org.tela_botanica.del.client.utils.MockDatasource;
|
288 |
benjamin |
16 |
import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEflorePresenteur;
|
|
|
17 |
import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEflorePresenteur.Vue;
|
|
|
18 |
|
|
|
19 |
public class ComparaisonEflorePresenteurTest {
|
|
|
20 |
|
|
|
21 |
private ComparaisonEflorePresenteur comparaisonEflorePresenteur;
|
|
|
22 |
|
|
|
23 |
@Before
|
|
|
24 |
public void setUp() {
|
534 |
benjamin |
25 |
Vue vue = mock(Vue.class);
|
|
|
26 |
ImageService imageService = Mockito.mock(ImageService.class);
|
|
|
27 |
VoteProtocoleService voteProtocoleService = mock(VoteProtocoleService.class);
|
288 |
benjamin |
28 |
|
534 |
benjamin |
29 |
doAnswer(new Answer<Void>() {
|
|
|
30 |
public Void answer(InvocationOnMock invocation) {
|
|
|
31 |
comparaisonEflorePresenteur.setImagesEflore(MockDatasource.getInstance().getImages(0, 10));
|
|
|
32 |
return null;
|
|
|
33 |
}
|
|
|
34 |
}).when(imageService).getImagesEfloreParTaxon(Mockito.anyString(), Mockito.any(ImagesParTaxonCallback.class));
|
|
|
35 |
|
|
|
36 |
comparaisonEflorePresenteur = new ComparaisonEflorePresenteur(vue, voteProtocoleService, imageService);
|
288 |
benjamin |
37 |
comparaisonEflorePresenteur.chargerObservationsEflore();
|
534 |
benjamin |
38 |
|
288 |
benjamin |
39 |
}
|
|
|
40 |
|
|
|
41 |
@Test
|
|
|
42 |
public void testChargerImages() {
|
534 |
benjamin |
43 |
assertTrue(comparaisonEflorePresenteur.getImagesEflore().size() == 10);
|
288 |
benjamin |
44 |
}
|
|
|
45 |
|
|
|
46 |
}
|