text:
.class public final Landroid/provider/Settings;
.super Ljava/lang/Object;
.source "Settings.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/provider/Settings$SettingNotFoundException;,
        Landroid/provider/Settings$NameValueTable;,
        Landroid/provider/Settings$NameValueCache;,
        Landroid/provider/Settings$System;,
        Landroid/provider/Settings$Secure;,
        Landroid/provider/Settings$Global;,
        Landroid/provider/Settings$Bookmarks;
    }
.end annotation

# static fields
.field public static final ACTION_ACCESSIBILITY_SETTINGS:Ljava/lang/String; = "android.settings.ACCESSIBILITY_SETTINGS"

.field public static final ACTION_ADD_ACCOUNT:Ljava/lang/String; = "android.settings.ADD_ACCOUNT_SETTINGS"

.field public static final ACTION_AIRPLANE_MODE_SETTINGS:Ljava/lang/String; = "android.settings.AIRPLANE_MODE_SETTINGS"

.field public static final ACTION_APN_SETTINGS:Ljava/lang/String; = "android.settings.APN_SETTINGS"

.field public static final ACTION_APPLICATION_DETAILS_SETTINGS:Ljava/lang/String; = "android.settings.APPLICATION_DETAILS_SETTINGS"

.field public static final ACTION_APPLICATION_DEVELOPMENT_SETTINGS:Ljava/lang/String; = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"

.field public static final ACTION_APPLICATION_SETTINGS:Ljava/lang/String; = "android.settings.APPLICATION_SETTINGS"

.field public static final ACTION_APP_NOTIFICATION_REDACTION:Ljava/lang/String; = "android.settings.ACTION_APP_NOTIFICATION_REDACTION"

.field public static final ACTION_APP_NOTIFICATION_SETTINGS:Ljava/lang/String; = "android.settings.APP_NOTIFICATION_SETTINGS"

.field public static final ACTION_APP_OPS_SETTINGS:Ljava/lang/String; = "android.settings.APP_OPS_SETTINGS"

.field public static final ACTION_BATTERY_SAVER_SETTINGS:Ljava/lang/String; = "android.settings.BATTERY_SAVER_SETTINGS"

.field public static final ACTION_BLUETOOTH_SETTINGS:Ljava/lang/String; = "android.settings.BLUETOOTH_SETTINGS"

.field public static final ACTION_CAPTIONING_SETTINGS:Ljava/lang/String; = "android.settings.CAPTIONING_SETTINGS"

.field public static final ACTION_CAST_SETTINGS:Ljava/lang/String; = "android.settings.CAST_SETTINGS"

.field public static final ACTION_CONDITION_PROVIDER_SETTINGS:Ljava/lang/String; = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS"

.field public static final ACTION_DATA_ROAMING_SETTINGS:Ljava/lang/String; = "android.settings.DATA_ROAMING_SETTINGS"

.field public static final ACTION_DATE_SETTINGS:Ljava/lang/String; = "android.settings.DATE_SETTINGS"

.field public static final ACTION_DEVICE_INFO_SETTINGS:Ljava/lang/String; = "android.settings.DEVICE_INFO_SETTINGS"

.field public static final ACTION_DISPLAY_SETTINGS:Ljava/lang/String; = "android.settings.DISPLAY_SETTINGS"

.field public static final ACTION_DREAM_SETTINGS:Ljava/lang/String; = "android.settings.DREAM_SETTINGS"

.field public static final ACTION_HOME_SETTINGS:Ljava/lang/String; = "android.settings.HOME_SETTINGS"

.field public static final ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS:Ljava/lang/String; = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"

.field public static final ACTION_INPUT_METHOD_SETTINGS:Ljava/lang/String; = "android.settings.INPUT_METHOD_SETTINGS"

.field public static final ACTION_INPUT_METHOD_SUBTYPE_SETTINGS:Ljava/lang/String; = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"

.field public static final ACTION_INTERNAL_STORAGE_SETTINGS:Ljava/lang/String; = "android.settings.INTERNAL_STORAGE_SETTINGS"

.field public static final ACTION_LOCALE_SETTINGS:Ljava/lang/String; = "android.settings.LOCALE_SETTINGS"

.field public static final ACTION_LOCATION_SOURCE_SETTINGS:Ljava/lang/String; = "android.settings.LOCATION_SOURCE_SETTINGS"

.field public static final ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS:Ljava/lang/String; = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"

.field public static final ACTION_MANAGE_APPLICATIONS_SETTINGS:Ljava/lang/String; = "android.settings.MANAGE_APPLICATIONS_SETTINGS"

.field public static final ACTION_MANAGE_OVERLAY_PERMISSION:Ljava/lang/String; = "android.settings.action.MANAGE_OVERLAY_PERMISSION"

.field public static final ACTION_MANAGE_WRITE_SETTINGS:Ljava/lang/String; = "android.settings.action.MANAGE_WRITE_SETTINGS"

.field public static final ACTION_MEMORY_CARD_SETTINGS:Ljava/lang/String; = "android.settings.MEMORY_CARD_SETTINGS"

.field public static final ACTION_MONITORING_CERT_INFO:Ljava/lang/String; = "com.android.settings.MONITORING_CERT_INFO"

.field public static final ACTION_NETWORK_OPERATOR_SETTINGS:Ljava/lang/String; = "android.settings.NETWORK_OPERATOR_SETTINGS"

.field public static final ACTION_NFCSHARING_SETTINGS:Ljava/lang/String; = "android.settings.NFCSHARING_SETTINGS"

.field public static final ACTION_NFC_PAYMENT_SETTINGS:Ljava/lang/String; = "android.settings.NFC_PAYMENT_SETTINGS"

.field public static final ACTION_NFC_SETTINGS:Ljava/lang/String; = "android.settings.NFC_SETTINGS"

.field public static final ACTION_NOTIFICATION_LISTENER_SETTINGS:Ljava/lang/String; = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"

.field public static final ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS:Ljava/lang/String; = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"

.field public static final ACTION_NOTIFICATION_SETTINGS:Ljava/lang/String; = "android.settings.NOTIFICATION_SETTINGS"

.field public static final ACTION_PAIRING_SETTINGS:Ljava/lang/String; = "android.settings.PAIRING_SETTINGS"

.field public static final ACTION_PRINT_SETTINGS:Ljava/lang/String; = "android.settings.ACTION_PRINT_SETTINGS"

.field public static final ACTION_PRIVACY_SETTINGS:Ljava/lang/String; = "android.settings.PRIVACY_SETTINGS"

.field public static final ACTION_QUICK_LAUNCH_SETTINGS:Ljava/lang/String; = "android.settings.QUICK_LAUNCH_SETTINGS"

.field public static final ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS:Ljava/lang/String; = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"

.field public static final ACTION_SEARCH_SETTINGS:Ljava/lang/String; = "android.search.action.SEARCH_SETTINGS"

.field public static final ACTION_SECURITY_SETTINGS:Ljava/lang/String; = "android.settings.SECURITY_SETTINGS"

.field public static final ACTION_SETTINGS:Ljava/lang/String; = "android.settings.SETTINGS"

.field public static final ACTION_SHOW_INPUT_METHOD_PICKER:Ljava/lang/String; = "android.settings.SHOW_INPUT_METHOD_PICKER"

.field public static final ACTION_SHOW_REGULATORY_INFO:Ljava/lang/String; = "android.settings.SHOW_REGULATORY_INFO"

.field public static final ACTION_SOUND_SETTINGS:Ljava/lang/String; = "android.settings.SOUND_SETTINGS"

.field public static final ACTION_SYNC_SETTINGS:Ljava/lang/String; = "android.settings.SYNC_SETTINGS"

.field public static final ACTION_SYSTEM_UPDATE_SETTINGS:Ljava/lang/String; = "android.settings.SYSTEM_UPDATE_SETTINGS"

.field public static final ACTION_TRUSTED_CREDENTIALS_USER:Ljava/lang/String; = "com.android.settings.TRUSTED_CREDENTIALS_USER"

.field public static final ACTION_USAGE_ACCESS_SETTINGS:Ljava/lang/String; = "android.settings.USAGE_ACCESS_SETTINGS"

.field public static final ACTION_USER_DICTIONARY_INSERT:Ljava/lang/String; = "com.android.settings.USER_DICTIONARY_INSERT"

.field public static final ACTION_USER_DICTIONARY_SETTINGS:Ljava/lang/String; = "android.settings.USER_DICTIONARY_SETTINGS"

.field public static final ACTION_VOICE_CONTROL_AIRPLANE_MODE:Ljava/lang/String; = "android.settings.VOICE_CONTROL_AIRPLANE_MODE"

.field public static final ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE:Ljava/lang/String; = "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE"

.field public static final ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE:Ljava/lang/String; = "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE"

.field public static final ACTION_VOICE_INPUT_SETTINGS:Ljava/lang/String; = "android.settings.VOICE_INPUT_SETTINGS"

.field public static final ACTION_WIFI_IP_SETTINGS:Ljava/lang/String; = "android.settings.WIFI_IP_SETTINGS"

.field public static final ACTION_WIFI_SETTINGS:Ljava/lang/String; = "android.settings.WIFI_SETTINGS"

.field public static final ACTION_WIRELESS_SETTINGS:Ljava/lang/String; = "android.settings.WIRELESS_SETTINGS"

.field public static final ACTION_ZEN_MODE_AUTOMATION_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS"

.field public static final ACTION_ZEN_MODE_EVENT_RULE_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS"

.field public static final ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS"

.field public static final ACTION_ZEN_MODE_PRIORITY_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_PRIORITY_SETTINGS"

.field public static final ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS"

.field public static final ACTION_ZEN_MODE_SETTINGS:Ljava/lang/String; = "android.settings.ZEN_MODE_SETTINGS"

