package com.exmertec.dummie;

import org.junit.Test;

import static com.exmertec.dummie.Dummie.create;
import static com.exmertec.dummie.Dummie.prepare;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class StringTest {
    @Test
    public void should_create_object_with_string_field() throws Exception {
        StringData data = create(StringData.class);

        assertThat(data, not(nullValue()));
        assertThat(data.getStringValue(), is("stringValue"));
    }

    @Test
    public void should_allow_customize_string_type_fields() throws Exception {
        StringData data = prepare(StringData.class).override(String.class, "test").build();

        assertThat(data.getStringValue(), is("test"));
    }

    public static class StringData {
        private String stringValue;

        public String getStringValue() {
            return stringValue;
        }

        public void setStringValue(String stringValue) {
            this.stringValue = stringValue;
        }
    }
}

@@ -853,24 +853,227 @@
 %22));%0A    %7D%0A%0A
+    @Test%0A    public void should_not_write_fields_without_setter() throws Exception %7B%0A        StringData data = create(StringData.class);%0A%0A        assertThat(data.getNoSetter(), is(nullValue()));%0A    %7D%0A%0A
     public s
@@ -1097,16 +1097,16 @@
 gData %7B%0A
-
         
@@ -1134,16 +1134,50 @@
 Value;%0A%0A
+        private String noSetter;%0A%0A
         
@@ -1305,24 +1305,24 @@
 ingValue) %7B%0A
-
             
@@ -1362,16 +1362,94 @@
        %7D
+%0A%0A        public String getNoSetter() %7B%0A            return noSetter;%0A        %7D
 %0A    %7D%0A%7D

add test to make sure fields without setter is not touched