22
33import java .io .IOException ;
44import java .io .InputStream ;
5+ import java .nio .file .Path ;
6+ import java .nio .file .Paths ;
57
68import org .junit .jupiter .api .BeforeAll ;
9+ import org .junit .jupiter .api .Test ;
10+
11+ import static org .assertj .core .api .Assertions .assertThat ;
12+ import static org .assertj .core .api .AssertionsForClassTypes .assertThatThrownBy ;
713
814class ExternalStagingFileDataProviderTest extends FileDataProviderTest {
915
@@ -21,4 +27,34 @@ public Staging getStaging() {
2127 return _STAGING ;
2228 }
2329
30+ @ Test
31+ void testConstructorWithPath () throws IOException {
32+ Path zipPath = Paths .get ("src/test/resources/external_algorithm.zip" );
33+ ExternalStagingFileDataProvider provider = new ExternalStagingFileDataProvider (zipPath );
34+
35+ assertThat (provider .getAlgorithm ()).isNotBlank ();
36+ assertThat (provider .getVersion ()).isNotBlank ();
37+ assertThat (provider .getSchemaIds ()).isNotEmpty ();
38+ assertThat (provider .getTableIds ()).isNotEmpty ();
39+ }
40+
41+ @ Test
42+ void testConstructorWithString () throws IOException {
43+ String zipFileName = "src/test/resources/external_algorithm.zip" ;
44+ ExternalStagingFileDataProvider provider = new ExternalStagingFileDataProvider (zipFileName );
45+
46+ assertThat (provider .getAlgorithm ()).isNotBlank ();
47+ assertThat (provider .getVersion ()).isNotBlank ();
48+ assertThat (provider .getSchemaIds ()).isNotEmpty ();
49+ assertThat (provider .getTableIds ()).isNotEmpty ();
50+ }
51+
52+ @ Test
53+ void testInvalidPathThrowsException () {
54+ Path invalidPath = Paths .get ("src/test/resources/missing.zip" );
55+ assertThatThrownBy (() -> new ExternalStagingFileDataProvider (invalidPath ))
56+ .isInstanceOf (IOException .class )
57+ .hasMessageContaining ("missing.zip" );
58+ }
59+
2460}
0 commit comments