Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/SharedTests/Mocks/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 2 kB image not shown  

Quelle  LicenseStoreMock.swift   Sprache: JAVA

 

import Foundation
import ThreemaFramework

// MARK: - LicenseStoreMock

/// A fully mockable implementation of `LicenseStoreProtocol` for testing.
public final class LicenseStoreMock: NSObject, LicenseStoreProtocol {
    
    // MARK: - Properties
    
    public var errorMessage: String?
    public var error: Error?
    
    public var licenseUsername: String? {
        didSet { licenseUsernameSetCount += 1 }
    }

    public var licensePassword: String? {
        didSet { licensePasswordSetCount += 1 }
    }

    public var licenseDeviceID = ""
    public var onPremConfigURL: String?
    
    // MARK: - Configurable Behavior
    
    public var isValidResult = true
    public var isWithinCheckIntervalResult = true
    public var isWithinOfflineIntervalResult = true
    public var performLicenseCheckResult = true
    public var validCustomOnPremConfigURLResult = true
    
    // MARK: - Call Tracking
    
    /// How often the license credentials were set, sets to `nil` included
    public private(set) var licenseUsernameSetCount = 0
    public private(set) var licensePasswordSetCount = 0

    public var performLicenseCheckCalled = false
    public var performUpdateWorkInfoCalled = false
    public var performUpdateWorkInfoForceCalled = false
    public var deleteLicenseCalled = false
    
    // MARK: - Initialization
    
    override public init() {
        super.init()
    }
    
    // MARK: - LicenseStoreProtocol
    
    public func validCustomOnPremConfigURL(predefinedURL: String) -> Bool {
        validCustomOnPremConfigURLResult
    }
    
    public func isValid() -> Bool {
        isValidResult
    }
    
    public func isWithinCheckInterval() -> Bool {
        isWithinCheckIntervalResult
    }
    
    public func isWithinOfflineInterval() -> Bool {
        isWithinOfflineIntervalResult
    }
    
    public func performLicenseCheck(completion: @escaping (Bool) -> Void) {
        performLicenseCheckCalled = true
        completion(performLicenseCheckResult)
    }
    
    public func performUpdateWorkInfo(force: Bool) {
        performUpdateWorkInfoForceCalled = true
    }
    
    public func performUpdateWorkInfo() {
        performUpdateWorkInfoCalled = true
    }
    
    public func deleteLicense() {
        deleteLicenseCalled = true
        licenseUsername = nil
        licensePassword = nil
        onPremConfigURL = nil
    }
    
    // swiftformat:disable:next all
    public func validCustomOnPremConfigUrl(withPredefinedUrl onPremConfigUrl: String!) -> Bool {
        validCustomOnPremConfigURLResult
    }
}

Messung
CHZG
859710094

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-11-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.