Skip to content

Commit

Permalink
closed @cdk.bug 3273205 and created a test. Control that IsotopeConta…
Browse files Browse the repository at this point in the history
…iner doesn't get null.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
Miguel Rojas Cherto authored and egonw committed Aug 11, 2011
1 parent 681cef8 commit 9733d0e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
Expand Up @@ -90,11 +90,12 @@ public static IsotopePattern sortByIntensity(IsotopePattern isotopeP){
intensity = isoContainer.getIntensity();
}
}
if(i == length)
isoSort.setMonoIsotope((IsotopeContainer) isoHighest.clone());
else
isoSort.addIsotope((IsotopeContainer) isoHighest.clone());

if(isoHighest != null){
if(i == length)
isoSort.setMonoIsotope((IsotopeContainer) isoHighest.clone());
else
isoSort.addIsotope((IsotopeContainer) isoHighest.clone());
}
listISO.remove(isoHighest);

}
Expand Down
Expand Up @@ -240,5 +240,24 @@ public void testCalculateIsotopesOrthinine(){
Assert.assertEquals(abundResults[5], isoPattern.getIsotope(5).getIntensity(), 0.01);

}

/**
* A unit test for JUnit.
*
* @cdk.bug 3273205
* @return Description of the Return Value
*/
@Test
public void testCalculateIsotopesMn(){

IMolecularFormula molFor = new MolecularFormula();
molFor.addIsotope(builder.newInstance(IIsotope.class,"Mn"),1);

IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.001);
IsotopePattern isoPattern = isotopeGe.getIsotopes(molFor);

Assert.assertEquals(1, isoPattern.getNumberOfIsotopes());

}
}

0 comments on commit 9733d0e

Please sign in to comment.