You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/09/18 07:05:21 UTC

[commons-rng] branch master updated: Directly test the SamplerBase class

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git


The following commit(s) were added to refs/heads/master by this push:
     new f5f958c  Directly test the SamplerBase class
f5f958c is described below

commit f5f958c7a2eec722a828a5fcb7acad3c2cf52c62
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Sat Sep 18 08:05:19 2021 +0100

    Directly test the SamplerBase class
    
    There is no requirement to extend the class to access the pass-through
    methods.
---
 .../rng/sampling/distribution/SamplerBaseTest.java | 35 ++--------------------
 1 file changed, 3 insertions(+), 32 deletions(-)

diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/SamplerBaseTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/SamplerBaseTest.java
index b5e64e5..6c5063c 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/SamplerBaseTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/SamplerBaseTest.java
@@ -25,42 +25,13 @@ import org.junit.jupiter.api.Test;
  * Test for the {@link SamplerBase}. The class is deprecated but is public. The methods
  * should be tested to ensure correct functionality.
  */
+@SuppressWarnings("deprecation")
 class SamplerBaseTest {
-    /**
-     * Extends the {@link SamplerBase} to allow access to methods.
-     */
-    @SuppressWarnings("deprecation")
-    private static class SimpleSampler extends SamplerBase {
-        SimpleSampler(UniformRandomProvider rng) {
-            super(rng);
-        }
-
-        @Override
-        public double nextDouble() {
-            return super.nextDouble();
-        }
-
-        @Override
-        public int nextInt() {
-            return super.nextInt();
-        }
-
-        @Override
-        public int nextInt(int max) {
-            return super.nextInt(max);
-        }
-
-        @Override
-        public long nextLong() {
-            return super.nextLong();
-        }
-    }
-
     @Test
     void testNextMethods() {
         final UniformRandomProvider rng1 = RandomSource.SPLIT_MIX_64.create(0L);
         final UniformRandomProvider rng2 = RandomSource.SPLIT_MIX_64.create(0L);
-        final SimpleSampler sampler = new SimpleSampler(rng2);
+        final SamplerBase sampler = new SamplerBase(rng2);
         final int n = 256;
         for (int i = 0; i < 3; i++) {
             Assertions.assertEquals(rng1.nextDouble(), sampler.nextDouble());
@@ -73,7 +44,7 @@ class SamplerBaseTest {
     @Test
     void testToString() {
         final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(0L);
-        final SimpleSampler sampler = new SimpleSampler(rng);
+        final SamplerBase sampler = new SamplerBase(rng);
         Assertions.assertTrue(sampler.toString().contains("rng"));
     }
 }