Skip to content

Commit 18c1787

Browse files
committed
Improved test coverage.
1 parent ba9f178 commit 18c1787

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hipparchus-core/src/test/java/org/hipparchus/random/GammaGeneratorTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import org.hipparchus.distribution.RealDistribution;
2020
import org.hipparchus.distribution.continuous.GammaDistribution;
21+
import org.hipparchus.exception.LocalizedCoreFormats;
22+
import org.hipparchus.exception.MathIllegalStateException;
2123
import org.junit.jupiter.api.Assertions;
2224
import org.junit.jupiter.api.Test;
2325

@@ -83,4 +85,15 @@ public void testVariance()
8385
}
8486
}
8587

88+
@Test
89+
public void testMaxRejection()
90+
{
91+
try {
92+
new GammaGenerator(new RandomAdaptorTest.ConstantGenerator(1.23), 2.3, 4.5).nextVariate();
93+
Assertions.fail("an exception should have been thrown");
94+
} catch (MathIllegalStateException mise) {
95+
Assertions.assertEquals(LocalizedCoreFormats.INTERNAL_ERROR, mise.getSpecifier());
96+
}
97+
}
98+
8699
}

0 commit comments

Comments
 (0)