### Question:
AppcacheLinker extends AbstractLinker { @Nonnull final EmittedArtifact createPermutationMap( @Nonnull final TreeLogger logger, @Nonnull final Collection<PermutationArtifact> artifacts ) throws UnableToCompleteException { try { final String string = PermutationsIO.serialize( collectPermutationSelectors( logger, artifacts ) ); return emitString( logger, string, PermutationsIO.PERMUTATIONS_DESCRIPTOR_FILE_NAME ); } catch ( final Exception e ) { logger.log( Type.ERROR, "can not build manifest map", e ); throw new UnableToCompleteException(); } }  @Override String getDescription(); @Override ArtifactSet link( @Nonnull final TreeLogger logger,
                           @Nonnull final LinkerContext context,
                           @Nonnull final ArtifactSet artifacts,
                           final boolean onePermutation );  }### Answer:
@Test public void createPermutationMap() throws UnableToCompleteException, IOException { final AppcacheLinker linker = new AppcacheLinker(); final ArrayList<PermutationArtifact> artifacts1 = new ArrayList<>(); final Permutation permutation = new Permutation( "X" ); artifacts1.add( new PermutationArtifact( AppcacheLinker.class, permutation ) ); final List<BindingProperty> configs2 = new ArrayList<>(); bp( configs2, "user.agent", "ie9" ); permutation.getSelectors().add( new SelectionDescriptor( "X", configs2 ) ); final LinkerContext linkerContext = mock( LinkerContext.class ); when( linkerContext.getModuleName() ).thenReturn( "myapp" ); final EmittedArtifact artifacts = linker.createPermutationMap( TreeLogger.NULL, artifacts1 ); assertEquals( artifacts.getVisibility(), Visibility.Public ); assertEquals( artifacts.getPartialPath(), "permutations.xml" ); assertTrue( ( artifacts.getLastModified() - System.currentTimeMillis() < 1000L ) ); final String content = toContents( artifacts ); assertEquals( content, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" + "<permutations>\n" + "<permutation name=\"X\">\n" + "<user.agent>ie9</user.agent>\n" + "</permutation>\n" + "</permutations>\n" ); }