package de.weltraumschaf.speakingurl;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import org.junit.Ignore;
import org.junit.Test;

/**
 * Tests for {@link SlugImplementation}.
 *
 * @author Sascha Droste <pid@posteo.net>
 * @author Sven Strittmatter <weltraumschaf@googlemail.com>
 */
public class SlugImplementation_ConfigCombinationsTest {

    @Test
    @Ignore
    public void shouldSeparateWithConfiguredCharacterWithNonBase64Separator() {
        final Slug sut = Slug.Builder.newBuiler().separator("*").maintainCase(true).create();

        assertThat(sut.get("Foo, Bar Baz"), is(equalTo("foo*bar*baz")));
        assertThat(sut.get("Foo- Bar Baz"), is(equalTo("foo-*bar*baz")));
        assertThat(sut.get("Foo] Bar Baz"), is(equalTo("foo*bar*baz")));
    }

    @Test
    public void shouldSeparateWithConfiguredCharacterWithSmartTrim() {
        Slug sut = Slug.Builder.newBuiler().separator("_").truncate(12).create();
        assertThat(sut.get("Foobarbaz, Bar Baz"), is(equalTo("foobarbaz")));

        sut = Slug.Builder.newBuiler().separator("_").truncate(15).create();
        assertThat(sut.get("Foobarbaz, Bar Baz"), is(equalTo("foobarbaz_bar")));
        assertThat(sut.get(" Foobarbaz, Bar Baz"), is(equalTo("foobarbaz_bar")));
        assertThat(sut.get("  Foobarbaz,    Bar Baz"), is(equalTo("foobarbaz_bar")));
    }

    @Test
    @Ignore
    public void shouldMaintainCaseCharactersWithNonBase64Separator() {
        final Slug sut = Slug.Builder.newBuiler().separator("*").mark(true).create();

        assertThat(sut.get("Foo, Bar Baz"), is(equalTo("Foo*Bar*Baz")));
        assertThat(sut.get("Foo- Bar Baz"), is(equalTo("Foo-*Bar*Baz")));
        assertThat(sut.get("Foo] Bar Baz"), is(equalTo("Foo*Bar*Baz")));
    }

    @Test
    @Ignore
    public void shouldMaintainCaseCharactersWithOnlyBase64CharactersAllowed() {
        Slug sut = Slug.Builder.newBuiler().maintainCase(true).uric(true).uricNoSlash(true).mark(true).create();
        assertThat(sut.get("Foo, Bar Baz"), is(equalTo("Foo-Bar-Baz")));

        sut = Slug.Builder.newBuiler().maintainCase(true).uric(false).uricNoSlash(false).mark(false).create();
        assertThat(sut.get("Foo- Bar Baz"), is(equalTo("Foo-Bar-Baz")));
        assertThat(sut.get("Foo] Bar Baz"), is(equalTo("Foo-Bar-Baz")));
    }

    @Test
    public void shouldMaintainCaseCharactersWithSmartTrim() {
        Slug sut = Slug.Builder.newBuiler().maintainCase(true).truncate(12).create();
        assertThat(sut.get("Foobarbaz, Bar Baz"), is(equalTo("Foobarbaz")));

        sut = Slug.Builder.newBuiler().maintainCase(true).truncate(15).create();
        assertThat(sut.get("Foobarbaz, Bar Baz"), is(equalTo("Foobarbaz-Bar")));
        assertThat(sut.get(" Foobarbaz, Bar Baz"), is(equalTo("Foobarbaz-Bar")));
        assertThat(sut.get("  Foobarbaz,    Bar Baz"), is(equalTo("Foobarbaz-Bar")));
    }

    @Test
    public void shouldPreferBase64CharactersOnly() {
        final Slug sut = Slug.Builder.newBuiler().uric(false).uricNoSlash(false).mark(false).create();

        assertThat(sut.get("Foo, Bar Baz"), is(equalTo("foo-bar-baz")));
        assertThat(sut.get("Foo- Bar Baz"), is(equalTo("foo-bar-baz")));
        assertThat(sut.get("Foo] Bar Baz"), is(equalTo("foo-bar-baz")));
        assertThat(sut.get("Foo* Bar Baz"), is(equalTo("foo-bar-baz")));
    }

    @Test
    public void withMarkAndMaintainCase() {
        final Slug sut = Slug.Builder.newBuiler().mark(true).maintainCase(true).create();

        assertThat(sut.get("Foo* Bar Baz"), is(equalTo("Foo*-Bar-Baz")));
    }

}

@@ -164,33 +164,8 @@
 at;%0A
-import org.junit.Ignore;%0A
 impo
@@ -183,16 +183,16 @@
 t.Test;%0A
+
 %0A/**%0A * 
@@ -402,36 +402,24 @@
 %0A%0A    @Test%0A
-    @Ignore%0A
     public v
@@ -633,33 +633,33 @@
 is(equalTo(%22
-foo*bar*b
+Foo*Bar*B
 az%22)));%0A    
@@ -714,18 +714,18 @@
 To(%22
-f
+F
 oo-*
-bar*b
+Bar*B
 az%22)
@@ -788,17 +788,17 @@
 To(%22
-foo*bar*b
+Foo*Bar*B
 az%22)
@@ -1388,36 +1388,24 @@
 %0A%0A    @Test%0A
-    @Ignore%0A
     public v
@@ -1602,33 +1602,33 @@
 is(equalTo(%22
-Foo*Bar*B
+foo*bar*b
 az%22)));%0A    
@@ -1675,34 +1675,34 @@
 is(equalTo(%22
-F
+f
 oo-*
-Bar*B
+bar*b
 az%22)));%0A    
@@ -1749,33 +1749,33 @@
 is(equalTo(%22
-Foo*Bar*B
+foo*bar*b
 az%22)));%0A    
@@ -1791,20 +1791,8 @@
 est%0A
-    @Ignore%0A
     
@@ -1972,32 +1972,178 @@
 true).create();%0A
+        assertThat(sut.get(%22Foo- Bar Baz%22), is(equalTo(%22Foo-Bar-Baz%22)));%0A        assertThat(sut.get(%22Foo%5D Bar Baz%22), is(equalTo(%22Foo-Bar-Baz%22)));%0A
         assertTh
@@ -2177,32 +2177,33 @@
  is(equalTo(%22Foo
+,
 -Bar-Baz%22)));%0A%0A 
@@ -2377,32 +2377,32 @@
 oo-Bar-Baz%22)));%0A
-
         assertTh
@@ -2450,32 +2450,105 @@
 oo-Bar-Baz%22)));%0A
+        assertThat(sut.get(%22Foo, Bar Baz%22), is(equalTo(%22Foo-Bar-Baz%22)));%0A
     %7D%0A%0A    @Test

Fix tests.