Skip to content

Commit 3e30784

Browse files
committed
Fix deprecation warnings from Java 11 for tests
1 parent 1f8c257 commit 3e30784

11 files changed

+34
-34
lines changed

src/test/java/org/broadinstitute/hellbender/testutils/VariantContextTestUtilsUnitTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ public void testNormalizeScientificNotation(Object toNormalize, Object expected)
8888
public Object[][] getIntegerValuesToNormalize(){
8989
final Object aSpecificObject = new Object();
9090
return new Object[][] {
91-
{"27", new Integer(27)},
92-
{"-27", new Integer(-27)},
93-
{"0", new Integer(0)},
94-
{"-27014", new Integer(-27014)},
91+
{"27", 27},
92+
{"-27", -27},
93+
{"0", 0},
94+
{"-27014", -27014},
9595
{1, 1},
9696
{1, 1},
9797
{-1, -1},

src/test/java/org/broadinstitute/hellbender/tools/funcotator/FuncotatorIntegrationTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,10 @@ public void testVcfMafConcordance(final String inputVcf,
11431143
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getContig).collect(Collectors.toList());
11441144
}
11451145
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_Start_Position) ) {
1146-
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getStart).map(x -> new Integer(x)).map(Object::toString).collect(Collectors.toList());
1146+
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getStart).map(Object::toString).collect(Collectors.toList());
11471147
}
11481148
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_End_Position) ) {
1149-
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getEnd).map(x -> new Integer(x)).map(Object::toString).collect(Collectors.toList());
1149+
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getEnd).map(Object::toString).collect(Collectors.toList());
11501150
}
11511151
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_Hugo_Symbol) ) {
11521152
mafFieldValues = maf.getRecords().stream().map(x -> x.getAnnotationValue(MafOutputRendererConstants.FieldName_Hugo_Symbol)).map(a -> a.isEmpty() ? "Unknown" : a).collect(Collectors.toList());

src/test/java/org/broadinstitute/hellbender/tools/spark/pathseq/PathSeqScoreIntegrationTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ private static Map<String, PSPathogenTaxonScore> getScores(final String[] lines)
4343
final PSPathogenTaxonScore score = new PSPathogenTaxonScore();
4444
final String taxonId = tok[0];
4545
score.setKingdomTaxonId(Math.abs(tok[4].hashCode()));
46-
score.addSelfScore(new Double(tok[5]));
47-
score.addScoreNormalized(new Double(tok[6]));
48-
score.addTotalReads(new Integer(tok[7]));
49-
score.addUnambiguousReads(new Integer(tok[8]));
50-
score.setReferenceLength(new Long(tok[9]));
46+
score.addSelfScore(Double.parseDouble(tok[5]));
47+
score.addScoreNormalized(Double.parseDouble(tok[6]));
48+
score.addTotalReads(Integer.parseInt(tok[7]));
49+
score.addUnambiguousReads(Integer.parseInt((tok[8])));
50+
score.setReferenceLength(Long.parseLong(tok[9]));
5151
Assert.assertFalse(scores.containsKey(taxonId), "Found more than one entry for taxon ID " + taxonId);
5252
scores.put(taxonId, score);
5353
}

