<commit_before># --
# Mapping.t - Mapping tests
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: Mapping.t,v 1.2 2011-02-08 11:13:03 sb Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

use strict;
use warnings;
use vars (qw($Self));

# create needed objects
use Kernel::System::DB;
use Kernel::GenericInterface::Debugger;
use Kernel::GenericInterface::Mapping;
$Self->{DBObject}       = Kernel::System::DB->new( %{$Self} );
$Self->{DebuggerObject} = Kernel::GenericInterface::Debugger->new(
    %{$Self},
    DebuggerConfig => {
        DebugLevel => 'debug',
    },
    WebserviceID => 1,
    TestMode     => 1,
);

# create object with false options
my $MappingObject;

# provide no objects
$MappingObject = Kernel::GenericInterface::Mapping->new();
$Self->True(
    ref $MappingObject eq 'HASH',
    'MappingObject response check',
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject required objects check',
);

# provide empty mapping config
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {},
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject required config check',
);

# provide incorrect mapping type
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {
        Type => 'ThisIsCertainlyNotBeingUsed',
    },
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject mapping type check',
);

# correct call (with empty config)
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {
        Type => 'Test',
    },
);
$Self->False(
    $MappingObject->{ErrorMessage},
    'MappingObject creation check',
);

1;<commit_msg>Added more tests for main mapping module.<commit_after># --
# Mapping.t - Mapping tests
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: Mapping.t,v 1.3 2011-02-08 13:25:42 sb Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

use strict;
use warnings;
use vars (qw($Self));

# create needed objects
use Kernel::System::DB;
use Kernel::GenericInterface::Debugger;
use Kernel::GenericInterface::Mapping;
$Self->{DBObject}       = Kernel::System::DB->new( %{$Self} );
$Self->{DebuggerObject} = Kernel::GenericInterface::Debugger->new(
    %{$Self},
    DebuggerConfig => {
        DebugLevel => 'debug',
    },
    WebserviceID => 1,
    TestMode     => 1,
);

# create object with false options
my $MappingObject;

# provide no objects
$MappingObject = Kernel::GenericInterface::Mapping->new();
$Self->True(
    ref $MappingObject eq 'HASH',
    'MappingObject response check',
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject required objects check',
);

# provide empty mapping config
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {},
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject required config check',
);

# provide incorrect mapping type
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {
        Type => 'ThisIsCertainlyNotBeingUsed',
    },
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject mapping type check',
);

# call without config
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {
        Type => 'Test',
    },
);
$Self->True(
    $MappingObject->{ErrorMessage},
    'MappingObject creation check without config',
);

# correct call (with empty config)
$MappingObject = Kernel::GenericInterface::Mapping->new(
    %{$Self},
    MappingConfig => {
        Type   => 'Test',
        Config => {},
    },
);
$Self->False(
    $MappingObject->{ErrorMessage},
    'MappingObject creation check',
);

# map without data
my $ReturnData = $MappingObject->Map();
$Self->True(
    ref $ReturnData eq 'HASH',
    'MappingObject call response type',
);
$Self->True(
    $ReturnData->{ErrorMessage},
    'MappingObject call no data provided',
);

# map with empty data (should be ok)
$ReturnData = $MappingObject->Map(
    Data => {},
);
$Self->False(
    $ReturnData->{ErrorMessage},
    'MappingObject call data provided',
);

1;
{'fraction_non_alphanumeric': 0.15991140642303434, 'fraction_numerical': 0.011960132890365448, 'mean_word_length': 3.9193899782135078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1880289', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1383, 'n_words': 352}