RepositoryMockBuilder implements Start, ImplementationAnd, KeyGeneration { @Override public <S> Implementation generateKeysUsing(KeyGenerator<S> keyGenerator) { return new RepositoryMockBuilder(factory, implementations, keyGenerator); } RepositoryMockBuilder(); private  RepositoryMockBuilder(RepositoryFactory factory, List<Class<?>> implementations,
                                  KeyGenerator<?> keyGenerator); @Override KeyGeneration useConfiguration(RepositoryFactoryConfiguration configuration); @Override KeyGeneration useFactory(RepositoryFactory factory); @Override ImplementationAnd usingImplementation(Class<?> implementation); @Override ImplementationAnd and(Class<?> implementation); @Override Implementation generateKeysUsing(KeyGenerator<S> keyGenerator); @Override Implementation generateKeysUsing(Class<G> generatorType); @Override Implementation withoutGeneratingKeys(); @Override E mock(Class<E> repositoryInterface);  }
@Test(expectedExceptions = MockBuilderException.class) public void testUsingInvalidKeyGenerator() { new RepositoryMockBuilder().generateKeysUsing(InaccessibleKeyGenerator.class); }