src/test/java/org/broadinstitute/hellbender/tools/spark/sv/utils/SVKmerShortUnitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void testRandomMaskedKmers() {
104104
//Generate random indices to mask
105105
List<Byte> maskIndices = new ArrayList<>(K);
106106
for (int j = 0; j < K; j++) {
107-
maskIndices.add(new Byte((byte) j));
107+
maskIndices.add((byte) j);
108108
}
109109
Collections.shuffle(maskIndices);
110110
int maskSize = rand.nextInt(K - 3) + 2;

src/test/java/org/broadinstitute/hellbender/tools/spark/utils/LargeLongHopscotchSetTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void resizeTest() {
132132
Assert.assertTrue(hopscotchSet.size() == hashSet.size());
133133
LongIterator itrL = hopscotchSet.iterator();
134134
while (itrL.hasNext()) {
135-
Assert.assertTrue(hashSet.contains(new Long(itrL.next())));
135+
Assert.assertTrue(hashSet.contains(itrL.next()));
136136
}
137137
for (Long val : hashSet) {
138138
Assert.assertTrue(hopscotchSet.contains(val.longValue()));
@@ -155,7 +155,7 @@ void loadRandomLongsTest() {
155155
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
156156
final long randLong = randomLong(rng);
157157
hopscotchSet.add(randLong);
158-
hashSet.add(new Long(randLong));
158+
hashSet.add(randLong);
159159
}
160160
Assert.assertEquals(hashSet.size(), hopscotchSet.size());
161161
for (final Long val : hashSet) {

src/test/java/org/broadinstitute/hellbender/tools/spark/utils/LongBloomFilterTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void testRandomLongs() {
8484
final LongBloomFilter bloomFilter = new LongBloomFilter(HHASH_NVALS, FPP);
8585
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
8686
final long randLong = randomLong(rng);
87-
hashSet.add(new Long(randLong));
87+
hashSet.add(randLong);
8888
bloomFilter.add(randLong);
8989
}
9090
for (final Long val : hashSet) {
@@ -94,7 +94,7 @@ void testRandomLongs() {
9494
int num_total = 0;
9595
for (int valNo = 0; valNo != FPR_NVALS; ++valNo) {
9696
final long randLong = randomLong(rng);
97-
if (!hashSet.contains(new Long(randLong))) {
97+
if (!hashSet.contains(randLong)) {
9898
num_total++;
9999
if (bloomFilter.contains(randLong)) {
100100
num_false_pos++;

src/test/java/org/broadinstitute/hellbender/tools/spark/utils/LongHopscotchSetTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void capacityTest() {
7272
Assert.assertTrue(capacity >= size);
7373
Assert.assertTrue(capacity < 2 * size);
7474
final List<Integer> legalSizes = IntStream.of(SetSizeUtils.legalSizes).boxed().collect(Collectors.toList());
75-
Assert.assertTrue(legalSizes.contains(new Integer((int) capacity)));
75+
Assert.assertTrue(legalSizes.contains((int) capacity));
7676
}
7777
}
7878

@@ -106,7 +106,7 @@ void iteratorTest() {
106106
final List<Long> filteredVals = new LinkedList<>();
107107
for (long testVal : testVals) {
108108
if (KEY_TO_REMOVE == testVal) {
109-
filteredVals.add(new Long(testVal));
109+
filteredVals.add(testVal);
110110
}
111111
}
112112
final int onesCount = filteredVals.size();
@@ -186,7 +186,7 @@ void loadRandomLongsTest() {
186186
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
187187
final long randLong = randomLong(rng);
188188
hopscotchSet.add(randLong);
189-
hashSet.add(new Long(randLong));
189+
hashSet.add(randLong);
190190
}
191191
Assert.assertEquals(hashSet.size(), hopscotchSet.size(), trialMsg);
192192
for (final Long val : hashSet) {

src/test/java/org/broadinstitute/hellbender/utils/HistogramUnitTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public void testAdd() throws Exception {
1616
for (int i = 0; i <= 100; i++) {
1717
bimodalHist.add(1 + i / 1000.0);
1818
}
19-
Assert.assertEquals(bimodalHist.get(1.0), new Integer(100), "");
20-
Assert.assertEquals(bimodalHist.get(1.1), new Integer(1), "");
19+
Assert.assertEquals(bimodalHist.get(1.0), Integer.valueOf(100), "");
20+
Assert.assertEquals(bimodalHist.get(1.1), Integer.valueOf(1), "");
2121
}
2222

2323
@Test
@@ -26,7 +26,7 @@ public void testAddingQuantizedValues() throws Exception {
2626
for (int i = 0; i < 100; i++) {
2727
hist.add(1.2);
2828
}
29-
Assert.assertEquals(hist.get(1.2), new Integer(100));
29+
Assert.assertEquals(hist.get(1.2), Integer.valueOf(100));
3030
Assert.assertEquals(hist.median(), 1.2, EPSILON);
3131
}
3232

@@ -36,8 +36,8 @@ public void testBulkAdd() throws Exception {
3636
for (int i = 0; i <= 100; i++) {
3737
bimodalHist.add(1 + i / 1000.0, 2);
3838
}
39-
Assert.assertEquals(bimodalHist.get(1.0), new Integer(200), "");
40-
Assert.assertEquals(bimodalHist.get(1.1), new Integer(2), "");
39+
Assert.assertEquals(bimodalHist.get(1.0), Integer.valueOf(200), "");
40+
Assert.assertEquals(bimodalHist.get(1.1), Integer.valueOf(2), "");
4141
}
4242

4343
@Test

src/test/java/org/broadinstitute/hellbender/utils/hmm/HMMUnitTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public void testBackward(final TestHMM model, final List<TestHMM.Datum> sequence
261261
for (int position = positions.size() - 1; position >= 0; position--) {
262262
for (final TestHMM.State state : TestHMM.State.values()) {
263263
final double expectedValue = expected.get(position)[state.ordinal()];
264-
final double observedValue = forwardBackwardResult.logBackwardProbability(new Integer(position), state);
264+
final double observedValue = forwardBackwardResult.logBackwardProbability(Integer.valueOf(position), state);
265265
final double observedValueUsingIndex = forwardBackwardResult.logBackwardProbability(position, state);
266266
Assert.assertEquals(observedValueUsingIndex, observedValue);
267267
final double epsilon = 0.001 * Math.min(Math.abs(expectedValue),
@@ -500,7 +500,7 @@ public void testLogProbabilityWithNullStateUsingPositionObject() {
500500

501501
}
502502
Assert.assertNotNull(result);
503-
result.logProbability(new Integer(2), (TestHMM.State)null);
503+
result.logProbability(Integer.valueOf(2), (TestHMM.State)null);
504504
}
505505

506506

@@ -529,7 +529,7 @@ public void testLogDataLikelihoodWithWrongTargetUsingPositionObject() {
529529
Assert.fail("this part of the test must not fail");
530530

531531
}
532-
result.logDataLikelihood(new Integer(14));
532+
result.logDataLikelihood(Integer.valueOf(14));
533533
}
534534

535535
@Test(expectedExceptions = IllegalArgumentException.class)
@@ -559,7 +559,7 @@ public void testLogBackProbabilityWithNullStateUsingPositionObject() {
559559

560560
}
561561
Assert.assertNotNull(result);
562-
result.logBackwardProbability(new Integer(2), null);
562+
result.logBackwardProbability(Integer.valueOf(2), null);
563563
}
564564

565565
@Test(expectedExceptions = IllegalArgumentException.class)
@@ -589,7 +589,7 @@ public void testLogForwardProbabilityWithNullStateUsingPositionObject() {
589589

590590
}
591591
Assert.assertNotNull(result);
592-
result.logForwardProbability(new Integer(2), null);
592+
result.logForwardProbability(Integer.valueOf(2), null);
593593
}
594594

595595
@Test(expectedExceptions = IllegalArgumentException.class)
@@ -649,7 +649,7 @@ public void testLogProbabilityWithMadeUpPositionObject() {
649649

650650
}
651651
Assert.assertNotNull(result);
652-
result.logProbability(new Integer(14), TestHMM.State.A);
652+
result.logProbability(Integer.valueOf(14), TestHMM.State.A);
653653
}
654654

655655
@Test(expectedExceptions = IllegalArgumentException.class)
@@ -679,7 +679,7 @@ public void testLogProbabilityWithASequenceThatIsTwoLongUsingPositionObject() {
679679

680680
}
681681
Assert.assertNotNull(result);
682-
result.logProbability(new Integer(2), Arrays.asList(TestHMM.State.A, TestHMM.State.A, TestHMM.State.B));
682+
result.logProbability(Integer.valueOf(2), Arrays.asList(TestHMM.State.A, TestHMM.State.A, TestHMM.State.B));
683683
}
684684

685685
@Test(expectedExceptions = IllegalArgumentException.class)
@@ -769,7 +769,7 @@ public void testLogProbabilityWithNonExistentPositionObject() {
769769

770770
}
771771
Assert.assertNotNull(result);
772-
result.logProbability(new Integer(4), TestHMM.State.A);
772+
result.logProbability(Integer.valueOf(4), TestHMM.State.A);
773773
}
774774

775775
@Test(expectedExceptions = IllegalArgumentException.class)

src/test/java/org/broadinstitute/hellbender/utils/pairhmm/VectorPairHMMUnitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private List<Pair<PairHMM, Boolean> > getHMMs() {
4242
loaded = false;
4343
}
4444

45-
final Pair<PairHMM, Boolean> hmm_load = new ImmutablePair<PairHMM, Boolean>(avxPairHMM, new Boolean(loaded));
45+
final Pair<PairHMM, Boolean> hmm_load = new ImmutablePair<PairHMM, Boolean>(avxPairHMM, loaded);
4646
list.add(hmm_load);
4747
}
4848

src/test/java/org/broadinstitute/hellbender/utils/recalibration/RecalDatumUnitTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void testlog10QempLikelihood() {
217217
}
218218
}
219219

220-
long bigNum = new Long((long) Integer.MAX_VALUE);
220+
long bigNum = Integer.MAX_VALUE;
221221
bigNum *= 2L;
222222
final double log10likelihood = RecalDatum.log10QempLikelihood(30, bigNum, 100000);
223223
Assert.assertTrue(log10likelihood < 0.0);

0 commit comments

Comments
 (0)