-
Notifications
You must be signed in to change notification settings - Fork 0
The MockSoql.AggregateResult Class
Jason Siders edited this page Jul 4, 2025
·
4 revisions
A constructable version of the Soql.AggregateResult class, which wraps the Schema.AggregateResult class and its methods. Schema.AggregateResult objects cannot be directly constructed, serialized, or otherwise mocked.
You can use this object along in conjunction with existing mocking methods to inject these results in queries. For example:
DatabaseLayer.useMocks();
MockSoql.AggregateResult agg = new MockSoql.AggregateResult()?.addParameter('numRecords', 100);
MockSoql?.setGlobalMock()?.withResults(new List<MockSoql.AggregateResult>{ agg });
List<Soql.AggregateResult> results = soql?.aggregateQuery();Adds a column to the current AggregateResult. These can be created with or without an alias. If an alias isn't provided, the column is assigned a default alias, ex. expr0'. This mirrors the behavior of the underlying Schema.AggregateResult object.
MockSoql.AggregateResult addParameter(String alias, Object value)MockSoql.AggregateResult addParameter(Object value)
- Generating Test Records
- Dml
- Soql
- Cmdt
- Plugins
- DatabaseLayer
- Dml
- MockDml
- MockRecord
- Cmdt
- MockCmdt
- MockSoql
-
Soql
- Soql.AggregateResult
- Soql.Aggregation
- Soql.Binder
- Soql.Builder
- Soql.Condition
- Soql.ConditionalLogic
- Soql.Criteria
- Soql.Cursor
- Soql.Function
- Soql.InnerQuery
- Soql.InvalidParameterValueException
- Soql.LogicType
- Soql.NullOrder
- Soql.Operation
- Soql.Operator
- Soql.ParentField
- Soql.PreAndPostProcessor
- Soql.QueryLocator
- Soql.Request
- Soql.Scope
- Soql.Selectable
- Soql.SortDirection
- Soql.SortOrder
- Soql.Subquery
- Soql.TypeOf
- Soql.Usage
- Soql.WhenClause