ProductArchiverMojo extends AbstractProductMojo { static String getArtifactClassifier(Product product, TargetEnvironment environment) { final String artifactClassifier; if (product.getAttachId() == null) { artifactClassifier = getOsWsArch(environment, '.'); } else { artifactClassifier = product.getAttachId() + "-" + getOsWsArch(environment, '.'); } return artifactClassifier; } ProductArchiverMojo(); @Override void execute();  }
@Test public void testGetArtifactClassifier() { TargetEnvironment env = new TargetEnvironment("os", "ws", "arch"); Product product = new Product("product.id"); String classifier = ProductArchiverMojo.getArtifactClassifier(product, env); assertEquals("os.ws.arch", classifier); }
@Test public void testGetArtifactClassifierWithAttachId() { TargetEnvironment env = new TargetEnvironment("os", "ws", "arch"); Product product = new Product("product.id", "attachId"); String classifier = ProductArchiverMojo.getArtifactClassifier(product, env); assertEquals("attachId-os.ws.arch", classifier); }