.field public static final AUTHORITY:Ljava/lang/String; = "settings"

.field public static final CALL_METHOD_GET_GLOBAL:Ljava/lang/String; = "GET_global"

.field public static final CALL_METHOD_GET_SECURE:Ljava/lang/String; = "GET_secure"

.field public static final CALL_METHOD_GET_SYSTEM:Ljava/lang/String; = "GET_system"

.field public static final CALL_METHOD_PUT_GLOBAL:Ljava/lang/String; = "PUT_global"

.field public static final CALL_METHOD_PUT_SECURE:Ljava/lang/String; = "PUT_secure"

.field public static final CALL_METHOD_PUT_SYSTEM:Ljava/lang/String; = "PUT_system"

.field public static final CALL_METHOD_USER_KEY:Ljava/lang/String; = "_user"

.field public static final DEVICE_NAME_SETTINGS:Ljava/lang/String; = "android.settings.DEVICE_NAME"

.field public static final EXTRA_ACCOUNT_TYPES:Ljava/lang/String; = "account_types"

.field public static final EXTRA_AIRPLANE_MODE_ENABLED:Ljava/lang/String; = "airplane_mode_enabled"

.field public static final EXTRA_APP_PACKAGE:Ljava/lang/String; = "app_package"

.field public static final EXTRA_APP_UID:Ljava/lang/String; = "app_uid"

.field public static final EXTRA_AUTHORITIES:Ljava/lang/String; = "authorities"

.field public static final EXTRA_BATTERY_SAVER_MODE_ENABLED:Ljava/lang/String; = "android.settings.extra.battery_saver_mode_enabled"

.field public static final EXTRA_DO_NOT_DISTURB_MODE_ENABLED:Ljava/lang/String; = "android.settings.extra.do_not_disturb_mode_enabled"

.field public static final EXTRA_DO_NOT_DISTURB_MODE_MINUTES:Ljava/lang/String; = "android.settings.extra.do_not_disturb_mode_minutes"

.field public static final EXTRA_INPUT_DEVICE_IDENTIFIER:Ljava/lang/String; = "input_device_identifier"

.field public static final EXTRA_INPUT_METHOD_ID:Ljava/lang/String; = "input_method_id"

.field public static final INTENT_CATEGORY_USAGE_ACCESS_CONFIG:Ljava/lang/String; = "android.intent.category.USAGE_ACCESS_CONFIG"

.field private static final JID_RESOURCE_PREFIX:Ljava/lang/String; = "android"

.field private static final LOCAL_LOGV:Z = false

.field public static final METADATA_USAGE_ACCESS_REASON:Ljava/lang/String; = "android.settings.metadata.USAGE_ACCESS_REASON"

