コード例 #1
0
 @Override
 protected List<ContentLinkResolver> create() throws Exception {
   final List<ContentLinkResolverDescriptor> descriptors =
       Lists.newArrayList(
           accessor.getEnabledModuleDescriptorsByClass(
               ContentLinkResolverDescriptor.class));
   Collections.sort(descriptors, ModuleDescriptorComparator.COMPARATOR);
   return ImmutableList.copyOf(
       Collections2.transform(
           descriptors,
           new Function<ContentLinkResolverDescriptor, ContentLinkResolver>() {
             @Override
             public ContentLinkResolver apply(
                 @Nullable ContentLinkResolverDescriptor from) {
               return from.getModule();
             }
           }));
 }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    Mockito.when(defaultRenderer.isDefaultHandler()).thenReturn(true);
    Mockito.when(badDescriptorRenderer.isDefaultHandler())
        .thenThrow(new RuntimeException("Misbehaving plugin exception"));

    Mockito.when(goodDescriptorRenderer.handlesApplicationType("application")).thenReturn(true);
    Mockito.when(badDescriptorRenderer.handlesApplicationType(Mockito.anyString()))
        .thenThrow(new RuntimeException("Misbehaving plugin exception"));

    Mockito.when(
            pluginAccessor.getEnabledModuleDescriptorsByClass(
                IssueLinkRendererModuleDescriptor.class))
        .thenReturn(
            ImmutableList.of(badDescriptorRenderer, goodDescriptorRenderer, defaultRenderer));

    Mockito.when(goodDescriptorRenderer.getModule()).thenReturn(renderer);
  }