Skip to content

Commit

Permalink
Fix deprecation warnings from Java 11 for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite committed Sep 17, 2019
1 parent 1f8c257 commit 3e30784
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public void testNormalizeScientificNotation(Object toNormalize, Object expected)
public Object[][] getIntegerValuesToNormalize(){
final Object aSpecificObject = new Object();
return new Object[][] {
{"27", new Integer(27)},
{"-27", new Integer(-27)},
{"0", new Integer(0)},
{"-27014", new Integer(-27014)},
{"27", 27},
{"-27", -27},
{"0", 0},
{"-27014", -27014},
{1, 1},
{1, 1},
{-1, -1},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,10 @@ public void testVcfMafConcordance(final String inputVcf,
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getContig).collect(Collectors.toList());
}
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_Start_Position) ) {
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getStart).map(x -> new Integer(x)).map(Object::toString).collect(Collectors.toList());
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getStart).map(Object::toString).collect(Collectors.toList());
}
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_End_Position) ) {
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getEnd).map(x -> new Integer(x)).map(Object::toString).collect(Collectors.toList());
mafFieldValues = maf.getRecords().stream().map(AnnotatedInterval::getEnd).map(Object::toString).collect(Collectors.toList());
}
else if ( annotationsToCheckMaf.get(i).equals(MafOutputRendererConstants.FieldName_Hugo_Symbol) ) {
mafFieldValues = maf.getRecords().stream().map(x -> x.getAnnotationValue(MafOutputRendererConstants.FieldName_Hugo_Symbol)).map(a -> a.isEmpty() ? "Unknown" : a).collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ private static Map<String, PSPathogenTaxonScore> getScores(final String[] lines)
final PSPathogenTaxonScore score = new PSPathogenTaxonScore();
final String taxonId = tok[0];
score.setKingdomTaxonId(Math.abs(tok[4].hashCode()));
score.addSelfScore(new Double(tok[5]));
score.addScoreNormalized(new Double(tok[6]));
score.addTotalReads(new Integer(tok[7]));
score.addUnambiguousReads(new Integer(tok[8]));
score.setReferenceLength(new Long(tok[9]));
score.addSelfScore(Double.parseDouble(tok[5]));
score.addScoreNormalized(Double.parseDouble(tok[6]));
score.addTotalReads(Integer.parseInt(tok[7]));
score.addUnambiguousReads(Integer.parseInt((tok[8])));
score.setReferenceLength(Long.parseLong(tok[9]));
Assert.assertFalse(scores.containsKey(taxonId), "Found more than one entry for taxon ID " + taxonId);
scores.put(taxonId, score);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void testRandomMaskedKmers() {
//Generate random indices to mask
List<Byte> maskIndices = new ArrayList<>(K);
for (int j = 0; j < K; j++) {
maskIndices.add(new Byte((byte) j));
maskIndices.add((byte) j);
}
Collections.shuffle(maskIndices);
int maskSize = rand.nextInt(K - 3) + 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void resizeTest() {
Assert.assertTrue(hopscotchSet.size() == hashSet.size());
LongIterator itrL = hopscotchSet.iterator();
while (itrL.hasNext()) {
Assert.assertTrue(hashSet.contains(new Long(itrL.next())));
Assert.assertTrue(hashSet.contains(itrL.next()));
}
for (Long val : hashSet) {
Assert.assertTrue(hopscotchSet.contains(val.longValue()));
Expand All @@ -155,7 +155,7 @@ void loadRandomLongsTest() {
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
final long randLong = randomLong(rng);
hopscotchSet.add(randLong);
hashSet.add(new Long(randLong));
hashSet.add(randLong);
}
Assert.assertEquals(hashSet.size(), hopscotchSet.size());
for (final Long val : hashSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void testRandomLongs() {
final LongBloomFilter bloomFilter = new LongBloomFilter(HHASH_NVALS, FPP);
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
final long randLong = randomLong(rng);
hashSet.add(new Long(randLong));
hashSet.add(randLong);
bloomFilter.add(randLong);
}
for (final Long val : hashSet) {
Expand All @@ -94,7 +94,7 @@ void testRandomLongs() {
int num_total = 0;
for (int valNo = 0; valNo != FPR_NVALS; ++valNo) {
final long randLong = randomLong(rng);
if (!hashSet.contains(new Long(randLong))) {
if (!hashSet.contains(randLong)) {
num_total++;
if (bloomFilter.contains(randLong)) {
num_false_pos++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void capacityTest() {
Assert.assertTrue(capacity >= size);
Assert.assertTrue(capacity < 2 * size);
final List<Integer> legalSizes = IntStream.of(SetSizeUtils.legalSizes).boxed().collect(Collectors.toList());
Assert.assertTrue(legalSizes.contains(new Integer((int) capacity)));
Assert.assertTrue(legalSizes.contains((int) capacity));
}
}

Expand Down Expand Up @@ -106,7 +106,7 @@ void iteratorTest() {
final List<Long> filteredVals = new LinkedList<>();
for (long testVal : testVals) {
if (KEY_TO_REMOVE == testVal) {
filteredVals.add(new Long(testVal));
filteredVals.add(testVal);
}
}
final int onesCount = filteredVals.size();
Expand Down Expand Up @@ -186,7 +186,7 @@ void loadRandomLongsTest() {
for (int valNo = 0; valNo != HHASH_NVALS; ++valNo) {
final long randLong = randomLong(rng);
hopscotchSet.add(randLong);
hashSet.add(new Long(randLong));
hashSet.add(randLong);
}
Assert.assertEquals(hashSet.size(), hopscotchSet.size(), trialMsg);
for (final Long val : hashSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public void testAdd() throws Exception {
for (int i = 0; i <= 100; i++) {
bimodalHist.add(1 + i / 1000.0);
}
Assert.assertEquals(bimodalHist.get(1.0), new Integer(100), "");
Assert.assertEquals(bimodalHist.get(1.1), new Integer(1), "");
Assert.assertEquals(bimodalHist.get(1.0), Integer.valueOf(100), "");
Assert.assertEquals(bimodalHist.get(1.1), Integer.valueOf(1), "");
}

@Test
Expand All @@ -26,7 +26,7 @@ public void testAddingQuantizedValues() throws Exception {
for (int i = 0; i < 100; i++) {
hist.add(1.2);
}
Assert.assertEquals(hist.get(1.2), new Integer(100));
Assert.assertEquals(hist.get(1.2), Integer.valueOf(100));
Assert.assertEquals(hist.median(), 1.2, EPSILON);
}

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

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void testBackward(final TestHMM model, final List<TestHMM.Datum> sequence
for (int position = positions.size() - 1; position >= 0; position--) {
for (final TestHMM.State state : TestHMM.State.values()) {
final double expectedValue = expected.get(position)[state.ordinal()];
final double observedValue = forwardBackwardResult.logBackwardProbability(new Integer(position), state);
final double observedValue = forwardBackwardResult.logBackwardProbability(Integer.valueOf(position), state);
final double observedValueUsingIndex = forwardBackwardResult.logBackwardProbability(position, state);
Assert.assertEquals(observedValueUsingIndex, observedValue);
final double epsilon = 0.001 * Math.min(Math.abs(expectedValue),
Expand Down Expand Up @@ -500,7 +500,7 @@ public void testLogProbabilityWithNullStateUsingPositionObject() {

}
Assert.assertNotNull(result);
result.logProbability(new Integer(2), (TestHMM.State)null);
result.logProbability(Integer.valueOf(2), (TestHMM.State)null);
}


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

}
result.logDataLikelihood(new Integer(14));
result.logDataLikelihood(Integer.valueOf(14));
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down Expand Up @@ -559,7 +559,7 @@ public void testLogBackProbabilityWithNullStateUsingPositionObject() {

}
Assert.assertNotNull(result);
result.logBackwardProbability(new Integer(2), null);
result.logBackwardProbability(Integer.valueOf(2), null);
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down Expand Up @@ -589,7 +589,7 @@ public void testLogForwardProbabilityWithNullStateUsingPositionObject() {

}
Assert.assertNotNull(result);
result.logForwardProbability(new Integer(2), null);
result.logForwardProbability(Integer.valueOf(2), null);
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down Expand Up @@ -649,7 +649,7 @@ public void testLogProbabilityWithMadeUpPositionObject() {

}
Assert.assertNotNull(result);
result.logProbability(new Integer(14), TestHMM.State.A);
result.logProbability(Integer.valueOf(14), TestHMM.State.A);
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down Expand Up @@ -679,7 +679,7 @@ public void testLogProbabilityWithASequenceThatIsTwoLongUsingPositionObject() {

}
Assert.assertNotNull(result);
result.logProbability(new Integer(2), Arrays.asList(TestHMM.State.A, TestHMM.State.A, TestHMM.State.B));
result.logProbability(Integer.valueOf(2), Arrays.asList(TestHMM.State.A, TestHMM.State.A, TestHMM.State.B));
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down Expand Up @@ -769,7 +769,7 @@ public void testLogProbabilityWithNonExistentPositionObject() {

}
Assert.assertNotNull(result);
result.logProbability(new Integer(4), TestHMM.State.A);
result.logProbability(Integer.valueOf(4), TestHMM.State.A);
}

@Test(expectedExceptions = IllegalArgumentException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private List<Pair<PairHMM, Boolean> > getHMMs() {
loaded = false;
}

final Pair<PairHMM, Boolean> hmm_load = new ImmutablePair<PairHMM, Boolean>(avxPairHMM, new Boolean(loaded));
final Pair<PairHMM, Boolean> hmm_load = new ImmutablePair<PairHMM, Boolean>(avxPairHMM, loaded);
list.add(hmm_load);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void testlog10QempLikelihood() {
}
}

long bigNum = new Long((long) Integer.MAX_VALUE);
long bigNum = Integer.MAX_VALUE;
bigNum *= 2L;
final double log10likelihood = RecalDatum.log10QempLikelihood(30, bigNum, 100000);
Assert.assertTrue(log10likelihood < 0.0);
Expand Down

0 comments on commit 3e30784

Please sign in to comment.