<commit_before>package se.su.it.svc.commons

import spock.lang.Shared
import spock.lang.Specification

class LdapAttributeValidatorSpec extends Specification
{
    @Shared
    LdapAttributeValidator lav

    def setup()
    {
        lav = new LdapAttributeValidator()
    }

    def "checkValidMailAddress: email patterns"()
    {
        expect:
        lav.checkValidMailAddress(email) == res

        where:
        email       | res
        "<EMAIL>"    | true
        "<EMAIL>"  | true
        "<EMAIL>" | false
    }
}
<commit_msg>IDM-1274: Add unit test for validateUid.<commit_after>package se.su.it.svc.commons

import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll

class LdapAttributeValidatorSpec extends Specification
{
    @Shared
    LdapAttributeValidator lav

    def setup()
    {
        lav = new LdapAttributeValidator()
    }

    @Unroll
    def "validateUid: uid is ok"()
    {
        when:
        lav.validateUid(uid)

        then:
        noExceptionThrown()

        where:
        uid        | _
        "validuid" | _
    }

    @Unroll
    def "validateUid: uid is bad"()
    {
        when:
        lav.validateUid(uid)

        then:
        thrown(IllegalArgumentException)

        where:
        uid          | _
        null         | _
        "a"          | _
        "0123456789" | _
    }

    def "checkValidMailAddress: email patterns"()
    {
        expect:
        lav.checkValidMailAddress(email) == res

        where:
        email       | res
        "<EMAIL>"    | true
        "<EMAIL>"  | true
        "<EMAIL>" | false
    }
}

{'fraction_non_alphanumeric': 0.09367245657568238, 'fraction_numerical': 0.008684863523573201, 'mean_word_length': 1.7385398981324278, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '140325', 'n_tokens_mistral': 508, 'n_tokens_neox': 498, 'n_words': 103}