File tree Expand file tree Collapse file tree
src/test/java/eu/europa/ted/eforms/sdk/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package eu .europa .ted .eforms .sdk .resource ;
2+
3+ import static org .junit .jupiter .api .Assertions .assertTrue ;
4+
5+ import java .io .IOException ;
6+ import java .io .InputStream ;
7+ import java .nio .file .Path ;
8+
9+ import org .junit .jupiter .api .BeforeAll ;
10+ import org .junit .jupiter .api .Test ;
11+
12+ import eu .europa .ted .MavenTestSetup ;
13+ import eu .europa .ted .eforms .sdk .SdkConstants ;
14+
15+ public class SdkResourceLoaderTest extends MavenTestSetup {
16+ private static final Path SDK_ROOT_DIR = Path .of ("target/eforms-sdk" );
17+
18+ @ BeforeAll
19+ static void downloadSdk () throws IOException {
20+ SdkDownloader .downloadSdk ("1.1" , SDK_ROOT_DIR );
21+ }
22+
23+ @ Test
24+ void testGetResourceAsPath () {
25+ Path path = SdkResourceLoader .getResourceAsPath ("1.1.3" ,
26+ SdkConstants .SdkResource .FIELDS_JSON , SDK_ROOT_DIR );
27+
28+ assertTrue (path .endsWith ("fields/fields.json" ));
29+ }
30+
31+ @ Test
32+ void testGetResourceAsStream () throws IOException {
33+ InputStream is = SdkResourceLoader .getResourceAsStream ("1.1.3" ,
34+ SdkConstants .SdkResource .FIELDS , "fields.json" , SDK_ROOT_DIR );
35+
36+ assertTrue (is .read () >= 0 );
37+ is .close ();
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments