Package org.sonar.api.component

Examples of org.sonar.api.component.ResourcePerspectives


    when(issuable.newIssueBuilder()).thenReturn(issueBuilder);
    return issuable;
  }

  public static ResourcePerspectives mockPerspectives(Issuable issuable) {
    ResourcePerspectives perspectives = mock(ResourcePerspectives.class);
    when(perspectives.as((Class) anyObject(), (Resource) anyObject())).thenReturn(issuable);
    return perspectives;
  }
View Full Code Here


    when(context.getResource()).thenReturn(resource);
    when(context.getProject()).thenReturn(project);
    when(context.getMeasure(CoreMetrics.NEW_VIOLATIONS)).thenReturn(null);

    issuable = mock(Issuable.class);
    ResourcePerspectives perspectives = mock(ResourcePerspectives.class);
    when(perspectives.as(Issuable.class, resource)).thenReturn(issuable);
    decorator = new CountUnresolvedIssuesDecorator(perspectives, ruleFinder, timeMachineConfiguration);
  }
View Full Code Here

    verify(context).saveMeasure(CoreMetrics.VIOLATIONS, 4.0);
  }

  @Test
  public void should_do_nothing_when_issuable_is_null() {
    ResourcePerspectives perspectives = mock(ResourcePerspectives.class);
    when(perspectives.as(Issuable.class, resource)).thenReturn(null);
    CountUnresolvedIssuesDecorator decorator = new CountUnresolvedIssuesDecorator(perspectives, ruleFinder, timeMachineConfiguration);

    decorator.decorate(resource, context);

    verifyZeroInteractions(context);
View Full Code Here

  @Before
  public void setup() {
    Settings settings = new Settings();
    settings.setProperty(CoreProperties.HOURS_IN_DAY, HOURS_IN_DAY);

    ResourcePerspectives perspectives = mock(ResourcePerspectives.class);
    when(perspectives.as(Issuable.class, resource)).thenReturn(issuable);

    rightNow = new Date();
    elevenDaysAgo = DateUtils.addDays(rightNow, -11);
    tenDaysAgo = DateUtils.addDays(rightNow, -10);
    nineDaysAgo = DateUtils.addDays(rightNow, -9);
View Full Code Here

TOP

Related Classes of org.sonar.api.component.ResourcePerspectives

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.