<commit_before># Kotlin Validation

[![Build Status](https://www.bitrise.io/app/52bf5677c2ea2255/status.svg?token=VefnKnVA0lwrTocWOGkTSg&branch=master)](https://www.bitrise.io/app/52bf5677c2ea2255)

## Usage

```
class User(val name: String, val age: Int)

class ValidationTest {

    val validation = Validation<User> {
        "name"{
            be { name.length >= 5 } not "name: 5 characters or more"
        }
        "age"{
            be { age >= 20 } not "age: Over 20 years old"
        }
    }


    @Test
    fun invalidNameAndAgeTest() {
        val user = User("k", 0)

        // {name=[name: 5 characters or more], age=[age: Over 20 years old]}
        val errors = validation.validate(user)

        Assert.assertEquals(errors["name"]!![0], "name: 5 characters or more")
        Assert.assertEquals(errors["age"]!![0], "age: Over 20 years old")
        Assert.assertEquals(errors.size, 2)
    }

}
```

see: [ValidationTest.kt](https://github.com/kamedon/Validation/blob/master/validation/src/test/java/com/kamedon/validation/ValidationTest.kt)

## Installation

```
repositories {
    maven { url 'http://kamedon.github.com/Validation/repository' }
}

dependencies {
    implementation 'com.kamedon:kotlin-validation:0.4.0'<commit_msg>modify README example usage<commit_after># Kotlin Validation

[![Build Status](https://www.bitrise.io/app/52bf5677c2ea2255/status.svg?token=<PASSWORD>&branch=master)](https://www.bitrise.io/app/52bf5677c2ea2255)

## Usage

```
class User(val name: String, val age: Int)

class ValidationTest {

    val validation = Validation<User> {
        "name"{
            be { name.length >= 5 } not "name: 5 characters or more"
        }
        "age"{
            be { age >= 20 } not "age: Over 20 years old"
        }
    }

    @Test
    fun validDataTest() {
        val user = User("kamedon", 30)
        val expected = 0
        val actual = validation.validate(user).size
        Assert.assertEquals(expected, actual)
    }

    @Test
    fun invalidNameAndAgeTest() {
        val user = User("k", 0)

        // {name=[name: 5 characters or more], age=[age: Over 20 years old]}
        val errors = validation.validate(user)

        Assert.assertEquals(errors["name"]!![0], "name: 5 characters or more")
        Assert.assertEquals(errors["age"]!![0], "age: Over 20 years old")
        Assert.assertEquals(errors.size, 2)
    }

}
```

see: [ValidationTest.kt](https://github.com/kamedon/Validation/blob/master/validation/src/test/java/com/kamedon/validation/ValidationTest.kt)

## Installation

```
repositories {
    maven { url 'http://kamedon.github.com/Validation/repository' }
}

dependencies {
    implementation 'com.kamedon:kotlin-validation:0.4.0'
{'fraction_non_alphanumeric': 0.14786135693215338, 'fraction_numerical': 0.03171091445427729, 'mean_word_length': 2.995581737849779, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, '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': '6752865', 'n_tokens_mistral': 958, 'n_tokens_neox': 869, 'n_words': 181}