ApiKeyRepositoryWrapper implements ApiKeyRepository { @Override public Set<ApiKey> findByPlan(String plan) throws TechnicalException { throw new IllegalStateException(); } ApiKeyRepositoryWrapper(ApiKeyRepository wrapped, Ehcache cache); @Override Optional<ApiKey> findById(String apiKey); @Override ApiKey create(ApiKey apiKey); @Override Set<ApiKey> findBySubscription(String subscription); @Override Set<ApiKey> findByPlan(String plan); @Override List<ApiKey> findByCriteria(ApiKeyCriteria filter); @Override ApiKey update(ApiKey apiKey);  }
@Test(expected = IllegalStateException.class) public void shouldFindByPlanThrowsException() throws TechnicalException { repository.findByPlan(null); }