@@ -0,0 +1,1548 @@
+package lan.dk.podcastserver.controller.api;%0A%0Aimport com.google.common.collect.Lists;%0Aimport com.google.common.collect.Queues;%0Aimport lan.dk.podcastserver.entity.Item;%0Aimport lan.dk.podcastserver.entity.Podcast;%0Aimport lan.dk.podcastserver.manager.ItemDownloadManager;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.util.Queue;%0Aimport java.util.concurrent.ConcurrentLinkedQueue;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.mockito.Mockito.when;%0A%0A/**%0A * Created by kevin on 08/08/2016.%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class IDMControllerTest %7B%0A%0A    @Mock ItemDownloadManager IDM;%0A    @InjectMocks IDMController idmController;%0A%0A    @Test%0A    public void should_get_download_list() %7B%0A        /* Given */%0A        ConcurrentLinkedQueue%3CItem%3E waitingQueue = Queues.newConcurrentLinkedQueue();%0A        Podcast podcast = Podcast.builder().title(%22Podcast%22).build();%0A%0A        waitingQueue.addAll(Lists.newArrayList(%0A                Item.builder().title(%22Foo%22).podcast(podcast).build(),%0A                Item.builder().title(%22Bar%22).podcast(podcast).build()%0A        ));%0A        when(IDM.getWaitingQueue()).thenReturn(waitingQueue);%0A%0A        /* When */%0A        Queue%3CItem%3E downloadList = idmController.getDownloadList();%0A%0A        /* Then */%0A        assertThat(downloadList)%0A                .hasSize(2)%0A                .contains(waitingQueue.toArray(new Item%5BwaitingQueue.size()%5D));%0A    %7D%0A%7D

test of controller