From 53f2ddc5b5fde7991a09d43b8dfefbf74caa7da7 Mon Sep 17 00:00:00 2001 From: welshm Date: Tue, 20 Dec 2022 15:29:36 -0500 Subject: [PATCH 1/3] Have computed var properties also use the queue to add invocations safely --- Sources/SwiftyMocky/Mock.swifttemplate | 4 +- .../SwiftyPrototype/Prototype.swifttemplate | 4 +- .../Example 1/SimpleProtocolsTests.swift | 24 ++++ .../iOS/Mocks/Mock.15.generated.swift | 108 +++++++++--------- .../iOS/Mocks/Mock.generated.swift | 106 ++++++++--------- .../macOS/Mocks/Mock.generated.swift | 106 ++++++++--------- .../tvOS/Mocks/Mock.generated.swift | 106 ++++++++--------- Tests/SwiftyMockyTests/Mock.generated.swift | 106 ++++++++--------- 8 files changed, 294 insertions(+), 270 deletions(-) diff --git a/Sources/SwiftyMocky/Mock.swifttemplate b/Sources/SwiftyMocky/Mock.swifttemplate index d73cb5e6..34936cc7 100644 --- a/Sources/SwiftyMocky/Mock.swifttemplate +++ b/Sources/SwiftyMocky/Mock.swifttemplate @@ -1500,14 +1500,14 @@ class VariableWrapper { var getter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" let returnValue = variable.isOptional ? "optionalGivenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" : "givenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" - return "\n\t\tget {\t\(staticModifier)invocations.append(.\(propertyCaseGetName)); return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" + return "\n\t\tget {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseGetName)) }; return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" } var setter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" if readonly { return "" } else { - return "\n\t\tset {\t\(staticModifier)invocations.append(.\(propertyCaseSetName)(.value(newValue))); \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" + return "\n\t\tset {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseSetName)(.value(newValue))) }; \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" } } var prototype: String { diff --git a/Sources/SwiftyPrototype/Prototype.swifttemplate b/Sources/SwiftyPrototype/Prototype.swifttemplate index 428844e1..293fd6fa 100644 --- a/Sources/SwiftyPrototype/Prototype.swifttemplate +++ b/Sources/SwiftyPrototype/Prototype.swifttemplate @@ -1499,14 +1499,14 @@ class VariableWrapper { var getter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" let returnValue = variable.isOptional ? "optionalGivenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" : "givenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" - return "\n\t\tget {\t\(staticModifier)invocations.append(.\(propertyCaseGetName)); return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" + return "\n\t\tget {\t\(staticModifier)self.queue.sync { }invocations.append(.\(propertyCaseGetName)) }; return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" } var setter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" if readonly { return "" } else { - return "\n\t\tset {\t\(staticModifier)invocations.append(.\(propertyCaseSetName)(.value(newValue))); \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" + return "\n\t\tset {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseSetName)(.value(newValue))) }; \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" } } var prototype: String { diff --git a/SwiftyMocky-Tests/Shared/Example 1/SimpleProtocolsTests.swift b/SwiftyMocky-Tests/Shared/Example 1/SimpleProtocolsTests.swift index ec857348..fab7f33f 100644 --- a/SwiftyMocky-Tests/Shared/Example 1/SimpleProtocolsTests.swift +++ b/SwiftyMocky-Tests/Shared/Example 1/SimpleProtocolsTests.swift @@ -162,6 +162,30 @@ class SimpleProtocolsTests: XCTestCase { XCTAssertEqual(mock.propertyImplicit, 7) } + func test_simpleProtocol_with_properties_threadSafe() { + let mock = SimpleProtocolWithPropertiesMock() + + // Can use explicit values, or Count convenience static members as Count + // Check property getters invocations + Verify(mock, 0, .property) + + Verify(mock, .never, .property) + // Check property setters invocations + Verify(mock, .never, .property(set: .any)) + + // We should set all initial values for non optional parameters and implicitly unwrapped optional parameters + mock.property = "test" + Given(mock, .propertyGetOnly(getter: "get only ;)")) + Given(mock, .propertyOptional(getter: nil)) + mock.propertyImplicit = 1 + + // Try accessing the property on many threads simultaneously. + DispatchQueue.concurrentPerform(iterations: 10_000) { i in + let _ = mock.property + } + + } + func test_simpleProtocol_with_both() { let mock = SimpleProtocolWithBothMethodsAndPropertiesMock() diff --git a/SwiftyMocky-Tests/iOS/Mocks/Mock.15.generated.swift b/SwiftyMocky-Tests/iOS/Mocks/Mock.15.generated.swift index 24dd0655..6f9f6866 100644 --- a/SwiftyMocky-Tests/iOS/Mocks/Mock.15.generated.swift +++ b/SwiftyMocky-Tests/iOS/Mocks/Mock.15.generated.swift @@ -71,27 +71,27 @@ open class AMassiveTestProtocolMock: AMassiveTestProtocol, Mock, StaticMock { } public var nonOptionalClosure: () -> Void { - get { invocations.append(.p_nonOptionalClosure_get); return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } - set { invocations.append(.p_nonOptionalClosure_set(.value(newValue))); __p_nonOptionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_nonOptionalClosure_get) }; return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_nonOptionalClosure_set(.value(newValue))) }; __p_nonOptionalClosure = newValue } } private var __p_nonOptionalClosure: (() -> Void)? public var optionalClosure: (() -> Int)? { - get { invocations.append(.p_optionalClosure_get); return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { invocations.append(.p_optionalClosure_set(.value(newValue))); __p_optionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_optionalClosure_get) }; return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; __p_optionalClosure = newValue } } private var __p_optionalClosure: (() -> Int)? public var implicitelyUnwrappedClosure: (() -> Void)! { - get { invocations.append(.p_implicitelyUnwrappedClosure_get); return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } - set { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))); __p_implicitelyUnwrappedClosure = newValue } + get { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_get) }; return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } + set { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))) }; __p_implicitelyUnwrappedClosure = newValue } } private var __p_implicitelyUnwrappedClosure: (() -> Void)? public static var optionalClosure: (() -> Int)? { - get { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_get); return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_set(.value(newValue))); AMassiveTestProtocolMock.__p_optionalClosure = newValue } + get { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_get) }; return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; AMassiveTestProtocolMock.__p_optionalClosure = newValue } } private static var __p_optionalClosure: (() -> Int)? @@ -2277,7 +2277,7 @@ open class ComplicatedServiceTypeMock: ComplicatedServiceType, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? @@ -2729,7 +2729,7 @@ open class DateSortableMock: DateSortable, Mock { } public var date: Date { - get { invocations.append(.p_date_get); return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } + get { self.queue.sync { invocations.append(.p_date_get) }; return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } } private var __p_date: (Date)? @@ -3447,8 +3447,8 @@ open class FailsWithKeywordArgumentsMock: FailsWithKeywordArguments, Mock { } public var `throw`: Error { - get { invocations.append(.p_throw_get); return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } - set { invocations.append(.p_throw_set(.value(newValue))); __p_throw = newValue } + get { self.queue.sync { invocations.append(.p_throw_get) }; return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } + set { self.queue.sync { invocations.append(.p_throw_set(.value(newValue))) }; __p_throw = newValue } } private var __p_throw: (Error)? @@ -6149,7 +6149,7 @@ open class ProtocolWithAssociatedTypeMock: ProtocolWithAssociatedType, Mock w } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -6355,7 +6355,7 @@ open class ProtocolWithAssociatedType2Mock: ProtocolWithAssociatedTyp } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } } private var __p_property: (String)? @@ -7927,7 +7927,7 @@ open class ProtocolWithGenericConstraintsMock: ProtocolWithGeneri } public var value: ContainedType { - get { invocations.append(.p_value_get); return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } + get { self.queue.sync { invocations.append(.p_value_get) }; return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } } private var __p_value: (ContainedType)? @@ -8551,12 +8551,12 @@ open class ProtocolWithInitializersMock: ProtocolWithInitializers, Mock { } public var param: Int { - get { invocations.append(.p_param_get); return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } + get { self.queue.sync { invocations.append(.p_param_get) }; return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } } private var __p_param: (Int)? public var other: String { - get { invocations.append(.p_other_get); return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } + get { self.queue.sync { invocations.append(.p_other_get) }; return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } } private var __p_other: (String)? @@ -9447,33 +9447,33 @@ open class ProtocolWithPropertiesMock: ProtocolWithProperties, Mock, StaticMock } public var name: String { - get { invocations.append(.p_name_get); return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { invocations.append(.p_name_set(.value(newValue))); __p_name = newValue } + get { self.queue.sync { invocations.append(.p_name_get) }; return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; __p_name = newValue } } private var __p_name: (String)? public var email: String? { - get { invocations.append(.p_email_get); return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } - set { invocations.append(.p_email_set(.value(newValue))); __p_email = newValue } + get { self.queue.sync { invocations.append(.p_email_get) }; return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } + set { self.queue.sync { invocations.append(.p_email_set(.value(newValue))) }; __p_email = newValue } } private var __p_email: (String)? public var internalProperty: InternalType { - get { invocations.append(.p_internalProperty_get); return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } - set { invocations.append(.p_internalProperty_set(.value(newValue))); __p_internalProperty = newValue } + get { self.queue.sync { invocations.append(.p_internalProperty_get) }; return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } + set { self.queue.sync { invocations.append(.p_internalProperty_set(.value(newValue))) }; __p_internalProperty = newValue } } private var __p_internalProperty: (InternalType)? public static var name: String { - get { ProtocolWithPropertiesMock.invocations.append(.p_name_get); return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_name_set(.value(newValue))); ProtocolWithPropertiesMock.__p_name = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_get) }; return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_name = newValue } } private static var __p_name: (String)? public static var defaultEmail: String? { - get { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_get); return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_set(.value(newValue))); ProtocolWithPropertiesMock.__p_defaultEmail = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_get) }; return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_defaultEmail = newValue } } private static var __p_defaultEmail: (String)? @@ -9874,7 +9874,7 @@ open class ProtocolWithStaticMembersMock: ProtocolWithStaticMembers, Mock, Stati public static var staticProperty: String { - get { ProtocolWithStaticMembersMock.invocations.append(.p_staticProperty_get); return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } + get { ProtocolWithStaticMembersMock.self.queue.sync { invocations.append(.p_staticProperty_get) }; return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } } private static var __p_staticProperty: (String)? @@ -10175,8 +10175,8 @@ open class ProtocolWithSubscriptsMock: ProtocolWithSubscripts, Mock { } public var something: Any { - get { invocations.append(.p_something_get); return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } - set { invocations.append(.p_something_set(.value(newValue))); __p_something = newValue } + get { self.queue.sync { invocations.append(.p_something_get) }; return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } + set { self.queue.sync { invocations.append(.p_something_set(.value(newValue))) }; __p_something = newValue } } private var __p_something: (Any)? @@ -11175,7 +11175,7 @@ open class ProtocolWithWhereAfterDefinitionMock: ProtocolWithWhereAfterDefini } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -12293,13 +12293,13 @@ open class ShouldAllowNoStubDefinedMock: ShouldAllowNoStubDefined, Mock, StaticM } public var property: Int? { - get { invocations.append(.p_property_get); return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private var __p_property: (Int)? public static var property: Int? { - get { ShouldAllowNoStubDefinedMock.invocations.append(.p_property_get); return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { ShouldAllowNoStubDefinedMock.self.queue.sync { invocations.append(.p_property_get) }; return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private static var __p_property: (Int)? @@ -12847,31 +12847,31 @@ open class SimpleProtocolThatInheritsOtherProtocolsMock: SimpleProtocolThatInher } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -13511,7 +13511,7 @@ open class SimpleProtocolWithBothMethodsAndPropertiesMock: SimpleProtocolWithBot } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } } private var __p_property: (String)? @@ -13990,31 +13990,31 @@ open class SimpleProtocolWithPropertiesMock: SimpleProtocolWithProperties, Mock } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -15278,7 +15278,7 @@ open class ThrowingVarProtocolMock: ThrowingVarProtocol, Mock { @available(iOS 15.0.0, macOS 12.0.0, tvOS 15.0.0, *) public var testVariableThatThrow: Bool { - get { invocations.append(.p_testVariableThatThrow_get); return __p_testVariableThatThrow ?? givenGetterValue(.p_testVariableThatThrow_get, "ThrowingVarProtocolMock - stub value for testVariableThatThrow was not defined") } + get { self.queue.sync { invocations.append(.p_testVariableThatThrow_get) }; return __p_testVariableThatThrow ?? givenGetterValue(.p_testVariableThatThrow_get, "ThrowingVarProtocolMock - stub value for testVariableThatThrow was not defined") } } private var __p_testVariableThatThrow: (Bool)? @@ -16543,7 +16543,7 @@ open class ComposedServiceMock: ComposedService, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? diff --git a/SwiftyMocky-Tests/iOS/Mocks/Mock.generated.swift b/SwiftyMocky-Tests/iOS/Mocks/Mock.generated.swift index 211c7180..15c638ae 100644 --- a/SwiftyMocky-Tests/iOS/Mocks/Mock.generated.swift +++ b/SwiftyMocky-Tests/iOS/Mocks/Mock.generated.swift @@ -71,27 +71,27 @@ open class AMassiveTestProtocolMock: AMassiveTestProtocol, Mock, StaticMock { } public var nonOptionalClosure: () -> Void { - get { invocations.append(.p_nonOptionalClosure_get); return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } - set { invocations.append(.p_nonOptionalClosure_set(.value(newValue))); __p_nonOptionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_nonOptionalClosure_get) }; return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_nonOptionalClosure_set(.value(newValue))) }; __p_nonOptionalClosure = newValue } } private var __p_nonOptionalClosure: (() -> Void)? public var optionalClosure: (() -> Int)? { - get { invocations.append(.p_optionalClosure_get); return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { invocations.append(.p_optionalClosure_set(.value(newValue))); __p_optionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_optionalClosure_get) }; return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; __p_optionalClosure = newValue } } private var __p_optionalClosure: (() -> Int)? public var implicitelyUnwrappedClosure: (() -> Void)! { - get { invocations.append(.p_implicitelyUnwrappedClosure_get); return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } - set { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))); __p_implicitelyUnwrappedClosure = newValue } + get { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_get) }; return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } + set { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))) }; __p_implicitelyUnwrappedClosure = newValue } } private var __p_implicitelyUnwrappedClosure: (() -> Void)? public static var optionalClosure: (() -> Int)? { - get { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_get); return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_set(.value(newValue))); AMassiveTestProtocolMock.__p_optionalClosure = newValue } + get { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_get) }; return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; AMassiveTestProtocolMock.__p_optionalClosure = newValue } } private static var __p_optionalClosure: (() -> Int)? @@ -2083,7 +2083,7 @@ open class ComplicatedServiceTypeMock: ComplicatedServiceType, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? @@ -2535,7 +2535,7 @@ open class DateSortableMock: DateSortable, Mock { } public var date: Date { - get { invocations.append(.p_date_get); return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } + get { self.queue.sync { invocations.append(.p_date_get) }; return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } } private var __p_date: (Date)? @@ -3253,8 +3253,8 @@ open class FailsWithKeywordArgumentsMock: FailsWithKeywordArguments, Mock { } public var `throw`: Error { - get { invocations.append(.p_throw_get); return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } - set { invocations.append(.p_throw_set(.value(newValue))); __p_throw = newValue } + get { self.queue.sync { invocations.append(.p_throw_get) }; return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } + set { self.queue.sync { invocations.append(.p_throw_set(.value(newValue))) }; __p_throw = newValue } } private var __p_throw: (Error)? @@ -5955,7 +5955,7 @@ open class ProtocolWithAssociatedTypeMock: ProtocolWithAssociatedType, Mock w } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -6161,7 +6161,7 @@ open class ProtocolWithAssociatedType2Mock: ProtocolWithAssociatedTyp } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } } private var __p_property: (String)? @@ -7733,7 +7733,7 @@ open class ProtocolWithGenericConstraintsMock: ProtocolWithGeneri } public var value: ContainedType { - get { invocations.append(.p_value_get); return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } + get { self.queue.sync { invocations.append(.p_value_get) }; return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } } private var __p_value: (ContainedType)? @@ -8357,12 +8357,12 @@ open class ProtocolWithInitializersMock: ProtocolWithInitializers, Mock { } public var param: Int { - get { invocations.append(.p_param_get); return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } + get { self.queue.sync { invocations.append(.p_param_get) }; return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } } private var __p_param: (Int)? public var other: String { - get { invocations.append(.p_other_get); return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } + get { self.queue.sync { invocations.append(.p_other_get) }; return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } } private var __p_other: (String)? @@ -9253,33 +9253,33 @@ open class ProtocolWithPropertiesMock: ProtocolWithProperties, Mock, StaticMock } public var name: String { - get { invocations.append(.p_name_get); return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { invocations.append(.p_name_set(.value(newValue))); __p_name = newValue } + get { self.queue.sync { invocations.append(.p_name_get) }; return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; __p_name = newValue } } private var __p_name: (String)? public var email: String? { - get { invocations.append(.p_email_get); return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } - set { invocations.append(.p_email_set(.value(newValue))); __p_email = newValue } + get { self.queue.sync { invocations.append(.p_email_get) }; return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } + set { self.queue.sync { invocations.append(.p_email_set(.value(newValue))) }; __p_email = newValue } } private var __p_email: (String)? public var internalProperty: InternalType { - get { invocations.append(.p_internalProperty_get); return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } - set { invocations.append(.p_internalProperty_set(.value(newValue))); __p_internalProperty = newValue } + get { self.queue.sync { invocations.append(.p_internalProperty_get) }; return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } + set { self.queue.sync { invocations.append(.p_internalProperty_set(.value(newValue))) }; __p_internalProperty = newValue } } private var __p_internalProperty: (InternalType)? public static var name: String { - get { ProtocolWithPropertiesMock.invocations.append(.p_name_get); return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_name_set(.value(newValue))); ProtocolWithPropertiesMock.__p_name = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_get) }; return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_name = newValue } } private static var __p_name: (String)? public static var defaultEmail: String? { - get { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_get); return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_set(.value(newValue))); ProtocolWithPropertiesMock.__p_defaultEmail = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_get) }; return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_defaultEmail = newValue } } private static var __p_defaultEmail: (String)? @@ -9680,7 +9680,7 @@ open class ProtocolWithStaticMembersMock: ProtocolWithStaticMembers, Mock, Stati public static var staticProperty: String { - get { ProtocolWithStaticMembersMock.invocations.append(.p_staticProperty_get); return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } + get { ProtocolWithStaticMembersMock.self.queue.sync { invocations.append(.p_staticProperty_get) }; return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } } private static var __p_staticProperty: (String)? @@ -9981,8 +9981,8 @@ open class ProtocolWithSubscriptsMock: ProtocolWithSubscripts, Mock { } public var something: Any { - get { invocations.append(.p_something_get); return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } - set { invocations.append(.p_something_set(.value(newValue))); __p_something = newValue } + get { self.queue.sync { invocations.append(.p_something_get) }; return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } + set { self.queue.sync { invocations.append(.p_something_set(.value(newValue))) }; __p_something = newValue } } private var __p_something: (Any)? @@ -10981,7 +10981,7 @@ open class ProtocolWithWhereAfterDefinitionMock: ProtocolWithWhereAfterDefini } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -12099,13 +12099,13 @@ open class ShouldAllowNoStubDefinedMock: ShouldAllowNoStubDefined, Mock, StaticM } public var property: Int? { - get { invocations.append(.p_property_get); return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private var __p_property: (Int)? public static var property: Int? { - get { ShouldAllowNoStubDefinedMock.invocations.append(.p_property_get); return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { ShouldAllowNoStubDefinedMock.self.queue.sync { invocations.append(.p_property_get) }; return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private static var __p_property: (Int)? @@ -12653,31 +12653,31 @@ open class SimpleProtocolThatInheritsOtherProtocolsMock: SimpleProtocolThatInher } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -13317,7 +13317,7 @@ open class SimpleProtocolWithBothMethodsAndPropertiesMock: SimpleProtocolWithBot } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } } private var __p_property: (String)? @@ -13796,31 +13796,31 @@ open class SimpleProtocolWithPropertiesMock: SimpleProtocolWithProperties, Mock } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -16178,7 +16178,7 @@ open class ComposedServiceMock: ComposedService, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? diff --git a/SwiftyMocky-Tests/macOS/Mocks/Mock.generated.swift b/SwiftyMocky-Tests/macOS/Mocks/Mock.generated.swift index c8e70f45..df9c72a9 100644 --- a/SwiftyMocky-Tests/macOS/Mocks/Mock.generated.swift +++ b/SwiftyMocky-Tests/macOS/Mocks/Mock.generated.swift @@ -69,27 +69,27 @@ open class AMassiveTestProtocolMock: AMassiveTestProtocol, Mock, StaticMock { } public var nonOptionalClosure: () -> Void { - get { invocations.append(.p_nonOptionalClosure_get); return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } - set { invocations.append(.p_nonOptionalClosure_set(.value(newValue))); __p_nonOptionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_nonOptionalClosure_get) }; return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_nonOptionalClosure_set(.value(newValue))) }; __p_nonOptionalClosure = newValue } } private var __p_nonOptionalClosure: (() -> Void)? public var optionalClosure: (() -> Int)? { - get { invocations.append(.p_optionalClosure_get); return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { invocations.append(.p_optionalClosure_set(.value(newValue))); __p_optionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_optionalClosure_get) }; return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; __p_optionalClosure = newValue } } private var __p_optionalClosure: (() -> Int)? public var implicitelyUnwrappedClosure: (() -> Void)! { - get { invocations.append(.p_implicitelyUnwrappedClosure_get); return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } - set { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))); __p_implicitelyUnwrappedClosure = newValue } + get { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_get) }; return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } + set { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))) }; __p_implicitelyUnwrappedClosure = newValue } } private var __p_implicitelyUnwrappedClosure: (() -> Void)? public static var optionalClosure: (() -> Int)? { - get { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_get); return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_set(.value(newValue))); AMassiveTestProtocolMock.__p_optionalClosure = newValue } + get { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_get) }; return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; AMassiveTestProtocolMock.__p_optionalClosure = newValue } } private static var __p_optionalClosure: (() -> Int)? @@ -2081,7 +2081,7 @@ open class ComplicatedServiceTypeMock: ComplicatedServiceType, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? @@ -2533,7 +2533,7 @@ open class DateSortableMock: DateSortable, Mock { } public var date: Date { - get { invocations.append(.p_date_get); return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } + get { self.queue.sync { invocations.append(.p_date_get) }; return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } } private var __p_date: (Date)? @@ -3251,8 +3251,8 @@ open class FailsWithKeywordArgumentsMock: FailsWithKeywordArguments, Mock { } public var `throw`: Error { - get { invocations.append(.p_throw_get); return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } - set { invocations.append(.p_throw_set(.value(newValue))); __p_throw = newValue } + get { self.queue.sync { invocations.append(.p_throw_get) }; return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } + set { self.queue.sync { invocations.append(.p_throw_set(.value(newValue))) }; __p_throw = newValue } } private var __p_throw: (Error)? @@ -5953,7 +5953,7 @@ open class ProtocolWithAssociatedTypeMock: ProtocolWithAssociatedType, Mock w } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -6159,7 +6159,7 @@ open class ProtocolWithAssociatedType2Mock: ProtocolWithAssociatedTyp } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } } private var __p_property: (String)? @@ -7731,7 +7731,7 @@ open class ProtocolWithGenericConstraintsMock: ProtocolWithGeneri } public var value: ContainedType { - get { invocations.append(.p_value_get); return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } + get { self.queue.sync { invocations.append(.p_value_get) }; return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } } private var __p_value: (ContainedType)? @@ -8355,12 +8355,12 @@ open class ProtocolWithInitializersMock: ProtocolWithInitializers, Mock { } public var param: Int { - get { invocations.append(.p_param_get); return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } + get { self.queue.sync { invocations.append(.p_param_get) }; return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } } private var __p_param: (Int)? public var other: String { - get { invocations.append(.p_other_get); return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } + get { self.queue.sync { invocations.append(.p_other_get) }; return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } } private var __p_other: (String)? @@ -9251,33 +9251,33 @@ open class ProtocolWithPropertiesMock: ProtocolWithProperties, Mock, StaticMock } public var name: String { - get { invocations.append(.p_name_get); return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { invocations.append(.p_name_set(.value(newValue))); __p_name = newValue } + get { self.queue.sync { invocations.append(.p_name_get) }; return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; __p_name = newValue } } private var __p_name: (String)? public var email: String? { - get { invocations.append(.p_email_get); return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } - set { invocations.append(.p_email_set(.value(newValue))); __p_email = newValue } + get { self.queue.sync { invocations.append(.p_email_get) }; return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } + set { self.queue.sync { invocations.append(.p_email_set(.value(newValue))) }; __p_email = newValue } } private var __p_email: (String)? public var internalProperty: InternalType { - get { invocations.append(.p_internalProperty_get); return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } - set { invocations.append(.p_internalProperty_set(.value(newValue))); __p_internalProperty = newValue } + get { self.queue.sync { invocations.append(.p_internalProperty_get) }; return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } + set { self.queue.sync { invocations.append(.p_internalProperty_set(.value(newValue))) }; __p_internalProperty = newValue } } private var __p_internalProperty: (InternalType)? public static var name: String { - get { ProtocolWithPropertiesMock.invocations.append(.p_name_get); return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_name_set(.value(newValue))); ProtocolWithPropertiesMock.__p_name = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_get) }; return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_name = newValue } } private static var __p_name: (String)? public static var defaultEmail: String? { - get { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_get); return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_set(.value(newValue))); ProtocolWithPropertiesMock.__p_defaultEmail = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_get) }; return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_defaultEmail = newValue } } private static var __p_defaultEmail: (String)? @@ -9678,7 +9678,7 @@ open class ProtocolWithStaticMembersMock: ProtocolWithStaticMembers, Mock, Stati public static var staticProperty: String { - get { ProtocolWithStaticMembersMock.invocations.append(.p_staticProperty_get); return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } + get { ProtocolWithStaticMembersMock.self.queue.sync { invocations.append(.p_staticProperty_get) }; return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } } private static var __p_staticProperty: (String)? @@ -9979,8 +9979,8 @@ open class ProtocolWithSubscriptsMock: ProtocolWithSubscripts, Mock { } public var something: Any { - get { invocations.append(.p_something_get); return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } - set { invocations.append(.p_something_set(.value(newValue))); __p_something = newValue } + get { self.queue.sync { invocations.append(.p_something_get) }; return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } + set { self.queue.sync { invocations.append(.p_something_set(.value(newValue))) }; __p_something = newValue } } private var __p_something: (Any)? @@ -10979,7 +10979,7 @@ open class ProtocolWithWhereAfterDefinitionMock: ProtocolWithWhereAfterDefini } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -12097,13 +12097,13 @@ open class ShouldAllowNoStubDefinedMock: ShouldAllowNoStubDefined, Mock, StaticM } public var property: Int? { - get { invocations.append(.p_property_get); return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private var __p_property: (Int)? public static var property: Int? { - get { ShouldAllowNoStubDefinedMock.invocations.append(.p_property_get); return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { ShouldAllowNoStubDefinedMock.self.queue.sync { invocations.append(.p_property_get) }; return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private static var __p_property: (Int)? @@ -12651,31 +12651,31 @@ open class SimpleProtocolThatInheritsOtherProtocolsMock: SimpleProtocolThatInher } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -13315,7 +13315,7 @@ open class SimpleProtocolWithBothMethodsAndPropertiesMock: SimpleProtocolWithBot } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } } private var __p_property: (String)? @@ -13794,31 +13794,31 @@ open class SimpleProtocolWithPropertiesMock: SimpleProtocolWithProperties, Mock } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -16030,7 +16030,7 @@ open class ComposedServiceMock: ComposedService, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? diff --git a/SwiftyMocky-Tests/tvOS/Mocks/Mock.generated.swift b/SwiftyMocky-Tests/tvOS/Mocks/Mock.generated.swift index 14daba32..420aebbc 100644 --- a/SwiftyMocky-Tests/tvOS/Mocks/Mock.generated.swift +++ b/SwiftyMocky-Tests/tvOS/Mocks/Mock.generated.swift @@ -69,27 +69,27 @@ open class AMassiveTestProtocolMock: AMassiveTestProtocol, Mock, StaticMock { } public var nonOptionalClosure: () -> Void { - get { invocations.append(.p_nonOptionalClosure_get); return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } - set { invocations.append(.p_nonOptionalClosure_set(.value(newValue))); __p_nonOptionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_nonOptionalClosure_get) }; return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_nonOptionalClosure_set(.value(newValue))) }; __p_nonOptionalClosure = newValue } } private var __p_nonOptionalClosure: (() -> Void)? public var optionalClosure: (() -> Int)? { - get { invocations.append(.p_optionalClosure_get); return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { invocations.append(.p_optionalClosure_set(.value(newValue))); __p_optionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_optionalClosure_get) }; return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; __p_optionalClosure = newValue } } private var __p_optionalClosure: (() -> Int)? public var implicitelyUnwrappedClosure: (() -> Void)! { - get { invocations.append(.p_implicitelyUnwrappedClosure_get); return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } - set { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))); __p_implicitelyUnwrappedClosure = newValue } + get { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_get) }; return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } + set { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))) }; __p_implicitelyUnwrappedClosure = newValue } } private var __p_implicitelyUnwrappedClosure: (() -> Void)? public static var optionalClosure: (() -> Int)? { - get { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_get); return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_set(.value(newValue))); AMassiveTestProtocolMock.__p_optionalClosure = newValue } + get { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_get) }; return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; AMassiveTestProtocolMock.__p_optionalClosure = newValue } } private static var __p_optionalClosure: (() -> Int)? @@ -2081,7 +2081,7 @@ open class ComplicatedServiceTypeMock: ComplicatedServiceType, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? @@ -2533,7 +2533,7 @@ open class DateSortableMock: DateSortable, Mock { } public var date: Date { - get { invocations.append(.p_date_get); return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } + get { self.queue.sync { invocations.append(.p_date_get) }; return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } } private var __p_date: (Date)? @@ -3251,8 +3251,8 @@ open class FailsWithKeywordArgumentsMock: FailsWithKeywordArguments, Mock { } public var `throw`: Error { - get { invocations.append(.p_throw_get); return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } - set { invocations.append(.p_throw_set(.value(newValue))); __p_throw = newValue } + get { self.queue.sync { invocations.append(.p_throw_get) }; return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } + set { self.queue.sync { invocations.append(.p_throw_set(.value(newValue))) }; __p_throw = newValue } } private var __p_throw: (Error)? @@ -5953,7 +5953,7 @@ open class ProtocolWithAssociatedTypeMock: ProtocolWithAssociatedType, Mock w } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -6159,7 +6159,7 @@ open class ProtocolWithAssociatedType2Mock: ProtocolWithAssociatedTyp } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } } private var __p_property: (String)? @@ -7731,7 +7731,7 @@ open class ProtocolWithGenericConstraintsMock: ProtocolWithGeneri } public var value: ContainedType { - get { invocations.append(.p_value_get); return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } + get { self.queue.sync { invocations.append(.p_value_get) }; return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } } private var __p_value: (ContainedType)? @@ -8355,12 +8355,12 @@ open class ProtocolWithInitializersMock: ProtocolWithInitializers, Mock { } public var param: Int { - get { invocations.append(.p_param_get); return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } + get { self.queue.sync { invocations.append(.p_param_get) }; return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } } private var __p_param: (Int)? public var other: String { - get { invocations.append(.p_other_get); return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } + get { self.queue.sync { invocations.append(.p_other_get) }; return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } } private var __p_other: (String)? @@ -9251,33 +9251,33 @@ open class ProtocolWithPropertiesMock: ProtocolWithProperties, Mock, StaticMock } public var name: String { - get { invocations.append(.p_name_get); return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { invocations.append(.p_name_set(.value(newValue))); __p_name = newValue } + get { self.queue.sync { invocations.append(.p_name_get) }; return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; __p_name = newValue } } private var __p_name: (String)? public var email: String? { - get { invocations.append(.p_email_get); return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } - set { invocations.append(.p_email_set(.value(newValue))); __p_email = newValue } + get { self.queue.sync { invocations.append(.p_email_get) }; return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } + set { self.queue.sync { invocations.append(.p_email_set(.value(newValue))) }; __p_email = newValue } } private var __p_email: (String)? public var internalProperty: InternalType { - get { invocations.append(.p_internalProperty_get); return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } - set { invocations.append(.p_internalProperty_set(.value(newValue))); __p_internalProperty = newValue } + get { self.queue.sync { invocations.append(.p_internalProperty_get) }; return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } + set { self.queue.sync { invocations.append(.p_internalProperty_set(.value(newValue))) }; __p_internalProperty = newValue } } private var __p_internalProperty: (InternalType)? public static var name: String { - get { ProtocolWithPropertiesMock.invocations.append(.p_name_get); return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_name_set(.value(newValue))); ProtocolWithPropertiesMock.__p_name = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_get) }; return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_name = newValue } } private static var __p_name: (String)? public static var defaultEmail: String? { - get { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_get); return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_set(.value(newValue))); ProtocolWithPropertiesMock.__p_defaultEmail = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_get) }; return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_defaultEmail = newValue } } private static var __p_defaultEmail: (String)? @@ -9678,7 +9678,7 @@ open class ProtocolWithStaticMembersMock: ProtocolWithStaticMembers, Mock, Stati public static var staticProperty: String { - get { ProtocolWithStaticMembersMock.invocations.append(.p_staticProperty_get); return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } + get { ProtocolWithStaticMembersMock.self.queue.sync { invocations.append(.p_staticProperty_get) }; return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } } private static var __p_staticProperty: (String)? @@ -9979,8 +9979,8 @@ open class ProtocolWithSubscriptsMock: ProtocolWithSubscripts, Mock { } public var something: Any { - get { invocations.append(.p_something_get); return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } - set { invocations.append(.p_something_set(.value(newValue))); __p_something = newValue } + get { self.queue.sync { invocations.append(.p_something_get) }; return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } + set { self.queue.sync { invocations.append(.p_something_set(.value(newValue))) }; __p_something = newValue } } private var __p_something: (Any)? @@ -10979,7 +10979,7 @@ open class ProtocolWithWhereAfterDefinitionMock: ProtocolWithWhereAfterDefini } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -12097,13 +12097,13 @@ open class ShouldAllowNoStubDefinedMock: ShouldAllowNoStubDefined, Mock, StaticM } public var property: Int? { - get { invocations.append(.p_property_get); return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private var __p_property: (Int)? public static var property: Int? { - get { ShouldAllowNoStubDefinedMock.invocations.append(.p_property_get); return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { ShouldAllowNoStubDefinedMock.self.queue.sync { invocations.append(.p_property_get) }; return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private static var __p_property: (Int)? @@ -12651,31 +12651,31 @@ open class SimpleProtocolThatInheritsOtherProtocolsMock: SimpleProtocolThatInher } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -13315,7 +13315,7 @@ open class SimpleProtocolWithBothMethodsAndPropertiesMock: SimpleProtocolWithBot } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } } private var __p_property: (String)? @@ -13794,31 +13794,31 @@ open class SimpleProtocolWithPropertiesMock: SimpleProtocolWithProperties, Mock } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -16030,7 +16030,7 @@ open class ComposedServiceMock: ComposedService, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? diff --git a/Tests/SwiftyMockyTests/Mock.generated.swift b/Tests/SwiftyMockyTests/Mock.generated.swift index 8db54107..bc9860ff 100644 --- a/Tests/SwiftyMockyTests/Mock.generated.swift +++ b/Tests/SwiftyMockyTests/Mock.generated.swift @@ -70,27 +70,27 @@ open class AMassiveTestProtocolMock: AMassiveTestProtocol, Mock, StaticMock { } public var nonOptionalClosure: () -> Void { - get { invocations.append(.p_nonOptionalClosure_get); return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } - set { invocations.append(.p_nonOptionalClosure_set(.value(newValue))); __p_nonOptionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_nonOptionalClosure_get) }; return __p_nonOptionalClosure ?? givenGetterValue(.p_nonOptionalClosure_get, "AMassiveTestProtocolMock - stub value for nonOptionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_nonOptionalClosure_set(.value(newValue))) }; __p_nonOptionalClosure = newValue } } private var __p_nonOptionalClosure: (() -> Void)? public var optionalClosure: (() -> Int)? { - get { invocations.append(.p_optionalClosure_get); return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { invocations.append(.p_optionalClosure_set(.value(newValue))); __p_optionalClosure = newValue } + get { self.queue.sync { invocations.append(.p_optionalClosure_get) }; return __p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; __p_optionalClosure = newValue } } private var __p_optionalClosure: (() -> Int)? public var implicitelyUnwrappedClosure: (() -> Void)! { - get { invocations.append(.p_implicitelyUnwrappedClosure_get); return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } - set { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))); __p_implicitelyUnwrappedClosure = newValue } + get { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_get) }; return __p_implicitelyUnwrappedClosure ?? optionalGivenGetterValue(.p_implicitelyUnwrappedClosure_get, "AMassiveTestProtocolMock - stub value for implicitelyUnwrappedClosure was not defined") } + set { self.queue.sync { invocations.append(.p_implicitelyUnwrappedClosure_set(.value(newValue))) }; __p_implicitelyUnwrappedClosure = newValue } } private var __p_implicitelyUnwrappedClosure: (() -> Void)? public static var optionalClosure: (() -> Int)? { - get { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_get); return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } - set { AMassiveTestProtocolMock.invocations.append(.p_optionalClosure_set(.value(newValue))); AMassiveTestProtocolMock.__p_optionalClosure = newValue } + get { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_get) }; return AMassiveTestProtocolMock.__p_optionalClosure ?? optionalGivenGetterValue(.p_optionalClosure_get, "AMassiveTestProtocolMock - stub value for optionalClosure was not defined") } + set { AMassiveTestProtocolMock.self.queue.sync { invocations.append(.p_optionalClosure_set(.value(newValue))) }; AMassiveTestProtocolMock.__p_optionalClosure = newValue } } private static var __p_optionalClosure: (() -> Int)? @@ -2082,7 +2082,7 @@ open class ComplicatedServiceTypeMock: ComplicatedServiceType, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComplicatedServiceTypeMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? @@ -2534,7 +2534,7 @@ open class DateSortableMock: DateSortable, Mock { } public var date: Date { - get { invocations.append(.p_date_get); return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } + get { self.queue.sync { invocations.append(.p_date_get) }; return __p_date ?? givenGetterValue(.p_date_get, "DateSortableMock - stub value for date was not defined") } } private var __p_date: (Date)? @@ -3252,8 +3252,8 @@ open class FailsWithKeywordArgumentsMock: FailsWithKeywordArguments, Mock { } public var `throw`: Error { - get { invocations.append(.p_throw_get); return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } - set { invocations.append(.p_throw_set(.value(newValue))); __p_throw = newValue } + get { self.queue.sync { invocations.append(.p_throw_get) }; return __p_throw ?? givenGetterValue(.p_throw_get, "FailsWithKeywordArgumentsMock - stub value for `throw` was not defined") } + set { self.queue.sync { invocations.append(.p_throw_set(.value(newValue))) }; __p_throw = newValue } } private var __p_throw: (Error)? @@ -5954,7 +5954,7 @@ open class ProtocolWithAssociatedTypeMock: ProtocolWithAssociatedType, Mock w } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithAssociatedTypeMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -6160,7 +6160,7 @@ open class ProtocolWithAssociatedType2Mock: ProtocolWithAssociatedTyp } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "ProtocolWithAssociatedType2Mock - stub value for property was not defined") } } private var __p_property: (String)? @@ -7732,7 +7732,7 @@ open class ProtocolWithGenericConstraintsMock: ProtocolWithGeneri } public var value: ContainedType { - get { invocations.append(.p_value_get); return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } + get { self.queue.sync { invocations.append(.p_value_get) }; return __p_value ?? givenGetterValue(.p_value_get, "ProtocolWithGenericConstraintsMock - stub value for value was not defined") } } private var __p_value: (ContainedType)? @@ -8356,12 +8356,12 @@ open class ProtocolWithInitializersMock: ProtocolWithInitializers, Mock { } public var param: Int { - get { invocations.append(.p_param_get); return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } + get { self.queue.sync { invocations.append(.p_param_get) }; return __p_param ?? givenGetterValue(.p_param_get, "ProtocolWithInitializersMock - stub value for param was not defined") } } private var __p_param: (Int)? public var other: String { - get { invocations.append(.p_other_get); return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } + get { self.queue.sync { invocations.append(.p_other_get) }; return __p_other ?? givenGetterValue(.p_other_get, "ProtocolWithInitializersMock - stub value for other was not defined") } } private var __p_other: (String)? @@ -9252,33 +9252,33 @@ open class ProtocolWithPropertiesMock: ProtocolWithProperties, Mock, StaticMock } public var name: String { - get { invocations.append(.p_name_get); return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { invocations.append(.p_name_set(.value(newValue))); __p_name = newValue } + get { self.queue.sync { invocations.append(.p_name_get) }; return __p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; __p_name = newValue } } private var __p_name: (String)? public var email: String? { - get { invocations.append(.p_email_get); return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } - set { invocations.append(.p_email_set(.value(newValue))); __p_email = newValue } + get { self.queue.sync { invocations.append(.p_email_get) }; return __p_email ?? optionalGivenGetterValue(.p_email_get, "ProtocolWithPropertiesMock - stub value for email was not defined") } + set { self.queue.sync { invocations.append(.p_email_set(.value(newValue))) }; __p_email = newValue } } private var __p_email: (String)? public var internalProperty: InternalType { - get { invocations.append(.p_internalProperty_get); return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } - set { invocations.append(.p_internalProperty_set(.value(newValue))); __p_internalProperty = newValue } + get { self.queue.sync { invocations.append(.p_internalProperty_get) }; return __p_internalProperty ?? givenGetterValue(.p_internalProperty_get, "ProtocolWithPropertiesMock - stub value for internalProperty was not defined") } + set { self.queue.sync { invocations.append(.p_internalProperty_set(.value(newValue))) }; __p_internalProperty = newValue } } private var __p_internalProperty: (InternalType)? public static var name: String { - get { ProtocolWithPropertiesMock.invocations.append(.p_name_get); return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_name_set(.value(newValue))); ProtocolWithPropertiesMock.__p_name = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_get) }; return ProtocolWithPropertiesMock.__p_name ?? givenGetterValue(.p_name_get, "ProtocolWithPropertiesMock - stub value for name was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_name_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_name = newValue } } private static var __p_name: (String)? public static var defaultEmail: String? { - get { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_get); return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } - set { ProtocolWithPropertiesMock.invocations.append(.p_defaultEmail_set(.value(newValue))); ProtocolWithPropertiesMock.__p_defaultEmail = newValue } + get { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_get) }; return ProtocolWithPropertiesMock.__p_defaultEmail ?? optionalGivenGetterValue(.p_defaultEmail_get, "ProtocolWithPropertiesMock - stub value for defaultEmail was not defined") } + set { ProtocolWithPropertiesMock.self.queue.sync { invocations.append(.p_defaultEmail_set(.value(newValue))) }; ProtocolWithPropertiesMock.__p_defaultEmail = newValue } } private static var __p_defaultEmail: (String)? @@ -9679,7 +9679,7 @@ open class ProtocolWithStaticMembersMock: ProtocolWithStaticMembers, Mock, Stati public static var staticProperty: String { - get { ProtocolWithStaticMembersMock.invocations.append(.p_staticProperty_get); return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } + get { ProtocolWithStaticMembersMock.self.queue.sync { invocations.append(.p_staticProperty_get) }; return ProtocolWithStaticMembersMock.__p_staticProperty ?? givenGetterValue(.p_staticProperty_get, "ProtocolWithStaticMembersMock - stub value for staticProperty was not defined") } } private static var __p_staticProperty: (String)? @@ -9980,8 +9980,8 @@ open class ProtocolWithSubscriptsMock: ProtocolWithSubscripts, Mock { } public var something: Any { - get { invocations.append(.p_something_get); return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } - set { invocations.append(.p_something_set(.value(newValue))); __p_something = newValue } + get { self.queue.sync { invocations.append(.p_something_get) }; return __p_something ?? givenGetterValue(.p_something_get, "ProtocolWithSubscriptsMock - stub value for something was not defined") } + set { self.queue.sync { invocations.append(.p_something_set(.value(newValue))) }; __p_something = newValue } } private var __p_something: (Any)? @@ -10980,7 +10980,7 @@ open class ProtocolWithWhereAfterDefinitionMock: ProtocolWithWhereAfterDefini } public var sequence: T { - get { invocations.append(.p_sequence_get); return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } + get { self.queue.sync { invocations.append(.p_sequence_get) }; return __p_sequence ?? givenGetterValue(.p_sequence_get, "ProtocolWithWhereAfterDefinitionMock - stub value for sequence was not defined") } } private var __p_sequence: (T)? @@ -12098,13 +12098,13 @@ open class ShouldAllowNoStubDefinedMock: ShouldAllowNoStubDefined, Mock, StaticM } public var property: Int? { - get { invocations.append(.p_property_get); return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private var __p_property: (Int)? public static var property: Int? { - get { ShouldAllowNoStubDefinedMock.invocations.append(.p_property_get); return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } + get { ShouldAllowNoStubDefinedMock.self.queue.sync { invocations.append(.p_property_get) }; return ShouldAllowNoStubDefinedMock.__p_property ?? optionalGivenGetterValue(.p_property_get, "ShouldAllowNoStubDefinedMock - stub value for property was not defined") } } private static var __p_property: (Int)? @@ -12652,31 +12652,31 @@ open class SimpleProtocolThatInheritsOtherProtocolsMock: SimpleProtocolThatInher } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolThatInheritsOtherProtocolsMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -13316,7 +13316,7 @@ open class SimpleProtocolWithBothMethodsAndPropertiesMock: SimpleProtocolWithBot } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithBothMethodsAndPropertiesMock - stub value for property was not defined") } } private var __p_property: (String)? @@ -13795,31 +13795,31 @@ open class SimpleProtocolWithPropertiesMock: SimpleProtocolWithProperties, Mock } public var property: String { - get { invocations.append(.p_property_get); return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } - set { invocations.append(.p_property_set(.value(newValue))); __p_property = newValue } + get { self.queue.sync { invocations.append(.p_property_get) }; return __p_property ?? givenGetterValue(.p_property_get, "SimpleProtocolWithPropertiesMock - stub value for property was not defined") } + set { self.queue.sync { invocations.append(.p_property_set(.value(newValue))) }; __p_property = newValue } } private var __p_property: (String)? public var weakProperty: AnyObject! { - get { invocations.append(.p_weakProperty_get); return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } - set { invocations.append(.p_weakProperty_set(.value(newValue))); __p_weakProperty = newValue } + get { self.queue.sync { invocations.append(.p_weakProperty_get) }; return __p_weakProperty ?? optionalGivenGetterValue(.p_weakProperty_get, "SimpleProtocolWithPropertiesMock - stub value for weakProperty was not defined") } + set { self.queue.sync { invocations.append(.p_weakProperty_set(.value(newValue))) }; __p_weakProperty = newValue } } private var __p_weakProperty: (AnyObject)? public var propertyGetOnly: String { - get { invocations.append(.p_propertyGetOnly_get); return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } + get { self.queue.sync { invocations.append(.p_propertyGetOnly_get) }; return __p_propertyGetOnly ?? givenGetterValue(.p_propertyGetOnly_get, "SimpleProtocolWithPropertiesMock - stub value for propertyGetOnly was not defined") } } private var __p_propertyGetOnly: (String)? public var propertyOptional: Int? { - get { invocations.append(.p_propertyOptional_get); return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } - set { invocations.append(.p_propertyOptional_set(.value(newValue))); __p_propertyOptional = newValue } + get { self.queue.sync { invocations.append(.p_propertyOptional_get) }; return __p_propertyOptional ?? optionalGivenGetterValue(.p_propertyOptional_get, "SimpleProtocolWithPropertiesMock - stub value for propertyOptional was not defined") } + set { self.queue.sync { invocations.append(.p_propertyOptional_set(.value(newValue))) }; __p_propertyOptional = newValue } } private var __p_propertyOptional: (Int)? public var propertyImplicit: Int! { - get { invocations.append(.p_propertyImplicit_get); return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } - set { invocations.append(.p_propertyImplicit_set(.value(newValue))); __p_propertyImplicit = newValue } + get { self.queue.sync { invocations.append(.p_propertyImplicit_get) }; return __p_propertyImplicit ?? optionalGivenGetterValue(.p_propertyImplicit_get, "SimpleProtocolWithPropertiesMock - stub value for propertyImplicit was not defined") } + set { self.queue.sync { invocations.append(.p_propertyImplicit_set(.value(newValue))) }; __p_propertyImplicit = newValue } } private var __p_propertyImplicit: (Int)? @@ -16031,7 +16031,7 @@ open class ComposedServiceMock: ComposedService, Mock { } public var youCouldOnlyGetThis: String { - get { invocations.append(.p_youCouldOnlyGetThis_get); return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } + get { self.queue.sync { invocations.append(.p_youCouldOnlyGetThis_get) }; return __p_youCouldOnlyGetThis ?? givenGetterValue(.p_youCouldOnlyGetThis_get, "ComposedServiceMock - stub value for youCouldOnlyGetThis was not defined") } } private var __p_youCouldOnlyGetThis: (String)? From e4399cb085a54d56de154d8136c954f9f5342eec Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Wed, 9 Oct 2024 14:49:18 -0400 Subject: [PATCH 2/3] Update Sources/SwiftyPrototype/Prototype.swifttemplate Co-authored-by: etiennemartin-faire <150162840+etiennemartin-faire@users.noreply.github.com> --- Sources/SwiftyPrototype/Prototype.swifttemplate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftyPrototype/Prototype.swifttemplate b/Sources/SwiftyPrototype/Prototype.swifttemplate index 293fd6fa..7762d489 100644 --- a/Sources/SwiftyPrototype/Prototype.swifttemplate +++ b/Sources/SwiftyPrototype/Prototype.swifttemplate @@ -1499,7 +1499,7 @@ class VariableWrapper { var getter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" let returnValue = variable.isOptional ? "optionalGivenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" : "givenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" - return "\n\t\tget {\t\(staticModifier)self.queue.sync { }invocations.append(.\(propertyCaseGetName)) }; return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" + return "\n\t\tget {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseGetName)) }; return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" } var setter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" From ff97bf24a30bfa571eaf739a9b038fdd2441ff74 Mon Sep 17 00:00:00 2001 From: welshm Date: Thu, 10 Oct 2024 15:13:32 -0400 Subject: [PATCH 3/3] Add more changes --- Templates/VariableWrapper.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/VariableWrapper.swift b/Templates/VariableWrapper.swift index 12a851e4..9971a1c5 100644 --- a/Templates/VariableWrapper.swift +++ b/Templates/VariableWrapper.swift @@ -19,14 +19,14 @@ class VariableWrapper { var getter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" let returnValue = variable.isOptional ? "optionalGivenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" : "givenGetterValue(.\(propertyCaseGetName), \"\(noStubDefinedMessage)\")" - return "\n\t\tget {\t\(staticModifier)invocations.append(.\(propertyCaseGetName)); return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" + return "\n\t\tget {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseGetName)) }; return \(staticModifier)\(privatePrototypeName) ?? \(returnValue) }" } var setter: String { let staticModifier = variable.isStatic ? "\(scope)." : "" if readonly { return "" } else { - return "\n\t\tset {\t\(staticModifier)invocations.append(.\(propertyCaseSetName)(.value(newValue))); \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" + return "\n\t\tset {\t\(staticModifier)self.queue.sync { invocations.append(.\(propertyCaseSetName)(.value(newValue))) }; \(variable.isStatic ? "\(scope)." : "")\(privatePrototypeName) = newValue }" } } var prototype: String {