RandomGenerator implements ByteGenerator { @Override public byte[] getRandomBytes(int numBytes) { byte[] randomBytes = new byte[numBytes]; random.nextBytes(randomBytes); return randomBytes; } RandomGenerator(); @Override byte[] getRandomBytes(int numBytes);  }
@Test public void shouldGeneratorOneRandomByte() { RandomGenerator randomGenerator = new RandomGenerator(); byte[] randomBytes = randomGenerator.getRandomBytes(1); Assert.assertNotNull(randomBytes); Assert.assertEquals(randomBytes.length, 1); }
@Test public void shouldGeneratorFourRandomBytes() { RandomGenerator randomGenerator = new RandomGenerator(); byte[] randomBytes = randomGenerator.getRandomBytes(4); Assert.assertNotNull(randomBytes); Assert.assertEquals(randomBytes.length, 4); }