File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ dependencies {
1919 testImplementation project(' :cdm-test-utils' )
2020
2121 testImplementation ' com.google.truth:truth'
22+ testImplementation ' org.jdom:jdom2'
2223
2324 testRuntimeOnly ' ch.qos.logback:logback-classic'
2425}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 University Corporation for Atmospheric Research/Unidata
3+ * See LICENSE.txt for license information.
4+ */
5+
6+ package ucar .nc2 .util .xml ;
7+
8+ import static com .google .common .truth .Truth .assertThat ;
9+
10+ import java .io .File ;
11+ import java .io .FileInputStream ;
12+ import java .io .IOException ;
13+ import java .nio .file .Paths ;
14+ import org .junit .Test ;
15+
16+ public class TestRuntimeConfigParser {
17+ @ Test
18+ public void testReflection () throws IOException {
19+ // not testing that the loading actually work, but testing that the reflection
20+ // calls in the RuntimeConfigParser work
21+ File nj22config =
22+ Paths .get ("src/test/resources/runtimeConfig/nj22Config.xml" ).toAbsolutePath ().normalize ().toFile ();
23+ StringBuilder errlog = new StringBuilder ();
24+ try (FileInputStream fis = new FileInputStream (nj22config )) {
25+ RuntimeConfigParser .read (fis , errlog );
26+ }
27+ String err = errlog .toString ();
28+ assertThat (err ).isNotEmpty ();
29+ // since this test lives in the netcdf4 subproject, we should only see
30+ // the "is not on classpath" message if the reflection call used in the
31+ // RuntimeConfigParser code fails
32+ assertThat (err ).doesNotContain ("is not on classpath" );
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ <nj22Config >
2+ <Netcdf4Clibrary >
3+ <libraryPath >/not/a/real/path</libraryPath >
4+ <libraryName >netcdf</libraryName >
5+ <useForReading >false</useForReading >
6+ </Netcdf4Clibrary >
7+ </nj22Config >
You can’t perform that action at this time.
0 commit comments