Package powermock.examples.bypassencapsulation.nontest

Examples of powermock.examples.bypassencapsulation.nontest.Report


  @Injectable
  private Cache cache;

  public void deleteReport(final String reportName) {
    Report report = getReportFromTargetName(reportName);
    cache.invalidateCache(report);
    // Imagine that we delete the report from some persistence storage.
  }
View Full Code Here


    final String reportId = "id";
    expect(reportTemplateServiceMock.getTemplateId(reportId)).andReturn("templateId");

    replay(reportTemplateServiceMock);

    Report actualReport = tested.generateReport(reportId);

    verify(reportTemplateServiceMock);

    assertEquals(new Report("name"), actualReport);
  }
View Full Code Here

    final String reportId = "id";
    expect(reportTemplateServiceMock.getTemplateId(reportId)).andReturn("templateId");

    replay(reportTemplateServiceMock);

    Report actualReport = tested.generateReport(reportId);

    verify(reportTemplateServiceMock);

    assertEquals(new Report("name"), actualReport);
  }
View Full Code Here

  @Test
  public void testDeleteReport() throws Exception {
    final String getReportFromTargetNameMethodName = "getReportFromTargetName";
    final String reportName = "reportName";
    final Report report = new Report(reportName);

    // Mock only the modifyData method
    ReportDao tested = createPartialMock(ReportDao.class, getReportFromTargetNameMethodName);

    // Create a mock of the distributed cache.
View Full Code Here

  @Test
  public void testDeleteReport_usingPowerMock1Features() throws Exception {
    final String getReportFromTargetNameMethodName = "getReportFromTargetName";
    final String reportName = "reportName";
    final Report report = new Report(reportName);

    // Mock only the modifyData method
    ReportDao tested = createPartialMock(ReportDao.class, getReportFromTargetNameMethodName);

    // Create a mock of the distributed cache.
View Full Code Here

    String templateId = reportTemplateService.getTemplateId(reportId);
    /*
     * Imagine some other code here that generates the report based on the
     * template id.
     */
    return new Report("name");
  }
View Full Code Here

TOP

Related Classes of powermock.examples.bypassencapsulation.nontest.Report

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.