package com.github.aleksandy.petrovich.rules.loader.yaml;

import static org.junit.Assert.*;

import org.junit.Test;

import com.github.aleksandy.petrovich.rules.data.RuleSet;
import com.github.aleksandy.petrovich.rules.data.Rules;
import com.github.aleksandy.petrovich.rules.loader.YamlRulesLoader;

public class YamlRulesLoaderTest {

    @Test
    public void testLoad() {
        Rules rules = new YamlRulesLoader().load();
        assertNotNull(rules);

        {
            RuleSet ruleSet = rules.getLastName();
            assertNotNull(ruleSet);

            assertNotNull(ruleSet.getExceptions());
            assertEquals(5, ruleSet.getExceptions().size());

            assertNotNull(ruleSet.getSuffixes());
            assertEquals(39, ruleSet.getSuffixes().size());
        }

        {
            RuleSet ruleSet = rules.getMiddleName();
            assertNotNull(ruleSet);

            assertNotNull(ruleSet.getExceptions());
            assertEquals(0, ruleSet.getExceptions().size());

            assertNotNull(ruleSet.getSuffixes());
            assertEquals(2, ruleSet.getSuffixes().size());
        }

        {
            RuleSet ruleSet = rules.getFirstName();
            assertNotNull(ruleSet);

            assertNotNull(ruleSet.getExceptions());
            assertEquals(6, ruleSet.getExceptions().size());

            assertNotNull(ruleSet.getSuffixes());
            assertEquals(17, ruleSet.getSuffixes().size());
        }

    }

}

@@ -50,19 +50,17 @@
 er.yaml;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -85,19 +85,17 @@
 ssert.*;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -109,19 +109,17 @@
 it.Test;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -168,17 +168,16 @@
 RuleSet;
-%0D
 %0Aimport 
@@ -224,17 +224,16 @@
 a.Rules;
-%0D
 %0Aimport 
@@ -292,19 +292,17 @@
 sLoader;
-%0D%0A%0D
+%0A
 %0Apublic 
@@ -328,19 +328,17 @@
 erTest %7B
-%0D%0A%0D
+%0A
 %0A    @Te
@@ -339,17 +339,16 @@
    @Test
-%0D
 %0A    pub
@@ -368,17 +368,16 @@
 Load() %7B
-%0D
 %0A       
@@ -373,24 +373,30 @@
 ) %7B%0A        
+final 
 Rules rules 
@@ -426,17 +426,16 @@
 .load();
-%0D
 %0A       
@@ -456,19 +456,17 @@
 (rules);
-%0D%0A%0D
+%0A
 %0A       
@@ -459,33 +459,32 @@
 les);%0A%0A        %7B
-%0D
 %0A            Rul
@@ -472,32 +472,38 @@
   %7B%0A            
+final 
 RuleSet ruleSet 
@@ -516,33 +516,32 @@
 s.getLastName();
-%0D
 %0A            ass
@@ -552,35 +552,32 @@
 otNull(ruleSet);
-%0D%0A%0D
 %0A            ass
@@ -616,185 +616,58 @@
 ());
-%0D%0A            assertEquals(5, ruleSet.getExceptions().size());%0D%0A%0D%0A            assertNotNull(ruleSet.getSuffixes());%0D%0A            assertEquals(39, ruleSet.getSuffixes().size());%0D
+%0A            assertNotNull(ruleSet.getSuffixes());
 %0A   
@@ -664,35 +664,33 @@
 es());%0A        %7D
-%0D%0A%0D
+%0A
 %0A        %7B%0D%0A    
@@ -675,33 +675,32 @@
     %7D%0A%0A        %7B
-%0D
 %0A            Rul
@@ -688,32 +688,38 @@
   %7B%0A            
+final 
 RuleSet ruleSet 
@@ -738,25 +738,24 @@
 iddleName();
-%0D
 %0A           
@@ -770,35 +770,32 @@
 otNull(ruleSet);
-%0D%0A%0D
 %0A            ass
@@ -834,184 +834,58 @@
 ());
-%0D%0A            assertEquals(0, ruleSet.getExceptions().size());%0D%0A%0D%0A            assertNotNull(ruleSet.getSuffixes());%0D%0A            assertEquals(2, ruleSet.getSuffixes().size());%0D
+%0A            assertNotNull(ruleSet.getSuffixes());
 %0A   
@@ -886,27 +886,25 @@
 );%0A        %7D
-%0D%0A%0D
+%0A
 %0A        %7B%0D%0A
@@ -901,17 +901,16 @@
        %7B
-%0D
 %0A       
@@ -914,16 +914,22 @@
         
+final 
 RuleSet 
@@ -959,17 +959,16 @@
 tName();
-%0D
 %0A       
@@ -995,19 +995,16 @@
 uleSet);
-%0D%0A%0D
 %0A       
@@ -1051,185 +1051,58 @@
 ());
-%0D%0A            assertEquals(6, ruleSet.getExceptions().size());%0D%0A%0D%0A            assertNotNull(ruleSet.getSuffixes());%0D%0A            assertEquals(17, ruleSet.getSuffixes().size());%0D
+%0A            assertNotNull(ruleSet.getSuffixes());
 %0A   
@@ -1111,20 +1111,15 @@
    %7D
-%0D%0A%0D
+%0A
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A%7D
-%0D
 %0A

fix test