Skip to content

Commit

Permalink
removing retry test
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi committed Jan 23, 2024
1 parent 6a4bef4 commit 1451e6b
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/test/java/uk/ac/ebi/eva/contigalias/datasource/RetryTest.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package uk.ac.ebi.eva.contigalias.datasource;

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.net.ftp.FTPFile;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.test.context.TestPropertySource;
import org.springframework.web.client.RestTemplate;
import uk.ac.ebi.eva.contigalias.dus.NCBIBrowser;
import uk.ac.ebi.eva.contigalias.exception.DownloadFailedException;
import uk.ac.ebi.eva.contigalias.scheduler.Md5ChecksumRetriever;

import java.io.IOException;
import java.nio.file.Path;
Expand All @@ -24,8 +20,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -44,13 +38,6 @@ public class RetryTest {
@Autowired
private NCBIAssemblyDataSource dataSource;

@Autowired
private Md5ChecksumRetriever md5ChecksumRetriever;

@MockBean
private RestTemplate restTemplate;


@Test
public void fileDownloadSuccessfulTest() throws IOException {
String mockAccession = "GCA_000012345.1";
Expand Down Expand Up @@ -120,20 +107,4 @@ public void fileDownloadFailedRetryTest2() throws IOException {
verify(ncbiBrowser, times(5)).getGenomeReportDirectory(mockAccession);
}


@Test
public void retrieveMd5ChecksumRetry() {
String insdcAccession = "TEST_ACCESSION";
when(restTemplate.getForObject(anyString(), eq(JsonNode.class)))
.thenThrow(new RuntimeException("Simulated network issue"));

Md5ChecksumRetriever anotherObjSpy = Mockito.spy(md5ChecksumRetriever);
RuntimeException thrown = Assertions.assertThrows(RuntimeException.class, () -> {
anotherObjSpy.retrieveMd5Checksum(insdcAccession);
});

assertEquals("Simulated network issue", thrown.getMessage());
verify(restTemplate, times(5)).getForObject(anyString(), eq(JsonNode.class));
}

}

0 comments on commit 1451e6b

Please sign in to comment.