Exemplo n.º 1
0
  /**
   * Parameterized test case to check the message text for the specified number of warnings and
   * analyses.
   *
   * @param numberOfWarnings the number of warnings
   * @param numberOfanalyses the number of analyses
   * @param expectedMessage the expected message
   */
  private void checkSummaryText(
      final int numberOfWarnings, final int numberOfanalyses, final String expectedMessage) {
    PmdResult result = mock(PmdResult.class);
    when(result.getNumberOfAnnotations()).thenReturn(numberOfWarnings);
    when(result.getNumberOfModules()).thenReturn(numberOfanalyses);

    Assert.assertEquals(
        "Wrong summary message created.", expectedMessage, ResultSummary.createSummary(result));
  }
  /**
   * Parameterized test case to check the message text for the specified number of warnings and
   * files.
   *
   * @param numberOfWarnings the number of warnings
   * @param numberOfFiles the number of files
   * @param expectedMessage the expected message
   */
  private void checkSummaryText(
      final int numberOfWarnings, final int numberOfFiles, final String expectedMessage) {
    DryResult result = mock(DryResult.class);
    when(result.getNumberOfAnnotations()).thenReturn(numberOfWarnings);
    when(result.getNumberOfModules()).thenReturn(numberOfFiles);

    Assert.assertEquals(
        "Wrong summary message created.",
        Messages.DRY_ProjectAction_Name() + expectedMessage,
        ResultSummary.createSummary(result));
  }
  /**
   * Parameterized test case to check the message text for the specified number of warnings and
   * files.
   *
   * @param numberOfFixedWarnings the number of fixed warnings
   * @param numberOfNewWarnings the number of new warnings
   * @param expectedMessage the expected message
   */
  private void checkDeltaText(
      final int numberOfFixedWarnings,
      final int numberOfNewWarnings,
      final String expectedMessage) {
    DryResult result = mock(DryResult.class);
    when(result.getNumberOfFixedWarnings()).thenReturn(numberOfFixedWarnings);
    when(result.getNumberOfNewWarnings()).thenReturn(numberOfNewWarnings);

    Assert.assertEquals(
        "Wrong delta message created.", expectedMessage, ResultSummary.createDeltaMessage(result));
  }