diff --git a/README.md b/README.md index 7de6ee1..1826031 100644 --- a/README.md +++ b/README.md @@ -573,7 +573,7 @@ Argument.ofType(CustomType.class); Use the `Argument.Matchable` interface and then use it with `Argument` APIs ```java -@isTest +@IsTest public class MyMatchable implements Argument.Matchable { public Boolean matches(Object callArgument) { boolean matches = false; diff --git a/apex-ruleset.xml b/apex-ruleset.xml index 14aa9b9..603f58b 100644 --- a/apex-ruleset.xml +++ b/apex-ruleset.xml @@ -8,12 +8,12 @@ Custom Ruleset to use with Apex PMD - + 2 3 diff --git a/force-app/recipes/classes/ApexMockeryOverview.cls b/force-app/recipes/classes/ApexMockeryOverview.cls index 3fccee2..5633f00 100644 --- a/force-app/recipes/classes/ApexMockeryOverview.cls +++ b/force-app/recipes/classes/ApexMockeryOverview.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ApexMockeryOverview { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/OperaPastryMatchable.cls b/force-app/recipes/classes/OperaPastryMatchable.cls index 4bbf141..e905021 100644 --- a/force-app/recipes/classes/OperaPastryMatchable.cls +++ b/force-app/recipes/classes/OperaPastryMatchable.cls @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest public class OperaPastryMatchable implements Argument.Matchable { public Boolean matches(Object callArgument) { Pastry p = (Pastry) callArgument; diff --git a/force-app/recipes/classes/asserting/HasBeenCalled.cls b/force-app/recipes/classes/asserting/HasBeenCalled.cls index 4ca3ebc..2177b20 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalled.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalled.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalled { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenCalledTimes.cls b/force-app/recipes/classes/asserting/HasBeenCalledTimes.cls index a6e2fb6..80fa456 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalledTimes.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalledTimes.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalledTimes { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenCalledWith.cls b/force-app/recipes/classes/asserting/HasBeenCalledWith.cls index 823f67c..36c41a2 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalledWith.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalledWith.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalledWith { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenCalledWithCustomMatchable.cls b/force-app/recipes/classes/asserting/HasBeenCalledWithCustomMatchable.cls index 037ce8d..f08add7 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalledWithCustomMatchable.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalledWithCustomMatchable.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalledWithCustomMatchable { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenCalledWithJSONMatchable.cls b/force-app/recipes/classes/asserting/HasBeenCalledWithJSONMatchable.cls index 13323ae..1ce0a78 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalledWithJSONMatchable.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalledWithJSONMatchable.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalledWithJSONMatchable { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenCalledWithTypeMatchable.cls b/force-app/recipes/classes/asserting/HasBeenCalledWithTypeMatchable.cls index 7b404a5..6d46f47 100644 --- a/force-app/recipes/classes/asserting/HasBeenCalledWithTypeMatchable.cls +++ b/force-app/recipes/classes/asserting/HasBeenCalledWithTypeMatchable.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenCalledWithTypeMatchable { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasBeenLastCalledWith.cls b/force-app/recipes/classes/asserting/HasBeenLastCalledWith.cls index 7bd5f0b..958fb17 100644 --- a/force-app/recipes/classes/asserting/HasBeenLastCalledWith.cls +++ b/force-app/recipes/classes/asserting/HasBeenLastCalledWith.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasBeenLastCalledWith { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/asserting/HasNotBeenCalled.cls b/force-app/recipes/classes/asserting/HasNotBeenCalled.cls index 4c0df4f..5dbe6de 100644 --- a/force-app/recipes/classes/asserting/HasNotBeenCalled.cls +++ b/force-app/recipes/classes/asserting/HasNotBeenCalled.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class HasNotBeenCalled { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/Behave.cls b/force-app/recipes/classes/mocking/Behave.cls index c663cc8..3b7099f 100644 --- a/force-app/recipes/classes/mocking/Behave.cls +++ b/force-app/recipes/classes/mocking/Behave.cls @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class Behave { class MockImpl implements MethodSpy.SpyBehavior { public Object execute(final List params) { @@ -12,7 +12,7 @@ private class Behave { } } - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/BehaveOnce.cls b/force-app/recipes/classes/mocking/BehaveOnce.cls index 5e07a47..5464b64 100644 --- a/force-app/recipes/classes/mocking/BehaveOnce.cls +++ b/force-app/recipes/classes/mocking/BehaveOnce.cls @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class BehaveOnce { class MockImpl implements MethodSpy.SpyBehavior { public Object execute(final List params) { @@ -12,7 +12,7 @@ private class BehaveOnce { } } - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/NoConfiguration.cls b/force-app/recipes/classes/mocking/NoConfiguration.cls index 0f50e80..46ccfa4 100644 --- a/force-app/recipes/classes/mocking/NoConfiguration.cls +++ b/force-app/recipes/classes/mocking/NoConfiguration.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class NoConfiguration { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/Returns.cls b/force-app/recipes/classes/mocking/Returns.cls index d4a4201..5492cf7 100644 --- a/force-app/recipes/classes/mocking/Returns.cls +++ b/force-app/recipes/classes/mocking/Returns.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class Returns { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/ReturnsOnce.cls b/force-app/recipes/classes/mocking/ReturnsOnce.cls index f1fc936..a7bc35a 100644 --- a/force-app/recipes/classes/mocking/ReturnsOnce.cls +++ b/force-app/recipes/classes/mocking/ReturnsOnce.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ReturnsOnce { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/ReturnsThenThrows.cls b/force-app/recipes/classes/mocking/ReturnsThenThrows.cls index f0cb26b..292cc8b 100644 --- a/force-app/recipes/classes/mocking/ReturnsThenThrows.cls +++ b/force-app/recipes/classes/mocking/ReturnsThenThrows.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ReturnsThenThrows { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/Throws.cls b/force-app/recipes/classes/mocking/Throws.cls index aba9418..97d36c8 100644 --- a/force-app/recipes/classes/mocking/Throws.cls +++ b/force-app/recipes/classes/mocking/Throws.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class Throws { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/ThrowsOnce.cls b/force-app/recipes/classes/mocking/ThrowsOnce.cls index fd9ec00..896beec 100644 --- a/force-app/recipes/classes/mocking/ThrowsOnce.cls +++ b/force-app/recipes/classes/mocking/ThrowsOnce.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ThrowsOnce { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/ThrowsThenReturns.cls b/force-app/recipes/classes/mocking/ThrowsThenReturns.cls index 32c0ba1..fa14180 100644 --- a/force-app/recipes/classes/mocking/ThrowsThenReturns.cls +++ b/force-app/recipes/classes/mocking/ThrowsThenReturns.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ThrowsThenReturns { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithCustomMatchable_ThenReturn.cls b/force-app/recipes/classes/mocking/WhenCalledWithCustomMatchable_ThenReturn.cls index 1e9c384..e3b3d5e 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithCustomMatchable_ThenReturn.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithCustomMatchable_ThenReturn.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithCustomMatchable_ThenReturn { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithEqualMatching_ThenReturn.cls b/force-app/recipes/classes/mocking/WhenCalledWithEqualMatching_ThenReturn.cls index 12ed46a..6b5c239 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithEqualMatching_ThenReturn.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithEqualMatching_ThenReturn.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithEqualMatching_ThenReturn { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithJSONMatching_ThenReturn.cls b/force-app/recipes/classes/mocking/WhenCalledWithJSONMatching_ThenReturn.cls index 66fc564..714b9d2 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithJSONMatching_ThenReturn.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithJSONMatching_ThenReturn.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithJSONMatching_ThenReturn { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithMatchingThrowsAndReturns.cls b/force-app/recipes/classes/mocking/WhenCalledWithMatchingThrowsAndReturns.cls index 2ea327d..a7e502e 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithMatchingThrowsAndReturns.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithMatchingThrowsAndReturns.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithMatchingThrowsAndReturns { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithNotMatchingAndReturn.cls b/force-app/recipes/classes/mocking/WhenCalledWithNotMatchingAndReturn.cls index 3a377e9..a036097 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithNotMatchingAndReturn.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithNotMatchingAndReturn.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithNotMatchingAndReturn { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithTypeMatching_ThenReturn.cls b/force-app/recipes/classes/mocking/WhenCalledWithTypeMatching_ThenReturn.cls index 21cd3b1..e7d565f 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithTypeMatching_ThenReturn.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithTypeMatching_ThenReturn.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithTypeMatching_ThenReturn { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWith_ThenBehave.cls b/force-app/recipes/classes/mocking/WhenCalledWith_ThenBehave.cls index c9a5ad7..70520df 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWith_ThenBehave.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWith_ThenBehave.cls @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWith_ThenBehave { class MockImpl implements MethodSpy.SpyBehavior { public Object execute(final List params) { @@ -12,7 +12,7 @@ private class WhenCalledWith_ThenBehave { } } - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWith_ThenReturnOnce.cls b/force-app/recipes/classes/mocking/WhenCalledWith_ThenReturnOnce.cls index 112cf7f..4fee7e2 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWith_ThenReturnOnce.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWith_ThenReturnOnce.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWith_ThenReturnOnce { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrow.cls b/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrow.cls index c67cf8e..09c8504 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrow.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrow.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWith_ThenThrow { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrowOnce.cls b/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrowOnce.cls index 8ea5046..e77175d 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrowOnce.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWith_ThenThrowOnce.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWith_ThenThrowOnce { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/recipes/classes/mocking/WhenCalledWithoutMatchingConfiguration.cls b/force-app/recipes/classes/mocking/WhenCalledWithoutMatchingConfiguration.cls index 5af9b04..e56b17e 100644 --- a/force-app/recipes/classes/mocking/WhenCalledWithoutMatchingConfiguration.cls +++ b/force-app/recipes/classes/mocking/WhenCalledWithoutMatchingConfiguration.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class WhenCalledWithoutMatchingConfiguration { - @isTest + @IsTest static void recipe() { // Arrange Mock deliveryServiceMock = Mock.forType(DeliveryService.class); diff --git a/force-app/src/classes/Mock.cls b/force-app/src/classes/Mock.cls index bc4ad7b..ca518e2 100644 --- a/force-app/src/classes/Mock.cls +++ b/force-app/src/classes/Mock.cls @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest global class Mock implements System.StubProvider { global Object stub { get; set; } private Map spies = new Map(); diff --git a/force-app/test/namespace/classes/ApexMockeryOverview.cls b/force-app/test/namespace/classes/ApexMockeryOverview.cls index c496c6d..431dddf 100644 --- a/force-app/test/namespace/classes/ApexMockeryOverview.cls +++ b/force-app/test/namespace/classes/ApexMockeryOverview.cls @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ -@isTest +@IsTest private class ApexMockeryOverview { - @isTest + @IsTest static void recipe() { // Arrange mockery.Mock deliveryServiceMock = mockery.Mock.forType(DeliveryService.class, new StubBuilderImpl()); diff --git a/force-app/test/package/classes/functional/BusinessService.cls b/force-app/test/package/classes/functional/BusinessService.cls index 9ec1dfa..c2c92a5 100644 --- a/force-app/test/package/classes/functional/BusinessService.cls +++ b/force-app/test/package/classes/functional/BusinessService.cls @@ -1,4 +1,4 @@ -@isTest +@IsTest public class BusinessService { DMLDelegate dmlDelegate; diff --git a/force-app/test/package/classes/functional/FunctionalTest.cls b/force-app/test/package/classes/functional/FunctionalTest.cls index ddd67e3..de9146f 100644 --- a/force-app/test/package/classes/functional/FunctionalTest.cls +++ b/force-app/test/package/classes/functional/FunctionalTest.cls @@ -6,7 +6,7 @@ */ @IsTest private class FunctionalTest { - @isTest + @IsTest static void whenCreatingNewCompany_itShouldInsertAccount() { // Arrange Mock dmlDelegateMock = Mock.forType(DMLDelegate.class); @@ -20,7 +20,7 @@ private class FunctionalTest { Expect.that(insertSObjectSpy).hasBeenCalledWith(Argument.of(new Account(NumberOfEmployees = 10))); } - @isTest + @IsTest static void whenCreatingNewCompanyWithOpportunity_itShouldInsertAccountAndOpportunity() { // Arrange Mock dmlDelegateMock = Mock.forType(DMLDelegate.class); @@ -42,7 +42,7 @@ private class FunctionalTest { Expect.that(insertSObjectSpy).hasBeenCalledTimes(2); } - @isTest + @IsTest static void whenCreatingNewCompanyWith1BEmployees_itThrows() { // Arrange Mock dmlDelegateMock = Mock.forType(DMLDelegate.class); @@ -62,7 +62,7 @@ private class FunctionalTest { } } - @isTest + @IsTest static void whenCreatingNewCompaniesWithAllOrNoneFalseAndPartialSuccess_itReturnsSaveResult() { // Arrange Mock dmlDelegateMock = Mock.forType(DMLDelegate.class); diff --git a/force-app/test/package/classes/unit/ArgumentTest.cls b/force-app/test/package/classes/unit/ArgumentTest.cls index 1194694..3049dc6 100644 --- a/force-app/test/package/classes/unit/ArgumentTest.cls +++ b/force-app/test/package/classes/unit/ArgumentTest.cls @@ -1,6 +1,6 @@ -@isTest +@IsTest public class ArgumentTest { - @isTest + @IsTest static void givenAnyMatchable_matchesAnyKindOfArgument() { // Arrange Argument.Matchable sut = Argument.any(); @@ -8,7 +8,7 @@ public class ArgumentTest { // Act & Assert Assert.isTrue(sut.matches(null)); Assert.isTrue(sut.matches(Date.today())); - Assert.isTrue(sut.matches(DateTime.now())); + Assert.isTrue(sut.matches(Datetime.now())); Assert.isTrue(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isTrue(sut.matches(Blob.valueOf('test'))); Assert.isTrue(sut.matches(false)); @@ -24,7 +24,7 @@ public class ArgumentTest { Assert.isTrue(sut.matches(new CustomType('test', 10, new Account(Name = 'test')))); } - @isTest + @IsTest static void givenEqualsMatchable_matchesPrimitive() { // Arrange Argument.Matchable sut = Argument.equals(10); @@ -34,7 +34,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -49,7 +49,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new CustomType('test', 10, new Account(Name = 'test')))); } - @isTest + @IsTest static void givenEqualsMatchable_matchesSObject() { // Arrange Argument.Matchable sut = Argument.equals(new Account(Name = 'test')); @@ -59,7 +59,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -74,7 +74,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new CustomType('test', 10, new Account(Name = 'test')))); } - @isTest + @IsTest static void givenEqualsMatchable_matchesCustomTypeWithEquals() { // Arrange Argument.Matchable sut = Argument.equals(new CustomTypeWithEquals('test', 10, new Account(Name = 'test'))); @@ -85,7 +85,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -102,7 +102,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new CustomTypeWithEquals('TEST', 10, new Account(Name = 'TEST')))); } - @isTest + @IsTest static void givenEqualsMatchable_matchesCollection() { // Arrange Argument.Matchable sut = Argument.equals(new Map{ 'A' => new Account(), 'B' => 'test' }); @@ -112,7 +112,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -128,7 +128,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new CustomType('test', 10, new Account(Name = 'test')))); } - @isTest + @IsTest static void givenTypeMatchable_matchesPrimitive() { // Arrange Argument.Matchable sut = Argument.ofType('Integer'); @@ -138,7 +138,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -152,7 +152,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenTypeMatchable_matchesSObject() { // Arrange Argument.Matchable sut = Argument.ofType(Account.getSObjectType()); @@ -162,7 +162,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -177,7 +177,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new CustomType('test', 10, new Account(Name = 'test')))); } - @isTest + @IsTest static void givenTypeMatchable_matchesCustomType() { // Arrange Argument.Matchable sut = Argument.ofType(CustomType.class); @@ -187,7 +187,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -202,7 +202,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenTypeMatchable_matchesDeriveType() { // Arrange Argument.Matchable sut = Argument.ofType(Argument.Matchable.class); @@ -212,7 +212,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -227,7 +227,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenTypeMatchable_matchesCollection() { // Arrange Argument.Matchable sut = Argument.ofType('List'); @@ -237,7 +237,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -251,7 +251,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenJSONMatchable_matchesPrimitive() { // Arrange Argument.Matchable sut = Argument.jsonEquals(10); @@ -261,7 +261,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -275,7 +275,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenJSONMatchable_matchesSObject() { // Arrange Argument.Matchable sut = Argument.jsonEquals(new Account(Name = 'test')); @@ -285,7 +285,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -299,7 +299,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenJSONMatchable_matchesCustomType() { // Arrange Argument.Matchable sut = Argument.jsonEquals(new CustomType('test', 10, new Account(Name = 'test'))); @@ -309,7 +309,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -324,7 +324,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(new Map())); } - @isTest + @IsTest static void givenJSONMatchable_matchesCollection() { // Arrange Argument.Matchable sut = Argument.jsonEquals(new Map{ 'A' => new Account(), 'B' => 'test' }); @@ -334,7 +334,7 @@ public class ArgumentTest { Assert.isFalse(sut.matches(null)); Assert.isFalse(sut.matches(Date.today())); - Assert.isFalse(sut.matches(DateTime.now())); + Assert.isFalse(sut.matches(Datetime.now())); Assert.isFalse(sut.matches(Time.newInstance(12, 12, 12, 12))); Assert.isFalse(sut.matches(Blob.valueOf('test'))); Assert.isFalse(sut.matches(false)); @@ -393,7 +393,7 @@ public class ArgumentTest { } } - @isTest + @IsTest static void givenNull_whenOfIsCalled_doesNotmatche() { // Arrange List sut = null; @@ -405,7 +405,7 @@ public class ArgumentTest { Assert.isFalse(result); } - @isTest + @IsTest static void givenNothing_whenNullIsCalled_doesNotmatche() { // Arrange List sut = Argument.empty(); @@ -417,7 +417,7 @@ public class ArgumentTest { Assert.isFalse(result); } - @isTest + @IsTest static void givenNull_whenNullIsCalled_matches() { // Arrange List sut = null; @@ -429,7 +429,7 @@ public class ArgumentTest { Assert.isTrue(result); } - @isTest + @IsTest static void givenNothing_whenOfIsCalled_matchesEmptyList() { // Arrange List sut = Argument.empty(); @@ -441,7 +441,7 @@ public class ArgumentTest { Assert.isTrue(result); } - @isTest + @IsTest static void given1Object_whenOfIsCalled_matchesTheElement() { // Arrange List sut = Argument.of('test'); @@ -453,7 +453,7 @@ public class ArgumentTest { Assert.isTrue(result); } - @isTest + @IsTest static void given2Objects_whenOfIsCalled_matchesElementsInOrder() { // Arrange List sut = Argument.of('test', 10); @@ -467,7 +467,7 @@ public class ArgumentTest { Assert.isFalse(negative); } - @isTest + @IsTest static void given3Objects_whenOfIsCalled_matchesElementsInOrder() { // Arrange List sut = Argument.of('test', 10, new Account()); @@ -481,7 +481,7 @@ public class ArgumentTest { Assert.isFalse(negative); } - @isTest + @IsTest static void given4Objects_whenOfIsCalled_matchesElementsInOrder() { // Arrange List sut = Argument.of('test', 10, new Account(), new List()); @@ -495,7 +495,7 @@ public class ArgumentTest { Assert.isFalse(negative); } - @isTest + @IsTest static void given5Objects_whenOfIsCalled_matchesElementsInOrder() { // Arrange List sut = Argument.of('test', 10, new Account(), new List(), new Map>()); @@ -509,7 +509,7 @@ public class ArgumentTest { Assert.isFalse(negative); } - @isTest + @IsTest static void givenListOf10MixType_whenOfListIsCalledWithList_matchesElementsInOrder() { // Arrange List sut = Argument.ofList( @@ -550,7 +550,7 @@ public class ArgumentTest { Assert.isFalse(negative); } - @isTest + @IsTest static void whenOfListIsCalledWithNull_matchesEmptyList() { // Act List sut = Argument.ofList(null); @@ -681,7 +681,7 @@ public class ArgumentTest { Assert.isTrue(result); } - @isTest + @IsTest static void ArgumentAnyMatchable_equals_spec() { // Act && Assert Assert.isTrue(Argument.any() == Argument.any()); @@ -691,7 +691,7 @@ public class ArgumentTest { Assert.isFalse(Argument.any() == Argument.ofType(Account.getSObjectType())); } - @isTest + @IsTest static void ArgumentEqualsMatchable_equals_spec() { // Act && Assert Assert.isTrue(Argument.equals(new Account()) == Argument.equals(new Account())); @@ -703,7 +703,7 @@ public class ArgumentTest { Assert.isFalse(Argument.equals(new Account()) == Argument.ofType(Account.getSObjectType())); } - @isTest + @IsTest static void ArgumentJSONMatchable_equals_spec() { // Act && Assert Assert.isTrue(Argument.jsonEquals(new Account()) == Argument.jsonEquals(new Account())); @@ -715,7 +715,7 @@ public class ArgumentTest { Assert.isFalse(Argument.jsonEquals(new Account()) == Argument.ofType(Account.getSObjectType())); } - @isTest + @IsTest static void ArgumentTypeMatchable_equals_spec() { // Act && Assert Assert.isTrue(Argument.ofType(Account.getSObjectType()) == Argument.ofType(Account.getSObjectType())); diff --git a/force-app/test/package/classes/unit/ExpectTest.cls b/force-app/test/package/classes/unit/ExpectTest.cls index a39460a..ac6445b 100644 --- a/force-app/test/package/classes/unit/ExpectTest.cls +++ b/force-app/test/package/classes/unit/ExpectTest.cls @@ -10,7 +10,7 @@ private class ExpectTest { // Test are white box (implementation test instead of behavioural test) // We implemented a FakeAsserter class for the occasion - @isTest + @IsTest static void givenMethodSpyInstance_thatReturnsMethodSpyAssertInstance() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -22,7 +22,7 @@ private class ExpectTest { Assert.isNotNull(result); } - @isTest + @IsTest static void hasNotBeenCalled_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -37,7 +37,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void hasBeenCalled_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -53,7 +53,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenObject_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -69,7 +69,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with (Account:{})', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenObjectList_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -85,7 +85,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with (Account:{}, Opportunity:{})', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenMixList_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -101,7 +101,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with (Account:{}, test)', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenArgumentsEmpty_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -117,7 +117,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with ()', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenNoParameter_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -133,7 +133,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with ()', fakeAsserter.errorMessage); } - @isTest + @IsTest static void given1Arguments_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -150,7 +150,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given2Arguments_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -167,7 +167,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given3Arguments_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -188,7 +188,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given4Arguments_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -209,7 +209,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given5Arguments_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -230,7 +230,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void givenMatchables_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -247,7 +247,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void givenNullParam_hasBeenCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -263,7 +263,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called with (null)\nmethod call history:\n\t#1 method(())\n', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenNullParam_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -279,7 +279,7 @@ private class ExpectTest { Assert.areEqual('Method method was not last called with (null)', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenObject_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -295,7 +295,7 @@ private class ExpectTest { Assert.areEqual('Method method was not last called with (Account:{})', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenMixList_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -311,7 +311,7 @@ private class ExpectTest { Assert.areEqual('Method method was not last called with (Account:{}, test)', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenNoParameter_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -327,7 +327,7 @@ private class ExpectTest { Assert.areEqual('Method method was not last called with ()', fakeAsserter.errorMessage); } - @isTest + @IsTest static void given1Arguments_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -344,7 +344,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given2Arguments_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -361,7 +361,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given3Arguments_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -382,7 +382,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given4Arguments_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -403,7 +403,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void given5Arguments_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -424,7 +424,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void givenMatchables_hasBeenLastCalledWith_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -441,7 +441,7 @@ private class ExpectTest { Assert.isFalse(fakeAsserter.failed); } - @isTest + @IsTest static void givenNullMatchables_hasBeenLastCalledWithNull_callsAssertEquals() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -457,7 +457,7 @@ private class ExpectTest { Assert.areEqual('Method method was not last called with (null)\nmethod call history:\n\t#1 method(())\n', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenCall_hasBeenCalledTimes_returnsCalledTimes() { // Arrange MethodSpy spy = new MethodSpy('method'); @@ -478,7 +478,7 @@ private class ExpectTest { Assert.areEqual('Method method was not called 2 times\nmethod call history:\n\t#1 method(())\n', fakeAsserter.errorMessage); } - @isTest + @IsTest static void givenExpectedEqualsAssert_MethodSpyAsserter_doNotThrow() { // Arrange Expect.Asserter sut = new Expect.MethodSpyAsserter(); diff --git a/force-app/test/package/classes/unit/MethodSpyOnceTest.cls b/force-app/test/package/classes/unit/MethodSpyOnceTest.cls index 2b6e263..8f59d2f 100644 --- a/force-app/test/package/classes/unit/MethodSpyOnceTest.cls +++ b/force-app/test/package/classes/unit/MethodSpyOnceTest.cls @@ -7,7 +7,7 @@ @IsTest private class MethodSpyOnceTest { - @isTest + @IsTest static void givenSpyConfiguredToGloballyReturnsOnce_whenCalledOnce_returnsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -22,7 +22,7 @@ private class MethodSpyOnceTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToGloballyThrowsOnce_whenCalledOnce_throwsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -41,7 +41,7 @@ private class MethodSpyOnceTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToMatchReturnsOnce_whenCalledOnce_returnsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -56,7 +56,7 @@ private class MethodSpyOnceTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToMatchThrowsOnce_whenCalledOnce_throwsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); diff --git a/force-app/test/package/classes/unit/MethodSpyTestCustomBehavior.cls b/force-app/test/package/classes/unit/MethodSpyTestCustomBehavior.cls index 40ecb4f..0c66825 100644 --- a/force-app/test/package/classes/unit/MethodSpyTestCustomBehavior.cls +++ b/force-app/test/package/classes/unit/MethodSpyTestCustomBehavior.cls @@ -13,7 +13,7 @@ private class MethodSpyTestCustomBehavior { } } - @isTest + @IsTest static void givenSpyConfiguredWithBehavior_whenCalled_thenExecuteTheBehavior() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -28,7 +28,7 @@ private class MethodSpyTestCustomBehavior { Assert.isTrue(valueParameter === result[0]); } - @isTest + @IsTest static void givenSpyConfiguredWithMatcherWithBehavior_whenCalledWithMatching_thenExecuteTheBehavior() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -43,7 +43,7 @@ private class MethodSpyTestCustomBehavior { Assert.isTrue(valueParameter === result[0]); } - @isTest + @IsTest static void givenSpyConfiguredWithBehaviorOnce_whenCalled_thenExecuteTheBehaviorOnce() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -59,7 +59,7 @@ private class MethodSpyTestCustomBehavior { Assert.isNull(secondResult); } - @isTest + @IsTest static void givenSpyConfiguredWithMatcherWithBehaviorOnce_whenCalledWithMatching_thenExecuteTheBehaviorOnce() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -75,7 +75,7 @@ private class MethodSpyTestCustomBehavior { Assert.isNull(secondResult); } - @isTest + @IsTest static void givenSpyConfiguredWithBehaviorTimes_whenCalled_thenExecuteTheBehaviorTimes() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -94,7 +94,7 @@ private class MethodSpyTestCustomBehavior { Assert.isNull(secondResult); } - @isTest + @IsTest static void givenSpyConfiguredWithMatcherWithBehaviorTimes_whenCalledWithMatching_thenExecuteTheBehaviorTimes() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -112,7 +112,7 @@ private class MethodSpyTestCustomBehavior { Assert.isNull(secondResult); } - @isTest + @IsTest static void givenSpyConfiguredWithMutatingBehavior_whenCalledWithObjectAndUpdateAttribute_thenObjectAttributeIsMutated() { // Arrange MethodSpy sut = new MethodSpy('methodName'); diff --git a/force-app/test/package/classes/unit/MethodSpyTimesTest.cls b/force-app/test/package/classes/unit/MethodSpyTimesTest.cls index a7e9ded..0f9f34b 100644 --- a/force-app/test/package/classes/unit/MethodSpyTimesTest.cls +++ b/force-app/test/package/classes/unit/MethodSpyTimesTest.cls @@ -7,7 +7,7 @@ @IsTest private class MethodSpyTimesTest { - @isTest + @IsTest static void givenConfiguredSpy_whenCalled_respectTheOrderOfMatching() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -107,7 +107,7 @@ private class MethodSpyTimesTest { } } - @isTest + @IsTest static void givenSpyConfiguredToGloballyReturnsNTimes_whenCalledN1Times_returnsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -124,7 +124,7 @@ private class MethodSpyTimesTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToGloballyThrowsNTimes_whenCalledN1Times_throwsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -145,7 +145,7 @@ private class MethodSpyTimesTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToMatchReturnsNTimes_whenCalledN1Times_returnsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName'); @@ -162,7 +162,7 @@ private class MethodSpyTimesTest { Assert.isNull(result); } - @isTest + @IsTest static void givenSpyConfiguredToMatchThrowsNTimes_whenCalledN1Times_throwsConfiguration() { // Arrange MethodSpy sut = new MethodSpy('methodName');