.field private static final PM_CHANGE_NETWORK_STATE:[Ljava/lang/String;

.field private static final PM_SYSTEM_ALERT_WINDOW:[Ljava/lang/String;

.field private static final PM_WRITE_SETTINGS:[Ljava/lang/String;

.field private static final TAG:Ljava/lang/String; = "Settings"

.field private static final mLocationSettingsLock:Ljava/lang/Object;

# direct methods
.method static synthetic -get0()Ljava/lang/Object;
    .locals 1

    sget-object v0, Landroid/provider/Settings;->mLocationSettingsLock:Ljava/lang/Object;

    return-object v0
.end method

.method static constructor <clinit>()V
    .locals 4

    .prologue
    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 1240
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    sput-object v0, Landroid/provider/Settings;->mLocationSettingsLock:Ljava/lang/Object;

    .line 8313
    new-array v0, v3, [Ljava/lang/String;

    .line 8314
    const-string/jumbo v1, "android.permission.WRITE_SETTINGS"

    aput-object v1, v0, v2

    .line 8313
    sput-object v0, Landroid/provider/Settings;->PM_WRITE_SETTINGS:[Ljava/lang/String;

    .line 8316
    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/String;

    .line 8317
    const-string/jumbo v1, "android.permission.CHANGE_NETWORK_STATE"

    aput-object v1, v0, v2

    .line 8318
    const-string/jumbo v1, "android.permission.WRITE_SETTINGS"

    aput-object v1, v0, v3

    .line 8316
    sput-object v0, Landroid/provider/Settings;->PM_CHANGE_NETWORK_STATE:[Ljava/lang/String;

    .line 8320
    new-array v0, v3, [Ljava/lang/String;

    .line 8321
    const-string/jumbo v1, "android.permission.SYSTEM_ALERT_WINDOW"

    aput-object v1, v0, v2

    .line 8320
    sput-object v0, Landroid/provider/Settings;->PM_SYSTEM_ALERT_WINDOW:[Ljava/lang/String;

    .line 76
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 76
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static canDrawOverlays(Landroid/content/Context;)Z
    .locals 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 1431
    invoke-static {}, Landroid/os/Binder;->getCallingUid()I

    move-result v0

    .line 1432
    .local v0, "uid":I
    invoke-static {p0, v0}, Landroid/provider/Settings;->getPackageNameForUid(Landroid/content/Context;I)Ljava/lang/String;

    move-result-object v1

    .line 1433
    const/4 v2, 0x0

    .line 1432
    invoke-static {p0, v0, v1, v2}, Landroid/provider/Settings;->isCallingPackageAllowedToDrawOverlays(Landroid/content/Context;ILjava/lang/String;Z)Z

    move-result v1

    return v1
.end method

.method public static checkAndNoteChangeNetworkStateOperation(Landroid/content/Context;ILjava/lang/String;Z)Z
    .locals 7
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z

    .prologue
    const/4 v6, 0x1

    .line 8371
    const-string/jumbo v0, "android.permission.CHANGE_NETWORK_STATE"

    invoke-virtual {p0, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-nez v0, :cond_0

    .line 8373
    return v6

    .line 8377
    :cond_0
    sget-object v5, Landroid/provider/Settings;->PM_CHANGE_NETWORK_STATE:[Ljava/lang/String;

    .line 8376
    const/16 v4, 0x17

    move-object v0, p0

    move v1, p1

    move-object v2, p2

    move v3, p3

    .line 8375
    invoke-static/range {v0 .. v6}, Landroid/provider/Settings;->isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public static checkAndNoteDrawOverlaysOperation(Landroid/content/Context;ILjava/lang/String;Z)Z
    .locals 7
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z

    .prologue
    .line 8408
    sget-object v5, Landroid/provider/Settings;->PM_SYSTEM_ALERT_WINDOW:[Ljava/lang/String;

    .line 8407
    const/16 v4, 0x18

    .line 8408
    const/4 v6, 0x1

    move-object v0, p0

    move v1, p1

    move-object v2, p2

    move v3, p3

    .line 8406
    invoke-static/range {v0 .. v6}, Landroid/provider/Settings;->isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public static checkAndNoteWriteSettingsOperation(Landroid/content/Context;ILjava/lang/String;Z)Z
    .locals 7
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z

    .prologue
    .line 8353
    sget-object v5, Landroid/provider/Settings;->PM_WRITE_SETTINGS:[Ljava/lang/String;

    .line 8352
    const/16 v4, 0x17

    .line 8353
    const/4 v6, 0x1

    move-object v0, p0

    move v1, p1

    move-object v2, p2

    move v3, p3

    .line 8351
    invoke-static/range {v0 .. v6}, Landroid/provider/Settings;->isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public static getGTalkDeviceId(J)Ljava/lang/String;
    .locals 2
    .param p0, "androidId"    # J

    .prologue
    .line 8310
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v1, "android-"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-static {p0, p1}, Ljava/lang/Long;->toHexString(J)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static getPackageNameForUid(Landroid/content/Context;I)Ljava/lang/String;
    .locals 3
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I

    .prologue
    const/4 v2, 0x0

    .line 8480
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    invoke-virtual {v1, p1}, Landroid/content/pm/PackageManager;->getPackagesForUid(I)[Ljava/lang/String;

    move-result-object v0

    .line 8481
    .local v0, "packages":[Ljava/lang/String;
    if-nez v0, :cond_0

    .line 8482
    return-object v2

    .line 8484
    :cond_0
    const/4 v1, 0x0

    aget-object v1, v0, v1

    return-object v1
.end method

.method public static isCallingPackageAllowedToDrawOverlays(Landroid/content/Context;ILjava/lang/String;Z)Z
    .locals 7
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z

    .prologue
    .line 8391
    sget-object v5, Landroid/provider/Settings;->PM_SYSTEM_ALERT_WINDOW:[Ljava/lang/String;

    .line 8390
    const/16 v4, 0x18

    .line 8391
    const/4 v6, 0x0

    move-object v0, p0

    move v1, p1

    move-object v2, p2

    move v3, p3

    .line 8389
    invoke-static/range {v0 .. v6}, Landroid/provider/Settings;->isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public static isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z
    .locals 8
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z
    .param p4, "appOpsOpCode"    # I
    .param p5, "permissions"    # [Ljava/lang/String;
    .param p6, "makeNote"    # Z

    .prologue
    .line 8420
    if-nez p2, :cond_0

    .line 8421
    const/4 v5, 0x0

    return v5

    .line 8424
    :cond_0
    const-string/jumbo v5, "appops"

    invoke-virtual {p0, v5}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/AppOpsManager;

    .line 8425
    .local v0, "appOpsMgr":Landroid/app/AppOpsManager;
    const/4 v3, 0x3

    .line 8426
    .local v3, "mode":I
    if-eqz p6, :cond_2

    .line 8427
    invoke-virtual {v0, p4, p1, p2}, Landroid/app/AppOpsManager;->noteOpNoThrow(IILjava/lang/String;)I

    move-result v3

    .line 8432
    :goto_0
    packed-switch v3, :pswitch_data_0

    .line 8450
    :cond_1
    :pswitch_0
    if-nez p3, :cond_4

    .line 8451
    const/4 v5, 0x0

    return v5

    .line 8429
    :cond_2
    invoke-virtual {v0, p4, p1, p2}, Landroid/app/AppOpsManager;->checkOpNoThrow(IILjava/lang/String;)I

    move-result v3

    goto :goto_0

    .line 8434
    :pswitch_1
    const/4 v5, 0x1

    return v5

    .line 8440
    :pswitch_2
    const/4 v5, 0x0

    array-length v6, p5

    :goto_1
    if-ge v5, v6, :cond_1

    aget-object v4, p5, v5

    .line 8441
    .local v4, "permission":Ljava/lang/String;
    invoke-virtual {p0, v4}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I

    move-result v7

    if-nez v7, :cond_3

    .line 8444
    const/4 v5, 0x1

    return v5

    .line 8440
    :cond_3
    add-int/lit8 v5, v5, 0x1

    goto :goto_1

    .line 8456
    .end local v4    # "permission":Ljava/lang/String;
    :cond_4
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 8457
    .local v1, "exceptionMessage":Ljava/lang/StringBuilder;
    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 8458
    const-string/jumbo v5, " was not granted "

    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 8459
    array-length v5, p5

    const/4 v6, 0x1

    if-le v5, v6, :cond_5

    .line 8460
    const-string/jumbo v5, " either of these permissions: "

    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 8464
    :goto_2
    const/4 v2, 0x0

    .local v2, "i":I
    :goto_3
    array-length v5, p5

    if-ge v2, v5, :cond_7

    .line 8465
    aget-object v5, p5, v2

    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 8466
    array-length v5, p5

    add-int/lit8 v5, v5, -0x1

    if-ne v2, v5, :cond_6

    const-string/jumbo v5, "."

    :goto_4
    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 8464
    add-int/lit8 v2, v2, 0x1

    goto :goto_3

    .line 8462
    .end local v2    # "i":I
    :cond_5
    const-string/jumbo v5, " this permission: "

    invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_2

    .line 8466
    .restart local v2    # "i":I
    :cond_6
    const-string/jumbo v5, ", "

    goto :goto_4

    .line 8469
    :cond_7
    new-instance v5, Ljava/lang/SecurityException;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v5, v6}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V

    throw v5

    .line 8432
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_0
        :pswitch_0
        :pswitch_2
    .end packed-switch
.end method

.method public static isCallingPackageAllowedToWriteSettings(Landroid/content/Context;ILjava/lang/String;Z)Z
    .locals 7
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "uid"    # I
    .param p2, "callingPackage"    # Ljava/lang/String;
    .param p3, "throwException"    # Z

    .prologue
    .line 8335
    sget-object v5, Landroid/provider/Settings;->PM_WRITE_SETTINGS:[Ljava/lang/String;

    .line 8334
    const/16 v4, 0x17

    .line 8335
    const/4 v6, 0x0

    move-object v0, p0

    move v1, p1

    move-object v2, p2

    move v3, p3

    .line 8333
    invoke-static/range {v0 .. v6}, Landroid/provider/Settings;->isCallingPackageAllowedToPerformAppOpsProtectedOperation(Landroid/content/Context;ILjava/lang/String;ZI[Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method


text:
Path: Path for Pretty People
============================

.. image:: https://badges.gitter.im/Join%20Chat.svg
   :alt: Join the chat at https://gitter.im/mahanmarwat/path
   :target: https://gitter.im/mahanmarwat/path?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://readthedocs.org/projects/path/badge/?version=latest
  :target: https://readthedocs.org/projects/path/?badge=latest
  :alt: Documentation Status

Path provide highly **readable** API to access and manipulate both filesystem path and URL path.

All operations are available at module level as functions.

    >>> import path
    >>> path.cwd() # return current working directory.
    >>> path.chd() # change current working directory.
    ...

Operations are available as ``Path`` object methods too.

    >>> p = path.Path('c:\\hello\world.py')
    >>> p.name
    'world'
    >>> p.ext
    '.py'
    >>> p.ispath(path.EXIST) # check path or file existence.
    >>> p.isempty() # whether the file or dir is empty.
    ...

Individual classes for readability.

    >>> comp = path.Components('c:\\hello\world.py')
    >>> comp.name
    'world'
    >>> comp.ext
    '.py'

Unlike other packages, path also work on **URL** too. Which ease web-scrapper coding.

    >>> p = path.HttpPath('https://github.com/docopt/docopt')
    >>> p.path
    '/docopt/docopt'
    >>> p.create() # will create dir or file according to args.
    ...

Features
--------

- Work both on path and URL
- Highly readable API
- Provide constants
- Operations are available as functions and methods
- Individual classes for everything

Installation
------------

    $ pip install https://github.com/mahanmarwat/path/archive/master.zip

Documentation
-------------

http://path.readthedocs.org

Check ``path.py`` which is self explanatory.

I am not pretty, can I still use it?
------------------------------------

Sorry No, LOL! Yes you can.

Contribute
----------

Give us a star.

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("PInvoke.Msi")]
[assembly: AssemblyProduct("PInvoke.Msi")]
[assembly: AssemblyCopyright("Copyright ©  2015")]


text:
This class gives CodeIgniter an implementation of the Observer pattern, with a little added PubSub flavor. CodeIgniter already has a basic system for this this, in the form of the core Hooks class. However, it does not expose the ability to add your own hooks nor is it namespaced. This library adds both of those abilities.

**Naming Conventions**

1. **Hook:** The
2. **Topics:** The name of the hook fired, e.g. some.namespaced.topic

**Features**

1. Create hooks in `config/hooks.php` OR on the fly in code
2. Hooks are namedspaced, and so a hook call could fire multiple, parent hooks.
3. All native CodeIgniter usage.

##Listen for a hook call

**Method 1: In configuration file**

```php
<?php
	$default_mail_param = 'Unknown Email Info';
	$hook['notifications.email.sent'][] = array(
		'class'    => 'EmailLogger',
		'function' => 'LogSentEmail',
 		'filename' => 'EmailLogger.php',
 		'filepath' => 'hooks',
 		'params'   => $default_mail_param
	);

	$hook['notifications.email'][] = array(
		'class'    => 'EmailLogger',
		'function' => 'LogEmail',
 		'filename' => 'EmailLogger.php',
 		'filepath' => 'hooks',
 		'params'   => 'Some Email Activity Occured'
	);
```

**Method 2: In code**

Note that we can pass anything to the parameters - These will be used as defaults if no parameters are passed at the time of the hook being fired
```php
<?php
	$this->hook->register('notifications.email.sent',  array(
		'class'    => 'EmailLogger',
		'function' => 'LogSentEmail',
 		'filename' => 'EmailLogger.php',
 		'filepath' => 'hooks',
 		'params'   => 'Email sent'
	));

	$this->hook->register('notifications.email',  array(
		'class'    => 'EmailLogger',
		'function' => 'LogEmail',
 		'filename' => 'EmailLogger.php',
 		'filepath' => 'hooks',
 		'params'   => 'Some Email Activity Occured'
	));
```

## Fire a hook, so listening callbacks will be executed
Note that we can pass anything to the parameters - in this case, we're passing an array with data on a sent email

```php
<?php
	class Email {
		public function __construct() {
			$this->CI =& get_instance();
		}

		public function sendEmail(to, $subject, $message) {
			if(mail($to, $subject, $message)) {
				$this->CI->hook->call('notifications.email.sent', array('to' => $to, 'from' => $from, 'message' => $message));
				return TRUE;
			}
			return FALSE;
		}
	}
```

## Create code for hooks:

`application/hooks/EmailLogger.php`

```php
<?php
	class EmailLogger {
		public function LogSentEmail($data) {
			log_message('debug', print_r($data, TRUE));
		}

		public function LogEmail($data)) {
			log_message('debug', print_r($data, TRUE));
		}
	}
```

## What's happening?
We call hooks once in our Email class, however BOTH registered hooks will be called. This is the power of namespaced hooks - The parent namespaced items get called as well. This allows a developer to listen in on any activity or specific activity of fired hooks.

Let's say we fire the hook:  `notifications.email.sent.complete`
This will perform the function callbacks on any hook listening for:

* notifications.email.sent.complete
* notifications.email.sent
* notifications.email
* notifications

Note that there won't necessarily be hooks listening to each of those topics. Hooks with no listeners are not fired. Also, a hook listening to `notifications.email` might not be expected the data it receives, if the data passed was for `notifications.email.sent.complete`, so code structed around namespaced callbacks needs to be created carefully. Sloppy or inexperienced programmers can make your life hell using the Observer model.

## License
MIT


text:
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/network/tcp_client_socket_brokered.h"

#include "base/test/bind.h"
#include "base/test/scoped_run_loop_timeout.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_source.h"
#include "net/nqe/network_quality_estimator_test_util.h"
#include "net/socket/connection_attempts.h"
#include "net/socket/socket_performance_watcher.h"
#include "net/socket/socket_test_util.h"
#include "net/socket/tcp_server_socket.h"
#include "net/socket/transport_client_socket_test_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/brokered_client_socket_factory.h"
#include "services/network/test/test_socket_broker_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

using net::test::IsError;
using net::test::IsOk;
using testing::Not;

namespace network {

class TCPClientSocketBrokeredTest : public testing::Test,
                                    public net::WithTaskEnvironment {
 public:
  TCPClientSocketBrokeredTest()
      : receiver_(&socket_broker_impl_),
        client_socket_factory_(
            BrokeredClientSocketFactory(receiver_.BindNewPipeAndPassRemote())) {
  }

  ~TCPClientSocketBrokeredTest() override = default;

  void SetUp() override {
    // Open a server socket on an ephemeral port.
    listen_socket =
        std::make_unique<net::TCPServerSocket>(nullptr, net::NetLogSource());
    net::IPEndPoint local_address(net::IPAddress::IPv4Localhost(), 0);
    ASSERT_THAT(listen_socket->Listen(local_address, 1), IsOk());
    // Get the server's address (including the actual port number).
    ASSERT_THAT(listen_socket->GetLocalAddress(&local_address), IsOk());
    listen_socket->Accept(&server_socket_, server_callback_.callback());
    net::AddressList addr = net::AddressList::CreateFromIPAddress(
        net::IPAddress::IPv4Localhost(), local_address.port());

    socket_ = client_socket_factory_.CreateTransportClientSocket(
        addr, nullptr, nullptr, net::NetLog::Get(), net::NetLogSource());

    // Confirm that we fail gracefully when making certain calls before
    // connecting.
    net::IPEndPoint test_address;
    EXPECT_EQ(socket_->GetPeerAddress(&test_address),
              net::ERR_SOCKET_NOT_CONNECTED);
    EXPECT_EQ(socket_->GetLocalAddress(&test_address),
              net::ERR_SOCKET_NOT_CONNECTED);
    EXPECT_EQ(socket_->SetReceiveBufferSize(256),
              net::ERR_SOCKET_NOT_CONNECTED);
    EXPECT_EQ(socket_->SetSendBufferSize(256), net::ERR_SOCKET_NOT_CONNECTED);
  }

  void ConnectClientSocket(net::TestCompletionCallback* connect_callback) {
    int connect_result = socket_->Connect(connect_callback->callback());

    if (connect_result != net::OK) {
      ASSERT_EQ(connect_result, net::ERR_IO_PENDING);
      int accept_result = server_callback_.WaitForResult();
      connect_result = connect_callback->WaitForResult();
      EXPECT_EQ(accept_result, net::OK);
      EXPECT_EQ(connect_result, net::OK);
    }
    EXPECT_TRUE(socket_->IsConnected());
    EXPECT_THAT(connect_callback->GetResult(connect_result), IsOk());
    net::IPEndPoint test_address;
    EXPECT_THAT(socket_->GetPeerAddress(&test_address), IsOk());
    EXPECT_THAT(socket_->GetLocalAddress(&test_address), IsOk());
    EXPECT_THAT(socket_->SetReceiveBufferSize(256), IsOk());
    EXPECT_THAT(socket_->SetSendBufferSize(256), IsOk());
  }

 protected:
  std::unique_ptr<net::TransportClientSocket> socket_;
  std::unique_ptr<net::TCPServerSocket> listen_socket;
  std::unique_ptr<net::StreamSocket> server_socket_;
  mojo::Receiver<mojom::SocketBroker> receiver_;
  BrokeredClientSocketFactory client_socket_factory_;
  net::TestCompletionCallback server_callback_;

  net::MockClientSocketFactory mock_client_socket_factory_;
  net::StaticSocketDataProvider data_;

  TestSocketBrokerImpl socket_broker_impl_;

  bool close_server_socket_on_next_send_;
};

TEST_F(TCPClientSocketBrokeredTest, FailedConnect) {
  net::TestCompletionCallback callback;
  base::test::ScopedDisableRunLoopTimeout disable_timeout;

  socket_broker_impl_.SetMockSocketTest(true);

  int result = socket_->Connect(callback.callback());

  ASSERT_EQ(result, net::ERR_IO_PENDING);
  result = callback.WaitForResult();
  EXPECT_EQ(result, net::ERR_CONNECTION_FAILED);
}

TEST_F(TCPClientSocketBrokeredTest, WasEverUsed) {
  net::TestCompletionCallback callback;
  EXPECT_FALSE(socket_->WasEverUsed());

  // Writing before connecting should return ERR_SOCKET_NOT_CONNECTED
  const char kRequest[] = "GET / HTTP/1.0";
  auto write_buffer = base::MakeRefCounted<net::StringIOBuffer>(kRequest);
  net::TestCompletionCallback write_callback_before_connect;
  int result = socket_->Write(write_buffer.get(), write_buffer->size(),
                              write_callback_before_connect.callback(),
                              TRAFFIC_ANNOTATION_FOR_TESTS);
  EXPECT_EQ(result, net::ERR_SOCKET_NOT_CONNECTED);
  ConnectClientSocket(&callback);

  // Just connecting the socket should not set WasEverUsed.
  EXPECT_FALSE(socket_->WasEverUsed());

  // Writing some data to the socket _should_ set WasEverUsed.
  net::TestCompletionCallback write_callback_after_connect;
  result = socket_->Write(write_buffer.get(), write_buffer->size(),
                          write_callback_after_connect.callback(),
                          TRAFFIC_ANNOTATION_FOR_TESTS);
  EXPECT_TRUE(socket_->WasEverUsed());
  socket_->Disconnect();
  EXPECT_FALSE(socket_->IsConnected());

  EXPECT_TRUE(socket_->WasEverUsed());

  socket_->Disconnect();
}

TEST_F(TCPClientSocketBrokeredTest, SetKeepAlive) {
  net::TestCompletionCallback callback;

  // Non-connected sockets should not be able to set KeepAlive.
  ASSERT_FALSE(socket_->IsConnected());
  EXPECT_FALSE(socket_->SetKeepAlive(true /* enable */, 14 /* delay */));

  ConnectClientSocket(&callback);

  // Connected sockets should be able to enable and disable KeepAlive.
  ASSERT_TRUE(socket_->IsConnected());
  EXPECT_TRUE(socket_->SetKeepAlive(true /* enable */, 22 /* delay */));
  EXPECT_TRUE(socket_->SetKeepAlive(false /* disable */, 3 /* delay */));

  socket_->Disconnect();
}

TEST_F(TCPClientSocketBrokeredTest, SetNoDelay) {
  net::TestCompletionCallback callback;

  // Non-connected sockets should not be able to set NoDelay.
  ASSERT_FALSE(socket_->IsConnected());
  EXPECT_FALSE(socket_->SetNoDelay(true /* no_delay */));

  ConnectClientSocket(&callback);

  // Connected sockets should be able to enable and disable NoDelay.
  ASSERT_TRUE(socket_->IsConnected());
  EXPECT_TRUE(socket_->SetNoDelay(true /* no_delay */));
  EXPECT_TRUE(socket_->SetNoDelay(false /* no_delay */));

  socket_->Disconnect();
}

TEST_F(TCPClientSocketBrokeredTest, CancelReadIfReady) {
  net::TestCompletionCallback callback;
  ASSERT_FALSE(socket_->IsConnected());

  net::TestCompletionCallback read_callback;
  auto read_buf = base::MakeRefCounted<net::IOBuffer>(1);

  // Check that we gracefully fail when attempting to read or cancel reads
  // before connecting.
  ASSERT_EQ(socket_->Read(read_buf.get(), 1, read_callback.callback()),
            net::ERR_SOCKET_NOT_CONNECTED);
  ASSERT_EQ(socket_->ReadIfReady(read_buf.get(), 1, read_callback.callback()),
            net::ERR_SOCKET_NOT_CONNECTED);
  ASSERT_EQ(socket_->CancelReadIfReady(), net::ERR_SOCKET_NOT_CONNECTED);

  // Confirm no bytes have been read
  ASSERT_EQ(socket_->GetTotalReceivedBytes(), 0);

  ConnectClientSocket(&callback);

  // Attempt to read from the socket. There will not be anything to read.
  // Cancel the read immediately afterwards.
  int read_ret =
      socket_->ReadIfReady(read_buf.get(), 1, read_callback.callback());
  ASSERT_THAT(read_ret, IsError(net::ERR_IO_PENDING));
  ASSERT_THAT(socket_->CancelReadIfReady(), IsOk());

  // After the client writes data, the server should still not pick up a result.
  auto write_buf = base::MakeRefCounted<net::StringIOBuffer>("a");
  net::TestCompletionCallback write_callback;
  ASSERT_EQ(write_callback.GetResult(server_socket_->Write(
                write_buf.get(), write_buf->size(), write_callback.callback(),
                TRAFFIC_ANNOTATION_FOR_TESTS)),
            write_buf->size());
  base::RunLoop().RunUntilIdle();
  EXPECT_FALSE(read_callback.have_result());

  // After a canceled read, future reads are still possible.
  while (true) {
    net::TestCompletionCallback read_callback2;
    read_ret =
        socket_->ReadIfReady(read_buf.get(), 1, read_callback2.callback());
    if (read_ret != net::ERR_IO_PENDING) {
      break;
    }
    ASSERT_THAT(read_callback2.GetResult(read_ret), IsOk());
  }
  EXPECT_EQ(socket_->GetTotalReceivedBytes(), 1);
  ASSERT_EQ(1, read_ret);
  EXPECT_EQ(read_buf->data()[0], 'a');

  socket_->Disconnect();
}

// IsConnected, FullDuplex_ReadFirst, and FullDuplex_WriteFirst are duplicated
// from transport_client_socket_unittest.cc since tests in //net can't depend on
// anything outside of //net.
TEST_F(TCPClientSocketBrokeredTest, IsConnected) {
  scoped_refptr<net::IOBuffer> buf = base::MakeRefCounted<net::IOBuffer>(4096);
  net::TestCompletionCallback callback;
  uint32_t bytes_read;
  const char kServerReply[] = "HTTP/1.1 404 Not Found";

  EXPECT_FALSE(socket_->IsConnected());
  EXPECT_FALSE(socket_->IsConnectedAndIdle());

  ConnectClientSocket(&callback);

  EXPECT_TRUE(socket_->IsConnected());
  EXPECT_TRUE(socket_->IsConnectedAndIdle());

  // Send the request and wait for the server to respond.
  net::SendRequestAndResponse(socket_.get(), server_socket_.get());

  // Drain a single byte so we know we've received some data.
  bytes_read =
      net::DrainStreamSocket(socket_.get(), buf.get(), 1, 1, &callback);
  ASSERT_EQ(bytes_read, 1u);

  // Socket should be considered connected, but not idle, due to
  // pending data.
  EXPECT_TRUE(socket_->IsConnected());
  EXPECT_FALSE(socket_->IsConnectedAndIdle());

  bytes_read = net::DrainStreamSocket(socket_.get(), buf.get(), 4096,
                                      strlen(kServerReply) - 1, &callback);
  ASSERT_EQ(bytes_read, strlen(kServerReply) - 1);

  // After draining the data, the socket should be back to connected
  // and idle.
  EXPECT_TRUE(socket_->IsConnected());
  EXPECT_TRUE(socket_->IsConnectedAndIdle());

  // This time close the server socket immediately after the server response.
  net::SendRequestAndResponse(socket_.get(), server_socket_.get());
  server_socket_.reset();

  bytes_read =
      net::DrainStreamSocket(socket_.get(), buf.get(), 1, 1, &callback);
  ASSERT_EQ(bytes_read, 1u);

  // As above because of data.
  EXPECT_TRUE(socket_->IsConnected());
  EXPECT_FALSE(socket_->IsConnectedAndIdle());

  bytes_read = net::DrainStreamSocket(socket_.get(), buf.get(), 4096,
                                      strlen(kServerReply) - 1, &callback);
  ASSERT_EQ(bytes_read, strlen(kServerReply) - 1);

  // Once the data is drained, the socket should now be seen as not
  // connected.
  if (socket_->IsConnected()) {
    // In the unlikely event that the server's connection closure is not
    // processed in time, wait for the connection to be closed.
    int rv = socket_->Read(buf.get(), 4096, callback.callback());
    EXPECT_EQ(0, callback.GetResult(rv));
    EXPECT_FALSE(socket_->IsConnected());
  }
  EXPECT_FALSE(socket_->IsConnectedAndIdle());
}

TEST_F(TCPClientSocketBrokeredTest, FullDuplex_ReadFirst) {
  net::TestCompletionCallback callback;
  ConnectClientSocket(&callback);

  // Read first.  There's no data, so it should return ERR_IO_PENDING.
  const int kBufLen = 4096;
  scoped_refptr<net::IOBuffer> buf =
      base::MakeRefCounted<net::IOBuffer>(kBufLen);
  int rv = socket_->Read(buf.get(), kBufLen, callback.callback());
  EXPECT_THAT(rv, IsError(net::ERR_IO_PENDING));

  const int kWriteBufLen = 64 * 1024;
  scoped_refptr<net::IOBuffer> request_buffer =
      base::MakeRefCounted<net::IOBuffer>(kWriteBufLen);
  char* request_data = request_buffer->data();
  memset(request_data, 'A', kWriteBufLen);
  net::TestCompletionCallback write_callback;

  int bytes_written = 0;
  while (true) {
    rv =
        socket_->Write(request_buffer.get(), kWriteBufLen,
                       write_callback.callback(), TRAFFIC_ANNOTATION_FOR_TESTS);
    ASSERT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING);
    if (rv == net::ERR_IO_PENDING) {
      net::ReadDataOfExpectedLength(server_socket_.get(), bytes_written);
      net::SendServerResponse(server_socket_.get());
      rv = write_callback.WaitForResult();
      break;
    }
    bytes_written += rv;
  }

  // At this point, both read and write have returned ERR_IO_PENDING, and the
  // write callback has executed.  We wait for the read callback to run now to
  // make sure that the socket can handle full duplex communications.

  rv = callback.WaitForResult();
  EXPECT_GE(rv, 0);
}

TEST_F(TCPClientSocketBrokeredTest, FullDuplex_WriteFirst) {
  net::TestCompletionCallback callback;
  ConnectClientSocket(&callback);

  const int kWriteBufLen = 64 * 1024;
  scoped_refptr<net::IOBuffer> request_buffer =
      base::MakeRefCounted<net::IOBuffer>(kWriteBufLen);
  char* request_data = request_buffer->data();
  memset(request_data, 'A', kWriteBufLen);
  net::TestCompletionCallback write_callback;

  int bytes_written = 0;
  while (true) {
    int rv =
        socket_->Write(request_buffer.get(), kWriteBufLen,
                       write_callback.callback(), TRAFFIC_ANNOTATION_FOR_TESTS);
    ASSERT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING);

    if (rv == net::ERR_IO_PENDING)
      break;
    bytes_written += rv;
  }

  // Now we have the Write() blocked on ERR_IO_PENDING.  It's time to force the
  // Read() to block on ERR_IO_PENDING too.

  const int kBufLen = 4096;
  scoped_refptr<net::IOBuffer> buf =
      base::MakeRefCounted<net::IOBuffer>(kBufLen);
  while (true) {
    int rv = socket_->Read(buf.get(), kBufLen, callback.callback());
    ASSERT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING);
    if (rv == net::ERR_IO_PENDING)
      break;
  }

  // At this point, both read and write have returned ERR_IO_PENDING.  Now we
  // run the write and read callbacks to make sure they can handle full duplex
  // communications.

  net::ReadDataOfExpectedLength(server_socket_.get(), bytes_written);
  net::SendServerResponse(server_socket_.get());
  int rv = write_callback.WaitForResult();
  EXPECT_GE(rv, 0);

  rv = callback.WaitForResult();
  EXPECT_GT(rv, 0);
}

// Duplicated from tcp_client_socket_unittest.cc since tests in //net can't
// depend on anything outside of //net.
//
// On Android, where socket tagging is
// supported, verify that TCPClientSocketBrokered::Tag works as expected.
#if BUILDFLAG(IS_ANDROID)
TEST_F(TCPClientSocketBrokeredTest, Tag) {
  if (!net::CanGetTaggedBytes()) {
    DVLOG(0) << "Skipping test - GetTaggedBytes unsupported.";
    return;
  }

  // Start test server.
  net::EmbeddedTestServer test_server;
  test_server.AddDefaultHandlers(base::FilePath());
  ASSERT_TRUE(test_server.Start());

  net::AddressList addr_list;
  ASSERT_TRUE(test_server.GetAddressList(&addr_list));

  TCPClientSocketBrokered client_socket(addr_list, nullptr, nullptr, nullptr,
                                        net::NetLogSource(),
                                        &client_socket_factory_);

  // Verify TCP connect packets are tagged and counted properly.
  int32_t tag_val1 = 0x12345678;
  uint64_t old_traffic = net::GetTaggedBytes(tag_val1);
  net::SocketTag tag1(net::SocketTag::UNSET_UID, tag_val1);
  client_socket.ApplySocketTag(tag1);

  // Connect socket.
  net::TestCompletionCallback connect_callback;
  int connect_result = client_socket.Connect(connect_callback.callback());
  EXPECT_THAT(connect_callback.GetResult(connect_result), IsOk());
  EXPECT_GT(net::GetTaggedBytes(tag_val1), old_traffic);

  // Verify socket can be retagged with a new value and the current process's
  // UID.
  int32_t tag_val2 = 0x87654321;
  old_traffic = net::GetTaggedBytes(tag_val2);
  net::SocketTag tag2(getuid(), tag_val2);
  client_socket.ApplySocketTag(tag2);
  const char kRequest1[] = "GET / HTTP/1.0";
  scoped_refptr<net::IOBuffer> write_buffer1 =
      base::MakeRefCounted<net::StringIOBuffer>(kRequest1);
  net::TestCompletionCallback write_callback1;
  EXPECT_EQ(client_socket.Write(write_buffer1.get(), strlen(kRequest1),
                                write_callback1.callback(),
                                TRAFFIC_ANNOTATION_FOR_TESTS),
            static_cast<int>(strlen(kRequest1)));
  EXPECT_GT(net::GetTaggedBytes(tag_val2), old_traffic);

  // Verify socket can be retagged with a new value and the current process's
  // UID.
  old_traffic = net::GetTaggedBytes(tag_val1);
  client_socket.ApplySocketTag(tag1);
  const char kRequest2[] = "\n\n";
  scoped_refptr<net::IOBufferWithSize> write_buffer2 =
      base::MakeRefCounted<net::IOBufferWithSize>(strlen(kRequest2));
  memmove(write_buffer2->data(), kRequest2, strlen(kRequest2));
  net::TestCompletionCallback write_callback2;
  EXPECT_EQ(client_socket.Write(write_buffer2.get(), strlen(kRequest2),
                                write_callback2.callback(),
                                TRAFFIC_ANNOTATION_FOR_TESTS),
            static_cast<int>(strlen(kRequest2)));
  EXPECT_GT(net::GetTaggedBytes(tag_val1), old_traffic);

  client_socket.Disconnect();
}
#endif  // BUILDFLAG(IS_ANDROID)

}  // namespace network


text:
steroids.drawers.disable
=======================

> Disables the possibility to open a drawer by user gesture.

    steroids.drawers.disable();

Description
-----------

This function disables the use of gestures to show or hide drawers.

Parameters
----------

- __side__: Choose which side drawer to disable. Possible values: `left` and `right`.

Callbacks
---------

- __onSuccess__: Called once the drawer gesture has been disabled.
- __onFailure__: Called if the drawer gesture could not be disabled.

Supported Platforms
-------------------

- iOS, Android


text:
import { fileURLToPath, URL } from 'url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
})


text:
/*****************************************************************************
*   "Gif-Lib" - Yet another gif library.				     *
*									     *
* Written by:  Gershon Elber				Ver 0.1, Jul. 1989   *
******************************************************************************
* Program to clip an image and dump out only portion of it.		     *
* Options:								     *
* -q : quiet printing mode.						     *
* -i left top width bottom : clipping information for first image.	     *
* -n n left top width bottom : clipping information for nth image.	     *
* -c complement; remove the bands specified by -i or -n			     *
* -h : on-line help							     *
******************************************************************************
* History:								     *
* 8 Jul 89 - Version 1.0 by Gershon Elber.				     *
*****************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef __MSDOS__
#include <stdlib.h>
#include <alloc.h>
#endif /* __MSDOS__ */

#ifndef __MSDOS__
#include <stdlib.h>
#endif
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "gif_lib.h"
#include "getarg.h"

#define PROGRAM_NAME	"GifClip"

#ifdef __MSDOS__
extern unsigned int
    _stklen = 16384;			     /* Increase default stack size. */
#endif /* __MSDOS__ */

#ifdef SYSV
static char *VersionStr =
        "Gif toolkit module,\t\tGershon Elber\n\
	(C) Copyright 1989 Gershon Elber.\n";
static char
    *CtrlStr = "GifClip q%- c%- i%-Xmin|Ymin|Xmax|Ymax!d!d!d!d n%-n|Xmin|Ymin|Xmax|Ymax!d!d!d!d!d h%- GifFile!*s";
#else
static char
    *VersionStr =
	PROGRAM_NAME
	GIF_LIB_VERSION
	"	Gershon Elber,	"
	__DATE__ ",   " __TIME__ "\n"
	"(C) Copyright 1989 Gershon Elber.\n";
static char
    *CtrlStr =
	PROGRAM_NAME
	" q%- c%- i%-Xmin|Ymin|Xmax|Ymax!d!d!d!d n%-n|Xmin|Ymin|Xmax|Ymax!d!d!d!d!d h%- GifFile!*s";
#endif /* SYSV */

static void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut);

/******************************************************************************
* Interpret the command line and scan the given GIF file.		      *
******************************************************************************/
int main(int argc, char **argv)
{
    int	i, Error, NumFiles, ExtCode, CodeSize, ImageNum = 0,
	ImageFlag = FALSE, ImageNFlag = FALSE, ImageN, ImageX1, ImageY1,
	ImageX2, ImageY2, ImageWidth, ImageDepth,
	Complement = FALSE, HelpFlag = FALSE;
    GifRecordType RecordType;
    GifByteType *Extension, *CodeBlock;
    char **FileName = NULL;
    GifRowType Line;
    GifFileType *GifFileIn = NULL, *GifFileOut = NULL;

    /* Same image dimension vars for both Image & ImageN as only one allowed.*/
    if ((Error = GAGetArgs(argc, argv, CtrlStr, &GifQuietPrint, &Complement,
		&ImageFlag, &ImageX1, &ImageY1, &ImageX2, &ImageY2,
		&ImageNFlag, &ImageN, &ImageX1, &ImageY1, &ImageX2, &ImageY2,
		&HelpFlag, &NumFiles, &FileName)) != FALSE ||
		(NumFiles > 1 && !HelpFlag)) {
	if (Error)
	    GAPrintErrMsg(Error);
	else if (NumFiles > 1)
	    GIF_MESSAGE("Error in command line parsing - one GIF file please.");
	GAPrintHowTo(CtrlStr);
	exit(EXIT_FAILURE);
    }

    if (HelpFlag) {
	fprintf(stderr, VersionStr);
	GAPrintHowTo(CtrlStr);
	exit(EXIT_SUCCESS);
    }

    /* Test to make sure exactly one of ImageFlag & ImageNFlag is set: */
    if ((ImageFlag && ImageNFlag) || (!ImageFlag && !ImageNFlag)) {
	GIF_MESSAGE("Exactly one of [-i ...] && [-n ...] please.");
	GAPrintHowTo(CtrlStr);
	exit(EXIT_FAILURE);
    }
    if (ImageFlag) ImageN = 1;		    /* Its first image we are after. */

    /* Make sure the first coordinates of clipping box are smaller: */
    if (ImageX1 > ImageX2) {
	i = ImageX1;
	ImageX1 = ImageX2;
	ImageX2 = i;
    }
    if (ImageY1 > ImageY2) {
	i = ImageX1;
	ImageY1 = ImageY2;
	ImageY2 = i;
    }

    if (NumFiles == 1) {
	if ((GifFileIn = DGifOpenFileName(*FileName)) == NULL)
	    QuitGifError(GifFileIn, GifFileOut);
    }
    else {
	/* Use the stdin instead: */
	if ((GifFileIn = DGifOpenFileHandle(0)) == NULL)
	    QuitGifError(GifFileIn, GifFileOut);
    }

    /* Open stdout for the output file: */
    if ((GifFileOut = EGifOpenFileHandle(1)) == NULL)
	QuitGifError(GifFileIn, GifFileOut);

    /* Width and depth of clipped image. */
    if (!Complement)
	ImageWidth = ImageX2 - ImageX1 + 1;
    else
	ImageWidth = GifFileIn->SWidth
	    - (ImageX2 != ImageX1) * (ImageX2 - ImageX1 + 1);
    if (!Complement)
	ImageDepth = ImageY2 - ImageY1 + 1;
    else
	ImageDepth = GifFileIn->SHeight
	    - (ImageY2 != ImageY1) * (ImageY2 - ImageY1 + 1);

    /* And dump out exactly same screen information: */
    if (EGifPutScreenDesc(GifFileOut,
	GifFileIn->SWidth, GifFileIn->SHeight,
	GifFileIn->SColorResolution, GifFileIn->SBackGroundColor,
	GifFileIn->SColorMap) == GIF_ERROR)
	QuitGifError(GifFileIn, GifFileOut);

    /* Scan the content of the GIF file and load the image(s) in: */
    do {
	if (DGifGetRecordType(GifFileIn, &RecordType) == GIF_ERROR)
	    QuitGifError(GifFileIn, GifFileOut);

	switch (RecordType) {
	    case IMAGE_DESC_RECORD_TYPE:
		if (DGifGetImageDesc(GifFileIn) == GIF_ERROR)
		    QuitGifError(GifFileIn, GifFileOut);
		if (++ImageNum == ImageN) {
		    /* We can handle only non interlaced images here: */
		    if (GifFileIn->Image.Interlace)
			GIF_EXIT("Image to clip is interlaced - use GifInter first.");

		    /* This is the image we should clip - test sizes and     */
		    /* dump out new clipped screen descriptor if o.k.	     */
		    if (GifFileIn->Image.Width <= ImageX2 ||
			GifFileIn->Image.Height <= ImageY2)
			GIF_EXIT("Image is smaller than given clip dimensions.");

		    /* Put the image descriptor to out file: */
		    if (EGifPutImageDesc(GifFileOut,
			GifFileIn->Image.Left, GifFileIn->Image.Top,
			ImageWidth, ImageDepth,
			FALSE, GifFileIn->Image.ColorMap) == GIF_ERROR)
			QuitGifError(GifFileIn, GifFileOut);

		    /* o.k. - read the image and clip it: */
		    Line = (GifRowType) malloc(GifFileIn->Image.Width *
							sizeof(GifPixelType));
		    GifQprintf("\n%s: Image %d at (%d, %d) [%dx%d]:     ",
			PROGRAM_NAME, ImageNum,
			GifFileIn->Image.Left, GifFileIn->Image.Top,
			GifFileIn->Image.Width, GifFileIn->Image.Height);

		    /* Skip lines below ImageY1: */
		    for (i = 0; i < ImageY1; i++) {
			if (DGifGetLine(GifFileIn, Line, GifFileIn->Image.Width)
			    == GIF_ERROR)
			    QuitGifError(GifFileIn, GifFileOut);

			if (Complement) {
			    if (ImageX1 == ImageX2) {
				/* don't remove any vertical band */
				if (EGifPutLine(GifFileOut, Line,
						ImageWidth) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);
			    }
			    else
			    {
				if (EGifPutLine(GifFileOut, Line,
						ImageX1) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);

				if (EGifPutLine(GifFileOut,
						&Line[ImageX2 + 1],
						GifFileIn->SWidth - (ImageX2 + 1)
						) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);
			    }
			}

			GifQprintf("\b\b\b\b%-4d", i);
		    }

		    /* Clip the lines from ImageY1 to ImageY2 (to X1 - X2): */
		    for (i = ImageY1; i <= ImageY2; i++) {
			if (DGifGetLine(GifFileIn, Line, GifFileIn->Image.Width)
			    == GIF_ERROR)
			    QuitGifError(GifFileIn, GifFileOut);

			if (!Complement)
			    if (EGifPutLine(GifFileOut, &Line[ImageX1],
					    ImageWidth) == GIF_ERROR)
				QuitGifError(GifFileIn, GifFileOut);

			GifQprintf("\b\b\b\b%-4d", i);
		    }

		    /* Skip lines above ImageY2: */
		    for (i = ImageY2 + 1; i < GifFileIn->Image.Height; i++) {
			if (DGifGetLine(GifFileIn, Line, GifFileIn->Image.Width)
			    == GIF_ERROR)
			    QuitGifError(GifFileIn, GifFileOut);

			if (Complement) {
			    if (ImageX1 == ImageX2) {
				/* don't remove any vertical band */
				if (EGifPutLine(GifFileOut, Line,
						ImageWidth) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);
			    }
			    else
			    {
				if (EGifPutLine(GifFileOut, Line,
						ImageX1) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);

				if (EGifPutLine(GifFileOut,
						&Line[ImageX2 + 1],
						GifFileIn->SWidth - (ImageX2 + 1)
						) == GIF_ERROR)
				    QuitGifError(GifFileIn, GifFileOut);
			    }
			}

			GifQprintf("\b\b\b\b%-4d", i);
		    }

		    free((char *) Line);
		}
		else {
		    /* Copy the image as is (we dont modify this one): */
		    if (EGifPutImageDesc(GifFileOut,
			GifFileIn->Image.Left, GifFileIn->Image.Top,
			GifFileIn->Image.Width, GifFileIn->Image.Height,
			GifFileIn->Image.Interlace,
			GifFileIn->Image.ColorMap) == GIF_ERROR)
			QuitGifError(GifFileIn, GifFileOut);

		    /* Now read image itself in decoded form as we dont      */
		    /* really care what is there, and this is much faster.   */
		    if (DGifGetCode(GifFileIn, &CodeSize, &CodeBlock) == GIF_ERROR
		     || EGifPutCode(GifFileOut, CodeSize, CodeBlock) == GIF_ERROR)
			QuitGifError(GifFileIn, GifFileOut);
		    while (CodeBlock != NULL)
			if (DGifGetCodeNext(GifFileIn, &CodeBlock) == GIF_ERROR ||
			    EGifPutCodeNext(GifFileOut, CodeBlock) == GIF_ERROR)
			    QuitGifError(GifFileIn, GifFileOut);
		}
		break;
	    case EXTENSION_RECORD_TYPE:
		/* Skip any extension blocks in file: */
		if (DGifGetExtension(GifFileIn, &ExtCode, &Extension) == GIF_ERROR)
		    QuitGifError(GifFileIn, GifFileOut);
		if (EGifPutExtension(GifFileOut, ExtCode, Extension[0],
							Extension) == GIF_ERROR)
		    QuitGifError(GifFileIn, GifFileOut);

		/* No support to more than one extension blocks, so discard: */
		while (Extension != NULL) {
		    if (DGifGetExtensionNext(GifFileIn, &Extension) == GIF_ERROR)
			QuitGifError(GifFileIn, GifFileOut);
		}
		break;
	    case TERMINATE_RECORD_TYPE:
		break;
	    default:		    /* Should be traps by DGifGetRecordType. */
		break;
	}
    }
    while (RecordType != TERMINATE_RECORD_TYPE);

    if (DGifCloseFile(GifFileIn) == GIF_ERROR)
	QuitGifError(GifFileIn, GifFileOut);
    if (EGifCloseFile(GifFileOut) == GIF_ERROR)
	QuitGifError(GifFileIn, GifFileOut);

    return 0;
}

/******************************************************************************
* Close both input and output file (if open), and exit.			      *
******************************************************************************/
static void QuitGifError(GifFileType *GifFileIn, GifFileType *GifFileOut)
{
    PrintGifError();
    if (GifFileIn != NULL) DGifCloseFile(GifFileIn);
    if (GifFileOut != NULL) EGifCloseFile(GifFileOut);
    exit(EXIT_FAILURE);
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<Document>
  <Header>
    <SchemaName>Location</SchemaName>
    <Identifier>location_geonames_6950465</Identifier>
    <DocumentState>public</DocumentState>
    <TimeStamp>1390753462288</TimeStamp>
    <SummaryFields>
      <Title>NL > North Brabant > Zuidhollandse Molen</Title>
    </SummaryFields>
  </Header>
  <Body>
    <Location>
      <GeopoliticalHierarchy>NL,North Brabant,Zuidhollandse Molen</GeopoliticalHierarchy>
      <LocationName>
        <Appelation>Zuidhollandse Molen</Appelation>
        <LocationNameType>windmill</LocationNameType>
        <Comments></Comments>
      </LocationName>
      <Coordinates>
        <Longitude>4.9161</Longitude>
        <Latitude>51.746959999999994</Latitude>
      </Coordinates>
      <GeonamesURI>http://www.geonames.org/6950465</GeonamesURI>
      <WikipediaLink/>
      <DbpediaLink/>
    </Location>
  </Body>
</Document>


text:
namespace Poker.Tests
{
    using System;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using Contracts;
    using Infrastructure;
    using Models;

    [TestClass]
    public class PokerHandsCheckerTests
    {
        [TestMethod]
        public void IsValidHandShouldThrowExceptionIfNumberOfCardsInTheHandIsNotFive()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Nine, CardSuit.Spades)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isValidCountOfCards = poker.IsValidHand(testHand);
                Assert.Fail();
            }
            catch(ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsValidShouldReturnTrueIfNumberOfCardsInTheHandIsFifeAndAllCardsAreDifferent()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Nine, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isValid = poker.IsValidHand(testHand);

            Assert.AreEqual(true, isValid, "IsValid(): The hand is not valid.");
        }

        [TestMethod]
        public void IsValidShouldThrowExceptionIfTheNumberOfCardsInTheHandIsLessThanFive()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isValidCardsCount = poker.IsValidHand(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsValidShouldThrowExceptionIfTheNumberOfCardsInTheHandIsMoreThanFive()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Nine, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Spades),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isValidCardsCount = poker.IsValidHand(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsValidShouldThrowExceptionIfTheHandHasNoCardsInIt()
        {
            Hand testHand = new Hand(new List<ICard> { });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isValidCardsCount = poker.IsValidHand(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsValidShouldThrowExceptionIfNullHandIsPassed()
        {
            Hand testHand = new Hand(null);

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isValidCardsCount = poker.IsValidHand(testHand);
                Assert.Fail();
            }
            catch (NullReferenceException)
            {

            }
        }

        [TestMethod]
        public void IsValidShouldReurnFalseIfThereAreAtLeastTwoEqualCardsInTheHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Nine, CardSuit.Spades),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            bool areDifferent = poker.IsValidHand(testHand);

            Assert.AreEqual(false, areDifferent, "IsValid(): some of the cards in the hand are the same");
        }

        [TestMethod]
        public void IsFlushShouldReturnFalseIfTheHandIsNotAValidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Nine, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFlush = poker.IsFlush(testHand);

            Assert.AreEqual(false, isFlush, "IsFlush(): The hand is not valid.");
        }

        [TestMethod]
        public void IsFlushShouldReturnTrueIfTheSuitOfAllCardsIsEqualAndTheyAreNotConsecutiveCards()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Nine, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFlush = poker.IsFlush(testHand);

            Assert.AreEqual(true, isFlush, "IsFlush(): The hand is not flush.");
        }

        [TestMethod]
        public void IsFlushShouldReturnFalseIfTheSuitOfAllCardsIsNotEqualAndTheyAreNotConsecutiveCards()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Nine, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFlush = poker.IsFlush(testHand);

            Assert.AreEqual(false, isFlush, "IsFlush(): The hand is a flush but it should not be.");
        }

        [TestMethod]
        public void IsFlushShouldReturnFalseIfTheSuitOfAllCardsIsEqualButTheyAreConsecutiveCards()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Nine, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFlush = poker.IsFlush(testHand);

            Assert.AreEqual(false, isFlush, "IsFlush(): The hand is not flush.");
        }

        [TestMethod]
        public void IsFourOfAKindShouldThrowExceptionIfTheHandIsNotAvalidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            try
            {
                bool isFourOfAKind = poker.IsFourOfAKind(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsFourOfAKindShouldReturnTrueIfFourOfTheCardsAreWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFourOfAKind = poker.IsFourOfAKind(testHand);

            Assert.AreEqual(true, isFourOfAKind, "IsFourOfAKind(): The hand is not Four-Of-A-Kind.");
        }

        [TestMethod]
        public void IsFourOfAKindShouldReturnFalseIfFourOfTheCardsAreNotWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFourOfAKind = poker.IsFourOfAKind(testHand);

            Assert.AreEqual(false, isFourOfAKind, "IsFourOfAKind(): The hand is not Four-Of-A-Kind.");
        }

        [TestMethod]
        public void IsOnePairShouldThrowExceptionIfItIsNotAValidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Nine, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isOnePair = poker.IsOnePair(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsOnePairShouldReturnTrueIfTwoOfTheCardsAreWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isOnePair = poker.IsOnePair(testHand);

            Assert.AreEqual(true, isOnePair, "IsOnePair(): The hand is not One Pair.");
        }

        [TestMethod]
        public void IsOnePairShouldReturnFalseIfTwoOfTheCardsAreNotWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Hearts),
                new Card(CardFace.Seven, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isOnePair = poker.IsOnePair(testHand);

            Assert.AreEqual(false, isOnePair, "IsOnePair(): The hand is not One Pair.");
        }

        [TestMethod]
        public void IsTwoPairShouldReturnTrueIfTwoPairsOfTheCardsAreWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isTwoPair = poker.IsTwoPair(testHand);

            Assert.AreEqual(true, isTwoPair, "IsTwoPair(): The hand is not Two Pair.");
        }

        [TestMethod]
        public void IsTwoPairShouldReturnFalseIfTwoPairsOfTheCardsAreNotWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Seven, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isTwoPair = poker.IsTwoPair(testHand);

            Assert.AreEqual(false, isTwoPair, "IsTwoPair(): The hand is not Two Pair.");
        }

        [TestMethod]
        public void IsThreeOfAKindShouldThrowExceptionIfTheHandIsNotAvalidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isThreeOfAKind = poker.IsThreeOfAKind(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsThreeOfAKindShouldReturnTrueIfThreeOfTheCardsAreWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isThreeOfAKind = poker.IsThreeOfAKind(testHand);

            Assert.AreEqual(true, isThreeOfAKind, "IsThreeOfAKind(): The hand is not Three-Of-A-Kind.");
        }

        [TestMethod]
        public void IsThreeOfAKindShouldReturnFalseIfThreeOfTheCardsAreNotWithEqualFacesAndDifferentSuits()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isThreeOfAKind = poker.IsThreeOfAKind(testHand);

            Assert.AreEqual(false, isThreeOfAKind, "IsThreeOfAKind(): The hand is not Three-Of-A-Kind.");
        }

        [TestMethod]
        public void IsFullHouseShouldThrowExceptionIfTheHandIsNotAvalidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isFullHouse = poker.IsFullHouse(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsFullHouseShouldReturnTrueIfThreeOfTheCardsAreWithEqualFacesAndDifferentSuitsAndTheOtherTwoAreOnePair()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFullHouse = poker.IsFullHouse(testHand);

            Assert.AreEqual(true, isFullHouse, "IsFullHouse(): The hand is not a Full House.");
        }

        [TestMethod]
        public void IsFullHouseShouldReturnFalseIfThreeOfTheCardsAreNotWithEqualFacesAndDifferentSuitsOrTheOtherTwoAreNotOnePair()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isFullHouse = poker.IsFullHouse(testHand);

            Assert.AreEqual(false, isFullHouse, "IsFullHouse(): The hand is not a Full House.");
        }

        [TestMethod]
        public void IsStraightShouldThrowExceptionIfTheHandIsNotAValidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isStaight = poker.IsStraight(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsStraightShouldReturnTrueIfAllOfTheCardsAreSequentAndTheirSuitIsDifferent()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Five, CardSuit.Spades),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStraight = poker.IsStraight(testHand);

            Assert.AreEqual(true, isStraight, "IsStraight(): The hand is not a Straight.");
        }

        [TestMethod]
        public void IsStraightShouldReturnFalseIfIfNotAllOfTheCardsAreSequentAndTheirSuitIsDifferent()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Five, CardSuit.Spades),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStaight = poker.IsStraight(testHand);

            Assert.AreEqual(false, isStaight, "IsStraight(): The hand is not a Straight.");
        }

        [TestMethod]
        public void IsStraightShouldReturnFalseIfIfAllOfTheCardsAreSequentButTheirSuitIsNotDifferent()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStaight = poker.IsStraight(testHand);

            Assert.AreEqual(false, isStaight, "IsStraigtht(): The hand is not a Straight.");
        }

        [TestMethod]
        public void IsStraightFlushShouldThrowExceptionIfTheHandIsNotAValidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isStaightFlush = poker.IsStraightFlush(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsStraightFlushShouldReturnTrueIfAllOfTheCardsAreSequentAndTheirSuitIsEqual()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStraightFlush = poker.IsStraightFlush(testHand);

            Assert.AreEqual(true, isStraightFlush, "IsStraightFlush(): The hand is not a Straight Flush.");
        }

        [TestMethod]
        public void IsStraightFlushShouldReturnFalseIfIfNotAllOfTheCardsAreSequentAndTheirSuitIsEqual()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStaightFlush = poker.IsStraightFlush(testHand);

            Assert.AreEqual(false, isStaightFlush, "IsStraightFlush(): The hand is not a Straight Flush.");
        }

        [TestMethod]
        public void IsStraightFlushShouldReturnFalseIfIfAllOfTheCardsAreSequentButTheirSuitIsDifferent()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isStaightFlush = poker.IsStraightFlush(testHand);

            Assert.AreEqual(false, isStaightFlush, "IsStraigthtFlush(): The hand is not a Straight Flush.");
        }

        [TestMethod]
        public void IsHighCardShouldThrowExceptionIfTheHandIsNotAValidHand()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();

            try
            {
                bool isHighCard = poker.IsHighCard(testHand);
                Assert.Fail();
            }
            catch (ArgumentException)
            {

            }
        }

        [TestMethod]
        public void IsHighCardShouldReturnFalseIfIsStraightFlush()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighcard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighcard, "IsHighCard(): The hand is not a High card.)");
        }

        [TestMethod]
        public void IsHighCardShouldReturnFaseIfIsFlush()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Nine, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Ten, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighCardShouldReturnFalseIfIsFourOfAKind()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighCardShouldReturnfalseIfIsOnePair()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighCardShouldReturnFalseIfIsTwoPair()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighcardShouldReturnFalseIfIsThreeOfAKind()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighCardShouldReturnFalseIfIsFullHouse()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighcardShouldReturnFalseIfIsStraight()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Five, CardSuit.Spades),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }

        [TestMethod]
        public void IsHighCardShouldReturnTrueIfIsStraightFlush()
        {
            Hand testHand = new Hand(new List<ICard>
            {
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Diamonds)
            });

            PokerHandsChecker poker = new PokerHandsChecker();
            bool isHighCard = poker.IsHighCard(testHand);

            Assert.AreEqual(false, isHighCard, "IsHighCard(): The hand is not a High Card.");
        }
    }
}


