### Question:
MavenReleaseVersionValidator implements MavenVersionValidator { @Override public void validate(Repository repository, ArtifactCoordinates coordinates) throws VersionValidationException { String version = coordinates.getVersion(); if (isRelease(version) && !repository.acceptsReleases()) { throw new VersionValidationException("Cannot deploy a release artifact to a repository with a SNAPSHOT policy!"); } if (!isRelease(version) && repository.acceptsReleases() && !repository.acceptsSnapshots()) { throw new VersionValidationException("Cannot deploy a SNAPSHOT artifact to a repository with a release policy!"); } }  @PostConstruct @Override void register(); @Override String getAlias(); @Override String getDescription(); @Override boolean supports(Repository repository); @Override void validate(Repository repository,
                         ArtifactCoordinates coordinates); static final String ALIAS; static final String DESCRIPTION; }### Answer:
@ExtendWith({ RepositoryManagementTestExecutionListener.class, ArtifactManagementTestExecutionListener.class }) @Test public void testReleaseValidation(@MavenRepository(repositoryId = MRVV_RELEASES) Repository repository, @MavenTestArtifact(repositoryId = MRVV_RELEASES, id = GROUP_ID + ":" + ARTIFACT_ID, versions = { "1", "1.0" }) List<Path> validArtifactPaths) throws VersionValidationException, IOException { for (Path validArtifactPath : validArtifactPaths) { RepositoryPath repositoryPath = (RepositoryPath) validArtifactPath.normalize(); ArtifactCoordinates coordinates = RepositoryFiles.readCoordinates(repositoryPath); validator.validate(repository, coordinates); } }
@ExtendWith({ RepositoryManagementTestExecutionListener.class, ArtifactManagementTestExecutionListener.class }) @Test public void testInvalidArtifacts(@MavenRepository(repositoryId = MRVV_RELEASES) Repository repository, @MavenTestArtifact(repositoryId = MRVV_RELEASES, id = GROUP_ID + ":" + ARTIFACT_ID, versions = { "1.0-SNAPSHOT", "1.0-20131004.115330-1" }) List<Path> invalidArtifactPaths) throws IOException { for (Path invalidArtifactPath : invalidArtifactPaths) { RepositoryPath repositoryPath = (RepositoryPath) invalidArtifactPath.normalize(); ArtifactCoordinates coordinates = RepositoryFiles.readCoordinates(repositoryPath); try { validator.validate(repository, coordinates); fail("Incorrectly validated artifact with version " + coordinates.getVersion()); } catch (VersionValidationException e) { } } }