AbstractRepositoryMetadataResolver implements RepositoryMetadataResolver { @Override public final RepositoryMetadata resolve(Class<?> repositoryInterface) { if (repositoryInterface == null) { throw new RepositoryDefinitionException(null, "Repository interface must not be null"); } if (!Modifier.isInterface(repositoryInterface.getModifiers())) { throw new RepositoryDefinitionException(repositoryInterface, "Cannot resolve repository metadata for a class object that isn't" + " an interface"); } if (!Modifier.isPublic(repositoryInterface.getModifiers())) { throw new RepositoryDefinitionException(repositoryInterface, "Repository interface needs to be declared as public"); } return resolveFromInterface(repositoryInterface); } protected  AbstractRepositoryMetadataResolver(); @Override final RepositoryMetadata resolve(Class<?> repositoryInterface);  }
@Test(expectedExceptions = RepositoryDefinitionException.class, expectedExceptionsMessageRegExp = ".*?: Repository interface must not be null") public void testThatItDoesNotAcceptNull() { new NullReturningRepositoryMetadataResolver().resolve(null); }
@Test(expectedExceptions = RepositoryDefinitionException.class, expectedExceptionsMessageRegExp = ".*?: Cannot resolve repository metadata for a class object that isn't an" + " interface") public void testThatItOnlyAcceptsInterfaces() { new NullReturningRepositoryMetadataResolver().resolve(EmptyEntity.class); }
@Test(expectedExceptions = RepositoryDefinitionException.class, expectedExceptionsMessageRegExp = ".*?: Repository interface needs to be declared as public") public void testThatItOnlyAcceptsPublicInterfaces() { new NullReturningRepositoryMetadataResolver().resolve(SamplePrivateInterface.class); }
@Test public void testThatItPassesAPublicInterfaceToTheSubClass() { final NullReturningRepositoryMetadataResolver resolver = new NullReturningRepositoryMetadataResolver(); resolver.resolve(Repository.class); assertThat(resolver.getRepositoryInterface(), equalTo((Class) Repository.class)); }