1717import io .github .cdimascio .dotenv .Dotenv ;
1818import lombok .extern .slf4j .Slf4j ;
1919import org .junit .jupiter .api .Disabled ;
20+ import org .junit .jupiter .api .Tag ;
2021import org .junit .jupiter .api .Test ;
2122import org .junit .jupiter .params .ParameterizedTest ;
2223import org .junit .jupiter .params .provider .CsvSource ;
4445
4546@ Slf4j
4647public class RealApiIntegrationTests {
47- private static final String EICAR_URL = "https://secure.eicar.org /eicar.com.txt" ;
48+ private static final String EICAR_URL = "https://test-samples-vaas.s3-eu-central-2.ionoscloud.com /eicar.com.txt" ;
4849
4950 private static final Dotenv dotenv = Dotenv .configure ()
5051 .ignoreIfMissing ()
@@ -149,6 +150,7 @@ public void forSha256_ReturnsVerdict(String sha256, Verdict verdict) {
149150 "true, false" ,
150151 "true, true" ,
151152 })
153+ @ Tag ("Mock" )
152154 public void forSha256_SendOptions (boolean useCache , boolean useHashLookup ) {
153155 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
154156 var requestCaptor = ArgumentCaptor .forClass (HttpRequest .class );
@@ -178,6 +180,7 @@ public void forSha256_SendOptions(boolean useCache, boolean useHashLookup) {
178180
179181 @ SuppressWarnings ("unchecked" )
180182 @ Test
183+ @ Tag ("Mock" )
181184 public void forSha256_SendUserAgent () {
182185 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
183186 var requestCaptor = ArgumentCaptor .forClass (HttpRequest .class );
@@ -204,6 +207,7 @@ public void forSha256_SendUserAgent() {
204207
205208 @ SuppressWarnings ("unchecked" )
206209 @ Test
210+ @ Tag ("Mock" )
207211 public void forSha256_IfVaasRequestIdIsSet_SendTraceState () {
208212 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
209213 var requestCaptor = ArgumentCaptor .forClass (HttpRequest .class );
@@ -232,6 +236,7 @@ public void forSha256_IfVaasRequestIdIsSet_SendTraceState() {
232236
233237 @ SuppressWarnings ("unchecked" )
234238 @ Test
239+ @ Tag ("Mock" )
235240 public void forSha256_IfBadRequest_ThrowsVaasClientException () {
236241 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
237242 var mockHttpClient = mock (HttpClient .class );
@@ -250,6 +255,7 @@ public void forSha256_IfBadRequest_ThrowsVaasClientException() {
250255
251256 @ SuppressWarnings ("unchecked" )
252257 @ Test
258+ @ Tag ("Mock" )
253259 public void forSha256_IfInternalServerError_ThrowsVaasServerException () {
254260 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
255261 var mockHttpClient = mock (HttpClient .class );
@@ -266,6 +272,7 @@ public void forSha256_IfInternalServerError_ThrowsVaasServerException() {
266272
267273 @ SuppressWarnings ("unchecked" )
268274 @ Test
275+ @ Tag ("Mock" )
269276 public void forSha256_IfUnauthorized_ThrowsVaasAuthenticationException () {
270277 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
271278 var mockHttpClient = mock (HttpClient .class );
@@ -282,6 +289,7 @@ public void forSha256_IfUnauthorized_ThrowsVaasAuthenticationException() {
282289
283290 @ SuppressWarnings ("unchecked" )
284291 @ Test
292+ @ Tag ("Mock" )
285293 public void forSha256_IfAuthenticatorFailed_ThrowsVaasAuthenticationException () throws Exception {
286294 var sha256 = new Sha256 ("275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" );
287295 var mockHttpClient = mock (HttpClient .class );
@@ -335,6 +343,7 @@ public void forFile_ReturnsVerdict(String uri, Verdict verdict) throws Exception
335343 "true, false" ,
336344 "true, true" ,
337345 })
346+ @ Tag ("Mock" )
338347 public void forFile_SendOptions (boolean useCache , boolean useHashLookup ) throws Exception {
339348 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
340349 var url = URI .create (EICAR_URL ).toURL ();
@@ -414,6 +423,7 @@ public void forFile_SendOptions(boolean useCache, boolean useHashLookup) throws
414423
415424 @ SuppressWarnings ("unchecked" )
416425 @ Test
426+ @ Tag ("Mock" )
417427 public void forFile_SendUserAgent () throws Exception {
418428 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
419429 var url = URI .create (EICAR_URL ).toURL ();
@@ -477,6 +487,7 @@ public void forFile_SendUserAgent() throws Exception {
477487
478488 @ SuppressWarnings ("unchecked" )
479489 @ Test
490+ @ Tag ("Mock" )
480491 public void forFile_IfVaasRequestIdIsSet_SendTraceState () throws Exception {
481492 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
482493 var url = URI .create (EICAR_URL ).toURL ();
@@ -541,6 +552,7 @@ public void forFile_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
541552
542553 @ SuppressWarnings ("unchecked" )
543554 @ Test
555+ @ Tag ("Mock" )
544556 public void forFile_IfBadRequest_ThrowsVaasClientException () throws Exception {
545557 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
546558 var url = URI .create (EICAR_URL ).toURL ();
@@ -580,6 +592,7 @@ public void forFile_IfBadRequest_ThrowsVaasClientException() throws Exception {
580592
581593 @ SuppressWarnings ("unchecked" )
582594 @ Test
595+ @ Tag ("Mock" )
583596 public void forFile_IfInternalServerError_ThrowsVaasServerException ()
584597 throws Exception {
585598 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
@@ -620,6 +633,7 @@ public void forFile_IfInternalServerError_ThrowsVaasServerException()
620633
621634 @ SuppressWarnings ("unchecked" )
622635 @ Test
636+ @ Tag ("Mock" )
623637 public void forFile_IfUnauthorized_ThrowsVaasAuthenticationException ()
624638 throws Exception {
625639 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
@@ -660,6 +674,7 @@ public void forFile_IfUnauthorized_ThrowsVaasAuthenticationException()
660674
661675 @ SuppressWarnings ("unchecked" )
662676 @ Test
677+ @ Tag ("Mock" )
663678 public void forFile_IfAuthenticatorFailed_ThrowsVaasAuthenticationException () throws Exception {
664679 var tmpFile = Path .of (System .getProperty ("java.io.tmpdir" ), "file.txt" );
665680 var url = URI .create (EICAR_URL ).toURL ();
@@ -739,6 +754,7 @@ public void forStream_ReturnsVerdict() throws Exception {
739754 "false" ,
740755 "true" ,
741756 })
757+ @ Tag ("Mock" )
742758 public void forStream_SendOptions (boolean useHashLookup ) throws Exception {
743759 var url = URI .create (EICAR_URL ).toURL ();
744760 var conn = url .openConnection ();
@@ -799,6 +815,7 @@ public void forStream_SendOptions(boolean useHashLookup) throws Exception {
799815
800816 @ SuppressWarnings ("unchecked" )
801817 @ Test
818+ @ Tag ("Mock" )
802819 public void forStream_SendUserAgent () throws Exception {
803820 var url = URI .create (EICAR_URL ).toURL ();
804821 var conn = url .openConnection ();
@@ -859,6 +876,7 @@ public void forStream_SendUserAgent() throws Exception {
859876
860877 @ SuppressWarnings ("unchecked" )
861878 @ Test
879+ @ Tag ("Mock" )
862880 public void forStream_IfVaasRequestIdIsSet_SendTraceState () throws Exception {
863881 var url = URI .create (EICAR_URL ).toURL ();
864882 var conn = url .openConnection ();
@@ -920,6 +938,7 @@ public void forStream_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
920938
921939 @ SuppressWarnings ("unchecked" )
922940 @ Test
941+ @ Tag ("Mock" )
923942 public void forStream_IfBadRequest_ThrowsVaasClientException () throws Exception {
924943 var url = URI .create (EICAR_URL ).toURL ();
925944 var conn = url .openConnection ();
@@ -958,6 +977,7 @@ public void forStream_IfBadRequest_ThrowsVaasClientException() throws Exception
958977
959978 @ SuppressWarnings ("unchecked" )
960979 @ Test
980+ @ Tag ("Mock" )
961981 public void forStream_IfInternalServerError_ThrowsVaasServerException ()
962982 throws Exception {
963983 var url = URI .create (EICAR_URL ).toURL ();
@@ -997,6 +1017,7 @@ public void forStream_IfInternalServerError_ThrowsVaasServerException()
9971017
9981018 @ SuppressWarnings ("unchecked" )
9991019 @ Test
1020+ @ Tag ("Mock" )
10001021 public void forStream_IfUnauthorized_ThrowsVaasAuthenticationException ()
10011022 throws Exception {
10021023 var url = URI .create (EICAR_URL ).toURL ();
@@ -1036,6 +1057,7 @@ public void forStream_IfUnauthorized_ThrowsVaasAuthenticationException()
10361057
10371058 @ SuppressWarnings ("unchecked" )
10381059 @ Test
1060+ @ Tag ("Mock" )
10391061 public void forStream_IfAuthenticatorFailed_ThrowsVaasAuthenticationException () throws Exception {
10401062 var url = URI .create (EICAR_URL ).toURL ();
10411063 var conn = url .openConnection ();
@@ -1107,6 +1129,7 @@ public void forUrl_ReturnsVerdict() throws Exception {
11071129 "false" ,
11081130 "true" ,
11091131 })
1132+ @ Tag ("Mock" )
11101133 public void forUrl_SendOptions (boolean useHashLookup ) throws Exception {
11111134 var url = URI .create (EICAR_URL ).toURL ();
11121135
@@ -1157,6 +1180,7 @@ public void forUrl_SendOptions(boolean useHashLookup) throws Exception {
11571180
11581181 @ SuppressWarnings ("unchecked" )
11591182 @ Test
1183+ @ Tag ("Mock" )
11601184 public void forUrl_SendUserAgent () throws Exception {
11611185 var url = URI .create (EICAR_URL ).toURL ();
11621186
@@ -1207,6 +1231,7 @@ public void forUrl_SendUserAgent() throws Exception {
12071231
12081232 @ SuppressWarnings ("unchecked" )
12091233 @ Test
1234+ @ Tag ("Mock" )
12101235 public void forUrl_IfVaasRequestIdIsSet_SendTraceState () throws Exception {
12111236 var url = URI .create (EICAR_URL ).toURL ();
12121237
@@ -1258,6 +1283,7 @@ public void forUrl_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
12581283
12591284 @ SuppressWarnings ("unchecked" )
12601285 @ Test
1286+ @ Tag ("Mock" )
12611287 public void forUrl_IfBadRequest_ThrowsVaasClientException () throws Exception {
12621288 var url = URI .create (EICAR_URL ).toURL ();
12631289
@@ -1281,6 +1307,7 @@ public void forUrl_IfBadRequest_ThrowsVaasClientException() throws Exception {
12811307
12821308 @ SuppressWarnings ("unchecked" )
12831309 @ Test
1310+ @ Tag ("Mock" )
12841311 public void forUrl_IfInternalServerError_ThrowsVaasServerException ()
12851312 throws Exception {
12861313 var url = URI .create (EICAR_URL ).toURL ();
@@ -1305,6 +1332,7 @@ public void forUrl_IfInternalServerError_ThrowsVaasServerException()
13051332
13061333 @ SuppressWarnings ("unchecked" )
13071334 @ Test
1335+ @ Tag ("Mock" )
13081336 public void forUrl_IfUnauthorized_ThrowsVaasAuthenticationException ()
13091337 throws Exception {
13101338 var url = URI .create (EICAR_URL ).toURL ();
@@ -1329,6 +1357,7 @@ public void forUrl_IfUnauthorized_ThrowsVaasAuthenticationException()
13291357
13301358 @ SuppressWarnings ("unchecked" )
13311359 @ Test
1360+ @ Tag ("Mock" )
13321361 public void forUrl_IfAuthenticatorFailed_ThrowsVaasAuthenticationException () throws Exception {
13331362 var url = URI .create (EICAR_URL ).toURL ();
13341363
0 commit comments