text:
package org.sakaiproject.tool.assessment.shared.impl.qti;

import lombok.extern.slf4j.Slf4j;
import org.w3c.dom.Document;

import org.sakaiproject.tool.assessment.data.ifc.assessment.AssessmentIfc;
import org.sakaiproject.tool.assessment.data.ifc.assessment.ItemDataIfc;
import org.sakaiproject.tool.assessment.services.qti.QTIService;
import org.sakaiproject.tool.assessment.shared.api.qti.QTIServiceAPI;
import org.sakaiproject.tool.assessment.services.qti.QTIServiceException;
import org.sakaiproject.tool.assessment.qti.util.XmlUtil;

/**
 * QTIServiceImpl implements a shared interface to get/set assessment
 * information.
 * @author Ed Smiley <esmiley@stanford.edu>
 */
@Slf4j
public class QTIServiceImpl implements QTIServiceAPI
{

  /**
 * Import an assessment XML document in QTI format, extract & persist the data.
 * @param document the assessment XML document in QTI format
 * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0;
 * @return a persisted assessment
 */

  public AssessmentIfc createImportedAssessment(Document document, int qtiVersion)
  {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return (AssessmentIfc) nativeQTIService.createImportedAssessment(document, qtiVersion, null);
    }
    catch (Exception ex)
    {
       log.warn("createImportedAssessment() returning null");
       //new QTIServiceException(ex);
    }
    log.error("createImportedAssessment() returning null");
    return null;
  }

   public AssessmentIfc createImportedAssessment(Document document, int qtiVersion, String unzipLocation, String templateId, String siteId) {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return (AssessmentIfc) nativeQTIService.createImportedAssessment(document, qtiVersion, unzipLocation, templateId, siteId);
    }
    catch (Exception ex)
    {
       log.warn("createImportedAssessment() returning null");
       //new QTIServiceException(ex);
    }
    log.error("createImportedAssessment() returning null");
    return null;

   }

  /**
   * Import an assessment XML document in QTI format, extract & persist the data.
   * @param documentPath the pathname to a file with the assessment XML document in QTI format
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0
   * @param siteId the site the assessment will be associated with
   * @return a persisted assessment
   */
    public AssessmentIfc createImportedAssessment(String documentPath, int qtiVersion, String siteId)
    {
        try
        {
            QTIService nativeQTIService = new QTIService();
            return (AssessmentIfc) nativeQTIService.createImportedAssessment(documentPath, qtiVersion, siteId);
        }
        catch (Exception ex)
        {
            log.warn("createImportedAssessment() returning null");
            //new QTIServiceException(ex);
        }
        log.error("createImportedAssessment() returning null");
        return null;
    }

  /**
   * Import an item XML document in QTI format, extract & persist the data.
   * @param document the item XML document in QTI format
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0;
   * @return a persisted item
   */

  public ItemDataIfc createImportedItem(Document document, int qtiVersion)
  {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return (ItemDataIfc) nativeQTIService.createImportedItem(document, qtiVersion);
    }
    catch (Exception ex)
    {
       log.warn("createImportedItem() returning null");
       //new QTIServiceException(ex);
    }
    log.error("createImportedItem() returning null");
    return null;
  }

  /**
   * Get an assessment in Document form.
   *
   * Note:  this service requires a Faces context.
   *
   * @param assessmentId the assessment's Id
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0;
   * @return the Document with the assessment data
   */
  public Document getExportedAssessment(String assessmentId, int qtiVersion)
  {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return nativeQTIService.getExportedAssessment(assessmentId, qtiVersion);
    }
    catch (Exception ex)
    {
       log.warn("getExportedAssessment() returning null");
       //new QTIServiceException(ex);
    }
    log.error("getExportedAssessment() returning null");
    return null;
  }

  /**
   * Get an assessment in String form.
   *
   * Note:  this service requires a Faces context.
   *
   * @param assessmentId the assessment's Id
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0
   * @return the Document with the assessment data
   */
    public String getExportedAssessmentAsString(String assessmentId, int qtiVersion)
  {
      return XmlUtil.getDOMString(getExportedAssessment(assessmentId, qtiVersion));
  }

  /**
   * Get an item in Document form.
   *
   * Note:  this service requires a Faces context.
   *
   * @param itemId the item's Id
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0;
   * @return the Document with the assessment data
   */

  public Document getExportedItem(String itemId, int qtiVersion)
  {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return nativeQTIService.getExportedAssessment(itemId, qtiVersion);
    }
    catch (Exception ex)
    {
       log.warn("getExportedItem() returning null");
       //new QTIServiceException(ex);
    }
    log.error("getExportedItem() returning null");
    return null;
  }

  /**
   * Get an item bank in Document form.
   *
   * Note:  this service requires a Faces context.
   *
   * @param itemIds an array of item ids
   * @param qtiVersion either 1=QTI VERSION 1.2  or 2=QTI Version 2.0;
   * @return the Document with the item bank
   */
  public Document getExportedItemBank(String[] itemIds, int qtiVersion)
  {
    try
    {
      QTIService nativeQTIService = new QTIService();
      return nativeQTIService.getExportedItemBank(itemIds, qtiVersion);
    }
    catch (Exception ex)
    {
      log.warn("getExportedItemBank() returning null");
      // new QTIServiceException(ex);
    }
    log.error("getExportedItemBank() returning null");
    return null;
  }

}


text:
// Copyright (C) AS Sertifitseerimiskeskus
// This software is released under the BSD License (see LICENSE.BSD)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NDigiDoc.Exceptions
{
    public class DigiDocException : Exception
    {
        public DigiDocException() : base()

        {
        }

        public DigiDocException(string message) : base(message)

        {
        }

        public DigiDocException(string message, Exception innerException) : base(message, innerException)

        {
        }

    }
}