コード例 #1
0
  /**
   * 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));
  }
コード例 #2
0
  /**
   * 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));
  }