Skip to content

Commit

Permalink
Add SObjectNotNullTest, improve ModifySObjectTest test, replace isPar…
Browse files Browse the repository at this point in the history
…allel with IsParallel
  • Loading branch information
ipavlic committed Jul 5, 2024
1 parent 03b4630 commit 3f5172d
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class DecimalCollectionTest {
@IsTest
private static void sumShouldReturnSumIfItExists() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class DoubleCollectionTest {
@IsTest
private static void sumShouldReturnSumIfItExists() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class SObjectCollectionTest {

static Id firstUserId = TestUtility.getFakeId(User.SObjectType);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class MapToObjectTest {

private class MappingTarget {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
public with sharing class MapToSObjectTest {

@IsTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class ModifySObjectTest {

@IsTest
private static void stringDefinedFieldIsUsed() {
Opportunity opp = new Opportunity();
new ModifySObject().setField('Amount', 1000).call(opp);
System.Assert.areEqual(1000, opp.Amount);
}

@IsTest
private static void fieldTokenDefinedFieldIsUsed() {
Opportunity opp = new Opportunity();
new ModifySObject().setField(Opportunity.Amount, 1000).call(opp);
System.Assert.areEqual(1000, opp.Amount);
}

@IsTest
private static void fieldTokenDefinedFieldAreUsed() {
Opportunity opp = new Opportunity();
new ModifySObject().setFields(new Map<SObjectField, Object>{
Opportunity.Name => 'Test',
Opportunity.Amount => 1000
}).call(opp);
System.Assert.areEqual(1000, opp.Amount);
System.Assert.areEqual('Test', opp.Name);
}

@IsTest
private static void definedFieldsAreUsed() {
private static void prototypeDefinedFieldsAreUsed() {
Opportunity opp = new Opportunity();
new ModifySObject().setFields(new Opportunity(Amount = 1000, Name = 'Test')).call(opp);
System.Assert.areEqual(1000, opp.Amount);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@IsTest(IsParallel=true)
private class SObjectNotNullTest {
@IsTest
private static void nullSObjectReturnsFalse() {
Assert.areEqual(false, new SObjectNotNull().call(null));
}

@IsTest
private static void nonNullSObjectReturnsTrue() {
Assert.areEqual(true, new SObjectNotNull().call(new Opportunity()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class SObjectStreamTest {
@IsTest
private static void testFilter() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class OptionalDecimalTest {
@IsTest
private static void optionalCanBeNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class OptionalDoubleTest {
@IsTest
private static void optionalCanBeNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class OptionalSObjectTest {
@IsTest
private static void optionalCanBeNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class PrimitiveComparerTest {
@IsTest
private static void nullComparison() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@IsTest(isParallel=true)
@IsTest(IsParallel=true)
private class SObjectFieldReaderTest {
@IsTest
private static void testResolving() {
Expand Down

0 comments on commit 3f5172d

Please sign in to comment.