diff --git a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/ConfigInitialFileGeneratorTests.swift b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/ConfigInitialFileGeneratorTests.swift index 3d8bee3..39f4098 100644 --- a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/ConfigInitialFileGeneratorTests.swift +++ b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/ConfigInitialFileGeneratorTests.swift @@ -40,7 +40,7 @@ private extension ConfigInitialFileGeneratorTests { func makeSUT(shouldFail: String? = .none, encoder: JSONEncoding? = nil) -> (sut: ConfigInitialFileGenerator, actors: Actors) { let contentFilesCreator = MockContentFilesCreator() - contentFilesCreator.shouldThrowError = shouldFail + contentFilesCreator.errorMessage = shouldFail let config = Config.createTemplateConfig() let transformer = ConfigTransformer() let fileName = "config.json" diff --git a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/LocalizedPlatformFilesGeneratorTests.swift b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/LocalizedPlatformFilesGeneratorTests.swift index 053a867..3f45fd4 100644 --- a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/LocalizedPlatformFilesGeneratorTests.swift +++ b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/LocalizedPlatformFilesGeneratorTests.swift @@ -3,7 +3,7 @@ import XCTest final class LocalizedPlatformFilesGeneratorTests: XCTestCase { func test_createPlatformFiles_createsFilesSuccessfully() throws { - let (contentGenerator, filesCreator) = makeContentGeneratorAndCreator(shouldFilesCreatorThrowError: .none) + let (contentGenerator, filesCreator) = makeContentGeneratorAndCreator(filesCreatorThrownErrorMessage: .none) let fileExtension = "txt" let fileNameGenerator = MockPlatformFilesNameGenerator(fileExtension: fileExtension) let sut = makeSUT(contentGenerator: contentGenerator, filesCreator: filesCreator, fileNameGenerator: fileNameGenerator) @@ -18,7 +18,7 @@ final class LocalizedPlatformFilesGeneratorTests: XCTestCase { } func test_createPlatformFiles_throwsErrorAndLogsMessage_onCreateFilesFailure() { - let (contentGenerator, filesCreator) = makeContentGeneratorAndCreator(shouldFilesCreatorThrowError: "Error_message") + let (contentGenerator, filesCreator) = makeContentGeneratorAndCreator(filesCreatorThrownErrorMessage: "Error_message") let sut = makeSUT(contentGenerator: contentGenerator, filesCreator: filesCreator) let entries: [LocalizationEntry] = [.create(plural: true)] let outputFolder = URL(fileURLWithPath: NSTemporaryDirectory()) @@ -32,12 +32,12 @@ final class LocalizedPlatformFilesGeneratorTests: XCTestCase { } func makeContentGeneratorAndCreator( - shouldFilesCreatorThrowError: String? + filesCreatorThrownErrorMessage: String? ) -> (contentGenerator: MockLocalizedContentGenerator, filesCreator: MockContentFilesCreator) { let contentGenerator = MockLocalizedContentGenerator() contentGenerator.content = ("stringsContent", "stringsDictContent") let filesCreator = MockContentFilesCreator() - filesCreator.shouldThrowError = shouldFilesCreatorThrowError + filesCreator.errorMessage = filesCreatorThrownErrorMessage return (contentGenerator, filesCreator) } } diff --git a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/Mock/MockContentFilesCreator.swift b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/Mock/MockContentFilesCreator.swift index 6cbd8eb..2a8bcea 100644 --- a/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/Mock/MockContentFilesCreator.swift +++ b/Tests/LinguaTests/Infrastructure/LocalizationGenerator/Generator/Mock/MockContentFilesCreator.swift @@ -3,15 +3,15 @@ import Foundation class MockContentFilesCreator: ContentFileCreatable { var writtenContent: [String: String] = [:] - var shouldThrowError: String? + var errorMessage: String? func createFiles(with content: String, fileName: String, outputFolder: URL) throws { try createFilesInCurrentDirectory(with: content, fileName: fileName) } func createFilesInCurrentDirectory(with content: String, fileName: String) throws { - if let shouldThrowError { - throw DirectoryOperationError.folderCreationFailed(shouldThrowError) + if let errorMessage { + throw DirectoryOperationError.folderCreationFailed(errorMessage) } writtenContent[fileName] = content } diff --git a/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/SwiftLocalizedCodeFileGeneratorTests.swift b/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/SwiftLocalizedCodeFileGeneratorTests.swift index 42303dd..8a1b8a0 100644 --- a/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/SwiftLocalizedCodeFileGeneratorTests.swift +++ b/Tests/LinguaTests/Infrastructure/SwiftLocalizeGenerator/Generator/SwiftLocalizedCodeFileGeneratorTests.swift @@ -18,7 +18,7 @@ final class SwiftLocalizedCodeFileGeneratorTests: XCTestCase { func test_generate_printsErrorOnCreateFilesFailure() { let mockLogger = MockLogger() let mockContentFilesCreator = MockContentFilesCreator() - mockContentFilesCreator.shouldThrowError = "Error_message" + mockContentFilesCreator.errorMessage = "Error_message" let sut = makeSUT(mockLogger: mockLogger, mockContentFilesCreator: mockContentFilesCreator)