---
schema_version: "1"
id: 515dc0ccf99f53d7c48b8f012db02beb4f1e7e8f97676f6754d5884675d116fe
title: RTRReportResult.MockScoreCard
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/MockScoreCard_class.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/MockScoreCard_class.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6417758514a9b7b125761c84952ad6e4c8623eda26a82e3565aacfe57939e534
description: This class is used to create mock responses for the unit test execution.
---
# RTRReportResult.MockScoreCard

This class is used to create mock responses for the unit test execution.

The RTRReportResult.MockScoreCard class extends RTRReportResult.ScoreCard.

The supported modifiers are global and virtual.

## Namespace

cgcloud

## Supported Methods

<table class="featureTable sort_table" summary="">
          <caption><span class="tablecap">Table 1. RTRReportResult.MockScoreCard Supported Methods</span></caption>



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d35804e86">Method signature</th>

              <th class="featureTableHeader  " id="d35804e89">Description</th>

              <th class="featureTableHeader  " id="d35804e92">Version</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d35804e86" data-title="Method signature"><samp class="codeph nolang">RTRReportResult.MockScoreCard​(Map&lt;String,
                  Decimal&gt; kpiValues)</samp></td>

              <td class="entry" headers="d35804e89" data-title="Description">The constructor for creating mock responses for the unit test execution.
                <p class="p"><span class="keyword parmname">kpiValues</span>: Map&lt;String, Decimal&gt;&nbsp;. A map of a KPI name to a
                  decimal value.</p>

                <p class="p">The mocked value is returned when the <samp class="codeph nolang">getValue</samp>
                  method is executed.</p>

              </td>

              <td class="entry" headers="d35804e92" data-title="Version">60.0</td>

            </tr>

          </tbody>

        </table>

## Example Implementation

To unit test a scorecard component, mock the scorecard values using the MockScoreCard class.

@IsTest
  public static void myTestMethod() {
    // Setup

    // Setup your required data for the test

    // Expected RTR Report Filters
    Map<String, Object> expectedReportFilters = ...

    // Create a mock RTRReportResult
    cgcloud.RTRReportResult.MockRTRReportResult mockReportResult = new cgcloud.RTRReportResult.MockRTRReportResult(
      // Create a map with the returned report components
      new Map<String, cgcloud.RTRReportResult.ReportComponent>{
        // Flatlist component
        'ScoreCard' => new cgcloud.RTRReportResult.MockScoreCard(
          // For KPI, set the values
          new Map<String, Object>{ 'KPI1' => 123, 'KPI2' => 456 }
        )
      }
    );

    // Set the mock in RTRReportResult.execute so the call to this method
    // returns our mock response
    cgcloud.RTRReportResult.setMock(new List<Object>{ mockReportResult });

    // Test

    // Run your code to be tested. RTRReportResult.execute call will
    // return the mock result

    // Assert

    // Assert your code is working as expected.

    // You can also validate RTRReportResult.execute was called with the expected
    // parameters
    system.assertEquals('0001', mockReportResult.getSalesOrg());
    system.assertEquals('MySampleReport', mockReportResult.getReportName());
    system.assertEquals(expectedReportFilters, mockReportResult.getFilters());
  }