BcDESKeyGenerator extends DefaultKeyGenerator { @Override public byte[] generate() { return generate(new GenericKeyGenerationParameters(7)); }  @Override byte[] generate();  }
@Test void generateWithoutArgument() { byte[] key = generator.generate(); assertThat(key.length, equalTo(8)); assertThat(key, not(equalTo(generator.generate()))); }
@Test void generateWithStrengthParameter() { KeyGenerationParameters params = new GenericKeyGenerationParameters(7); byte[] key = generator.generate(params); assertThat(key.length, equalTo(8)); assertThat(key, not(equalTo(generator.generate(params)))); assertThat(generator.generate(new GenericKeyGenerationParameters(8)).length, equalTo(8)); }