MiscBigIntegerGenerators { public BigInteger[] getPoly(int l) { Integer lInt = l; BigInteger[] result = coefficientsOfPolynomiums.get(lInt); if (result == null) { result = new BigInteger[l + 1]; BigInteger[] coefficients = constructPolynomial(l); for (int i = 0; i <= l; i++) { result[i] = coefficients[coefficients.length - 1 - i]; } coefficientsOfPolynomiums.put(lInt, result); } return result; } MiscBigIntegerGenerators(BigInteger modulus); protected  MiscBigIntegerGenerators(BigInteger modulus, HashMap<Integer, BigInteger[]> coefficientsOfPolynomiums); BigInteger[] getPoly(int l); List<BigInteger> getTwoPowersList(int length); BigInteger[] getExpFromOInt(BigInteger value, int maxBitSize);  }
@Test public void getPolyResultNotNull() { HashMap<Integer, BigInteger[]> mockMap = new HashMap<>(); BigInteger[] mockEntry = new BigInteger[] {}; mockMap.put(2, mockEntry); MiscBigIntegerGenerators generators = new MiscBigIntegerGenerators(BigInteger.valueOf(5), mockMap); Assert.assertArrayEquals(mockEntry, generators.getPoly(2)); }