Skip to content

Commit bf33fee

Browse files
committed
Update ReadsBundleTest to use more defined constants.
1 parent ddc261b commit bf33fee

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

src/test/java/htsjdk/beta/plugin/reads/ReadsBundleTest.java

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ public void testReadsBundleReadsAndIndex() {
4343
public void testNoReadsInSerializedBundle() {
4444
final String vcfJSON = """
4545
{
46-
"schemaVersion":"0.1.0",
46+
"schemaVersion":"%s",
4747
"schemaName":"htsbundle",
48-
"VARIANT_CONTEXTS":{"path":"my.vcf","format":"VCF"},
49-
"primary":"VARIANT_CONTEXTS"
50-
}""";
48+
"%s":{"path":"my.vcf","format":"%s"},
49+
"primary":"%s"
50+
}"""
51+
.formatted(
52+
BundleJSON.JSON_SCHEMA_VERSION,
53+
BundleResourceType.PRIMARY_CT_VARIANT_CONTEXTS,
54+
BundleResourceType.FMT_VARIANTS_VCF,
55+
BundleResourceType.PRIMARY_CT_VARIANT_CONTEXTS
56+
);
5157
try {
5258
ReadsBundle.getReadsBundleFromString(vcfJSON);
5359
} catch (final IllegalArgumentException e) {
@@ -76,22 +82,29 @@ public Object[][] getRoundTripJSONTestData() {
7682
// reads only, without format included
7783
"""
7884
{
79-
"schemaVersion":"0.1.0",
85+
"schemaVersion":"%s",
8086
"schemaName":"htsbundle",
81-
"ALIGNED_READS":{"path":"%s"},
82-
"primary":"ALIGNED_READS"
83-
}""".formatted(BAM_FILE),
87+
"%s":{"path":"%s"},
88+
"primary":"%s"
89+
}""".formatted(
90+
BundleJSON.JSON_SCHEMA_VERSION,
91+
BundleResourceType.PRIMARY_CT_ALIGNED_READS, BAM_FILE,
92+
BundleResourceType.PRIMARY_CT_ALIGNED_READS
93+
),
8494
new ReadsBundle<IOPath>(new HtsPath(BAM_FILE))
8595
},
8696
{
8797
// reads only, with format included
8898
"""
8999
{
90-
"schemaVersion":"0.1.0",
100+
"schemaVersion":"%s",
91101
"schemaName":"htsbundle",
92-
"ALIGNED_READS":{"path":"%s", "format":"BAM"},
93-
"primary":"ALIGNED_READS"
94-
}""".formatted(BAM_FILE),
102+
"%s":{"path":"%s", "format":"%s"},
103+
"primary":"%s"
104+
}""".formatted(
105+
BundleJSON.JSON_SCHEMA_VERSION,
106+
BundleResourceType.PRIMARY_CT_ALIGNED_READS, BAM_FILE, BundleResourceType.FMT_READS_BAM,
107+
BundleResourceType.PRIMARY_CT_ALIGNED_READS),
95108
// ReadsBundle doesn't automatically infer format, so create one manually
96109
new ReadsBundle(
97110
new BundleBuilder()
@@ -106,12 +119,17 @@ public Object[][] getRoundTripJSONTestData() {
106119
// reads with index, with format included
107120
"""
108121
{
109-
"schemaVersion":"0.1.0",
122+
"schemaVersion":"%s",
110123
"schemaName":"htsbundle",
111-
"ALIGNED_READS":{"path":"%s", "format":"BAM"},
112-
"READS_INDEX":{"path":"%s", "format":"BAI"},
113-
"primary":"ALIGNED_READS"
114-
}""".formatted(BAM_FILE, INDEX_FILE),
124+
"%s":{"path":"%s", "format":"%s"},
125+
"%s":{"path":"%s", "format":"%s"},
126+
"primary":"%s"
127+
}""".formatted(
128+
BundleJSON.JSON_SCHEMA_VERSION,
129+
BundleResourceType.PRIMARY_CT_ALIGNED_READS, BAM_FILE, BundleResourceType.FMT_READS_BAM,
130+
BundleResourceType.SECONDARY_CT_READS_INDEX, INDEX_FILE, BundleResourceType.FMT_READS_INDEX_BAI,
131+
BundleResourceType.PRIMARY_CT_ALIGNED_READS
132+
),
115133
// ReadsBundle doesn't automatically infer format, so create one manually
116134
new ReadsBundle(
117135
new BundleBuilder()

0 commit comments

Comments
 (0)