@Test
 public void platformResources() throws Exception {
   BuildTarget target = BuildTargetFactory.newInstance("//foo:lib");
   SourcePath matchedSource = new FakeSourcePath("foo/a.dat");
   SourcePath unmatchedSource = new FakeSourcePath("foo/b.dat");
   PythonLibrary library =
       (PythonLibrary)
           new PythonLibraryBuilder(target)
               .setPlatformResources(
                   PatternMatchedCollection.<SourceList>builder()
                       .add(
                           Pattern.compile(PythonTestUtils.PYTHON_PLATFORM.getFlavor().toString()),
                           SourceList.ofUnnamedSources(ImmutableSortedSet.of(matchedSource)))
                       .add(
                           Pattern.compile("won't match anything"),
                           SourceList.ofUnnamedSources(ImmutableSortedSet.of(unmatchedSource)))
                       .build())
               .build(
                   new BuildRuleResolver(
                       TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer()));
   assertThat(
       library.getResources(PythonTestUtils.PYTHON_PLATFORM).values(),
       Matchers.contains(matchedSource));
 }