Repository: redpen-cc/redpen
Pull request #551 (2016-02-25 10:34:16)

Improve RedPen custom resource loading
Custom resources will now be looked for from 3 places:

* Working directory
* Relative to the config file (new feature)
* From REDPEN_HOME directory

All Validators now have access to this functionality via Validator.findFile().
All existing validators were updated to use it.

**WARNING:** This pull request depends (contains the same changes) on this one https://github.com/redpen-cc/redpen/pull/550, please merge #550 first.

Review changes starting from this commit: https://github.com/codeborne/redpen/commit/042cfdc9a072ff64513780f17b87c848930fa53f


Patch:
diff --git a/redpen-cli/pom.xml b/redpen-cli/pom.xml
index d201486a..2b5561d0 100644
--- a/redpen-cli/pom.xml
+++ b/redpen-cli/pom.xml
@@ -119,6 +119,11 @@
             <artifactId>commons-cli</artifactId>
             <version>1.2</version>
         </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.1.1</version>
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
diff --git a/redpen-core/pom.xml b/redpen-core/pom.xml
index 12142622..a3b80fe3 100644
--- a/redpen-core/pom.xml
+++ b/redpen-core/pom.xml
@@ -167,11 +167,6 @@
             <version>4.10</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-cli</groupId>
-            <artifactId>commons-cli</artifactId>
-            <version>1.2</version>
-        </dependency>
         <dependency>
             <groupId>org.json</groupId>
             <artifactId>json</artifactId>
@@ -181,13 +176,6 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
             <version>1.7.6</version>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.1.1</version>
         </dependency>
         <dependency>
             <groupId>org.pegdown</groupId>
diff --git a/redpen-core/src/main/java/cc/redpen/RedPen.java b/redpen-core/src/main/java/cc/redpen/RedPen.java
index 0d8c7622..ff0de7ee 100644
--- a/redpen-core/src/main/java/cc/redpen/RedPen.java
+++ b/redpen-core/src/main/java/cc/redpen/RedPen.java
@@ -73,10 +73,10 @@ public class RedPen {
      */
     public RedPen(Configuration configuration) throws RedPenException {
         this.configuration = configuration;
-        this.sentenceExtractor = new SentenceExtractor(this.configuration.getSymbolTable());
+        this.sentenceExtractor = new SentenceExtractor(configuration.getSymbolTable());
         this.validators = new ArrayList<>();
         for (ValidatorConfiguration config : configuration.getValidatorConfigs()) {
-            validators.add(ValidatorFactory.getInstance(config, configuration.getSymbolTable()));
+            validators.add(ValidatorFactory.getInstance(config, configuration));
         }
 
     }
@@ -240,17 +240,12 @@ public class RedPen {
             return false;
 
         RedPen redPen = (RedPen) o;
-
-        if (configuration != null ? !configuration.equals(redPen.configuration) : redPen.configuration != null)
-            return false;
-
-        return true;
+        return Objects.equals(configuration, redPen.configuration);
     }
 
     @Override
     public int hashCode() {
-        int result = configuration != null ? configuration.hashCode() : 0;
-        return result;
+        return configuration != null ? configuration.hashCode() : 0;
     }
 
     @Override
diff --git a/redpen-core/src/main/java/cc/redpen/config/Configuration.java b/redpen-core/src/main/java/cc/redpen/config/Configuration.java
index 4f8cd6ec..d2838dc5 100644
--- a/redpen-core/src/main/java/cc/redpen/config/Configuration.java
+++ b/redpen-core/src/main/java/cc/redpen/config/Configuration.java
@@ -17,10 +17,12 @@
  */
 package cc.redpen.config;
 
+import cc.redpen.RedPenException;
 import cc.redpen.tokenizer.JapaneseTokenizer;
 import cc.redpen.tokenizer.RedPenTokenizer;
 import cc.redpen.tokenizer.WhiteSpaceTokenizer;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
@@ -40,11 +42,14 @@ public class Configuration implements Serializable, Cloneable {
     private List<ValidatorConfiguration> validatorConfigs = new ArrayList<>();
     private final String lang;
     private transient RedPenTokenizer tokenizer;
+    private File home = new File(Optional.ofNullable(System.getProperty("REDPEN_HOME", System.getenv("REDPEN_HOME"))).orElse(""));
+    private File base;
 
     /**
      * Constructor.
      */
-    Configuration(SymbolTable symbolTable, List<ValidatorConfiguration> validatorConfigs, String lang) {
+    Configuration(File base, SymbolTable symbolTable, List<ValidatorConfiguration> validatorConfigs, String lang) {
+        this.base = base;
         this.symbolTable = symbolTable;
 
         this.validatorConfigs.addAll(validatorConfigs);
@@ -109,6 +114,42 @@ public class Configuration implements Serializable, Cloneable {
         return getLang() + (isEmpty(getVariant()) ? "" : "." + getVariant());
     }
 
+    /**
+     * @return RedPen home directory, relative to which custom resources are evaluated
+     */
+    public File getHome() {
+        return home;
+    }
+
+    /**
+     * @return RedPen configuration base directory, relative to which custom resources are evaluated
+     */
+    public File getBase() {
+        return base;
+    }
+
+    /**
+     * Finds file relative to either working directory, base directory or $REDPEN_HOME
+     * @param relativePath of file to find
+     * @return resolved file if it exists
+     * @throws RedPenException if file doesn't exist in either place
+     */
+    public File findFile(String relativePath) throws RedPenException {
+        File file = new File(relativePath);
+        if (file.exists()) return file;
+
+        if (base != null) {
+            file = new File(base, relativePath);
+            if (file.exists()) return file;
+        }
+
+        file = new File(home, relativePath);
+        if (file.exists()) return file;
+
+        throw new RedPenException(String.format("%s is not under working directory (%s)" + (base != null ? ", base (" + base + ")" : "")  + " or $REDPEN_HOME (%s).",
+          relativePath, new File("").getAbsoluteFile(), home.getAbsolutePath()));
+    }
+
     /**
      * @return a deep copy of this configuration
      */
@@ -143,6 +184,23 @@ public class Configuration implements Serializable, Cloneable {
         return getKey().hashCode();
     }
 
+    @Override public String toString() {
+        return "Configuration{" +
+          "lang='" + lang + '\'' +
+          ", tokenizer=" + tokenizer +
+          ", validatorConfigs=" + validatorConfigs +
+          ", symbolTable=" + symbolTable +
+          '}';
+    }
+
+    public static ConfigurationBuilder builder() {
+        return new ConfigurationBuilder();
+    }
+
+    public static ConfigurationBuilder builder(String lang) {
+        return new ConfigurationBuilder().setLanguage(lang);
+    }
+
     /**
      * Builder class of Configuration.
      */
@@ -153,18 +211,24 @@ public class Configuration implements Serializable, Cloneable {
 
         private String lang = "en";
         private Optional<String> variant = Optional.empty();
+        private File base;
 
         private void checkBuilt() {
-            if(built){
-                throw new IllegalStateException("Configuration already built.");
-            }
+            if (built) throw new IllegalStateException("Configuration already built.");
         }
+
         public ConfigurationBuilder setLanguage(String lang) {
             checkBuilt();
             this.lang = lang;
             return this;
         }
 
+        public ConfigurationBuilder setBaseDir(File base) {
+            checkBuilt();
+            this.base = base;
+            return this;
+        }
+
         public ConfigurationBuilder addSymbol(Symbol symbol) {
             checkBuilt();
             customSymbols.add(symbol);
@@ -186,7 +250,7 @@ public class Configuration implements Serializable, Cloneable {
         public Configuration build() {
             checkBuilt();
             built = true;
-            return new Configuration(new SymbolTable(lang, variant, customSymbols), this.validatorConfigs, this.lang);
+            return new Configuration(base, new SymbolTable(lang, variant, customSymbols), this.validatorConfigs, this.lang);
         }
     }
 }
diff --git a/redpen-core/src/main/java/cc/redpen/config/ConfigurationLoader.java b/redpen-core/src/main/java/cc/redpen/config/ConfigurationLoader.java
index 711809fb..985086b0 100644
--- a/redpen-core/src/main/java/cc/redpen/config/ConfigurationLoader.java
+++ b/redpen-core/src/main/java/cc/redpen/config/ConfigurationLoader.java
@@ -39,8 +39,7 @@ import static cc.redpen.config.Configuration.ConfigurationBuilder;
  * Load the central configuration of {@link cc.redpen.RedPen}.
  */
 public class ConfigurationLoader {
-    private static final Logger LOG =
-            LoggerFactory.getLogger(ConfigurationLoader.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigurationLoader.class);
     private ConfigurationBuilder configBuilder = new ConfigurationBuilder();
 
     private static Symbol createSymbol(Element element) throws RedPenException {
@@ -89,7 +88,7 @@ public class ConfigurationLoader {
     public Configuration load(File configFile) throws RedPenException {
         LOG.info("Loading config from specified config file: \"{}\"", configFile.getAbsolutePath());
         try (InputStream fis = new FileInputStream(configFile)) {
-            return this.load(fis);
+            return this.load(fis, configFile.getParentFile());
         } catch (IOException e) {
             throw new RedPenException(e);
         }
@@ -103,8 +102,20 @@ public class ConfigurationLoader {
      * @throws cc.redpen.RedPenException when failed to load configuration from specified resource
      */
     public Configuration loadFromResource(String resourcePath) throws RedPenException {
+        return loadFromResource(resourcePath, null);
+    }
+
+    /**
+     * load {@link cc.redpen.RedPen} settings.
+     *
+     * @param resourcePath input configuration path
+     * @param base base dir for resolving of relative resources
+     * @return Validator configuration resources
+     * @throws cc.redpen.RedPenException when failed to load configuration from specified resource
+     */
+    public Configuration loadFromResource(String resourcePath, File base) throws RedPenException {
         InputStream inputConfigStream = Configuration.class.getResourceAsStream(resourcePath);
-        return load(inputConfigStream);
+        return load(inputConfigStream, base);
     }
 
     /**
@@ -115,7 +126,19 @@ public class ConfigurationLoader {
      * @throws cc.redpen.RedPenException when failed to load Configuration from specified string
      */
     public Configuration loadFromString(String configString) throws RedPenException {
-        return load(new ByteArrayInputStream(configString.getBytes(StandardCharsets.UTF_8)));
+        return loadFromString(configString, null);
+    }
+
+    /**
+     * load {@link cc.redpen.RedPen} settings.
+     *
+     * @param configString configuration as String
+     * @param base base dir for resolving of relative resources
+     * @return Validator configuration resources
+     * @throws cc.redpen.RedPenException when failed to load Configuration from specified string
+     */
+    public Configuration loadFromString(String configString, File base) throws RedPenException {
+        return load(new ByteArrayInputStream(configString.getBytes(StandardCharsets.UTF_8)), base);
     }
 
     /**
@@ -127,9 +150,22 @@ public class ConfigurationLoader {
      * @throws cc.redpen.RedPenException when failed to load configuration from specified stream
      */
     public Configuration load(InputStream stream) throws RedPenException {
+        return load(stream, null);
+    }
+
+    /**
+     * load {@link cc.redpen.RedPen} configuration.
+     * Provided stream will be closed.
+     *
+     * @param stream input configuration settings
+     * @param base base dir for resolving of relative resources
+     * @return Configuration loaded from input stream
+     * @throws cc.redpen.RedPenException when failed to load configuration from specified stream
+     */
+    public Configuration load(InputStream stream, File base) throws RedPenException {
         Document doc = toDocument(stream);
 
-        configBuilder = new ConfigurationBuilder();
+        configBuilder = new ConfigurationBuilder().setBaseDir(base);
         Element rootElement = getRootNode(doc, "redpen-conf");
 
         String language = rootElement.getAttribute("lang");
diff --git a/redpen-core/src/main/java/cc/redpen/config/SymbolTable.java b/redpen-core/src/main/java/cc/redpen/config/SymbolTable.java
index 5a4c0fe6..7109ae0e 100644
--- a/redpen-core/src/main/java/cc/redpen/config/SymbolTable.java
+++ b/redpen-core/src/main/java/cc/redpen/config/SymbolTable.java
@@ -171,9 +171,8 @@ public class SymbolTable implements Serializable, Cloneable {
     public String toString() {
         return "SymbolTable{" +
                 "symbolDictionary=" + symbolDictionary +
-                ", valueDictionary=" + valueDictionary +
-                ", type='" + variant + '\'' +
                 ", lang='" + lang + '\'' +
+                ", variant='" + variant + '\'' +
                 '}';
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/config/ValidatorConfiguration.java b/redpen-core/src/main/java/cc/redpen/config/ValidatorConfiguration.java
index 180f2f3c..7a24b949 100644
--- a/redpen-core/src/main/java/cc/redpen/config/ValidatorConfiguration.java
+++ b/redpen-core/src/main/java/cc/redpen/config/ValidatorConfiguration.java
@@ -104,7 +104,8 @@ public class ValidatorConfiguration implements Serializable, Cloneable {
         if (this == o) return true;
         if (!(o instanceof ValidatorConfiguration)) return false;
         ValidatorConfiguration that = (ValidatorConfiguration)o;
-        return Objects.equals(configurationName, that.configurationName);
+        return Objects.equals(configurationName, that.configurationName) &&
+               Objects.equals(attributes, that.attributes);
     }
 
     @Override public int hashCode() {
diff --git a/redpen-core/src/main/java/cc/redpen/model/Document.java b/redpen-core/src/main/java/cc/redpen/model/Document.java
index ace126de..283abce6 100644
--- a/redpen-core/src/main/java/cc/redpen/model/Document.java
+++ b/redpen-core/src/main/java/cc/redpen/model/Document.java
@@ -121,6 +121,14 @@ public class Document implements Iterable<Section>, Serializable {
                 '}';
     }
 
+    public static DocumentBuilder builder() {
+        return new DocumentBuilder();
+    }
+
+    public static DocumentBuilder builder(RedPenTokenizer tokenizer) {
+        return new DocumentBuilder(tokenizer);
+    }
+
     public static class DocumentBuilder {
         private final RedPenTokenizer tokenizer;
         boolean built = false;
diff --git a/redpen-core/src/main/java/cc/redpen/parser/LaTeXParser.java b/redpen-core/src/main/java/cc/redpen/parser/LaTeXParser.java
index 663abe81..829e1e78 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/LaTeXParser.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/LaTeXParser.java
@@ -46,7 +46,7 @@ class LaTeXParser extends BaseDocumentParser {
     @Override
     public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer)
             throws RedPenException {
-        Document.DocumentBuilder documentBuilder = new Document.DocumentBuilder(tokenizer);
+        Document.DocumentBuilder documentBuilder = Document.builder(tokenizer);
         fileName.ifPresent(documentBuilder::setFileName);
 
         StringBuilder sb = new StringBuilder();
diff --git a/redpen-core/src/main/java/cc/redpen/parser/MarkdownParser.java b/redpen-core/src/main/java/cc/redpen/parser/MarkdownParser.java
index 7442e764..13742ccc 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/MarkdownParser.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/MarkdownParser.java
@@ -55,7 +55,7 @@ class MarkdownParser extends BaseDocumentParser {
     @Override
     public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer)
             throws RedPenException {
-        Document.DocumentBuilder documentBuilder = new Document.DocumentBuilder(tokenizer);
+        Document.DocumentBuilder documentBuilder = Document.builder(tokenizer);
         fileName.ifPresent(documentBuilder::setFileName);
 
         StringBuilder sb = new StringBuilder();
diff --git a/redpen-core/src/main/java/cc/redpen/parser/PlainTextParser.java b/redpen-core/src/main/java/cc/redpen/parser/PlainTextParser.java
index ba7420c3..37adf59b 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/PlainTextParser.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/PlainTextParser.java
@@ -49,7 +49,7 @@ final public class PlainTextParser extends BaseDocumentParser implements Seriali
     @Override
     public Document parse(InputStream is, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer)
             throws RedPenException {
-        Document.DocumentBuilder documentBuilder = new Document.DocumentBuilder(tokenizer);
+        Document.DocumentBuilder documentBuilder = Document.builder(tokenizer);
         fileName.ifPresent(documentBuilder::setFileName);
 
         List<Sentence> headers = new ArrayList<>();
diff --git a/redpen-core/src/main/java/cc/redpen/parser/SentenceExtractor.java b/redpen-core/src/main/java/cc/redpen/parser/SentenceExtractor.java
index 765bdca6..f7efcabb 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/SentenceExtractor.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/SentenceExtractor.java
@@ -56,7 +56,7 @@ public class SentenceExtractor {
      * @param fullStopList set of end of sentence characters
      */
     SentenceExtractor(char[] fullStopList) {
-        this(fullStopList, extractRightQuotations(new Configuration.ConfigurationBuilder().build().getSymbolTable()));
+        this(fullStopList, extractRightQuotations(Configuration.builder().build().getSymbolTable()));
     }
 
     /**
diff --git a/redpen-core/src/main/java/cc/redpen/parser/WikiParser.java b/redpen-core/src/main/java/cc/redpen/parser/WikiParser.java
index ca3c476e..0f47371f 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/WikiParser.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/WikiParser.java
@@ -94,7 +94,7 @@ class WikiParser extends BaseDocumentParser {
     @Override
     public Document parse(InputStream is, Optional<String> filename, SentenceExtractor sentenceExtractor,
                           RedPenTokenizer tokenizer) throws RedPenException{
-        Document.DocumentBuilder documentBuilder = new Document.DocumentBuilder(tokenizer);
+        Document.DocumentBuilder documentBuilder = Document.builder(tokenizer);
         filename.ifPresent(documentBuilder::setFileName);
         BufferedReader br;
 
diff --git a/redpen-core/src/main/java/cc/redpen/parser/asciidoc/AsciiDocParser.java b/redpen-core/src/main/java/cc/redpen/parser/asciidoc/AsciiDocParser.java
index acc2cde1..07cfab14 100644
--- a/redpen-core/src/main/java/cc/redpen/parser/asciidoc/AsciiDocParser.java
+++ b/redpen-core/src/main/java/cc/redpen/parser/asciidoc/AsciiDocParser.java
@@ -102,7 +102,7 @@ public class AsciiDocParser extends BaseDocumentParser {
 
     @Override
     public Document parse(InputStream inputStream, Optional<String> fileName, SentenceExtractor sentenceExtractor, RedPenTokenizer tokenizer) throws RedPenException {
-        Document.DocumentBuilder documentBuilder = new Document.DocumentBuilder(tokenizer);
+        Document.DocumentBuilder documentBuilder = Document.builder(tokenizer);
         fileName.ifPresent(documentBuilder::setFileName);
 
         Model model = new Model(sentenceExtractor);
diff --git a/redpen-core/src/main/java/cc/redpen/util/DictionaryLoader.java b/redpen-core/src/main/java/cc/redpen/util/DictionaryLoader.java
index 3b098514..00d8daa2 100644
--- a/redpen-core/src/main/java/cc/redpen/util/DictionaryLoader.java
+++ b/redpen-core/src/main/java/cc/redpen/util/DictionaryLoader.java
@@ -89,23 +89,19 @@ public class DictionaryLoader<E> {
      *
      * @param path           resource path
      * @param dictionaryName name of the resource
-     * @return word list
-     * @throws RedPenException when failed to load the dictionary
+     * @return word collection or empty if resource is missing
      */
-    public E loadCachedFromResource(String path, String dictionaryName) throws RedPenException {
-        E strings = resourceCache.computeIfAbsent(path, e -> {
+    public E loadCachedFromResource(String path, String dictionaryName) {
+        return resourceCache.computeIfAbsent(path, e -> {
             try {
-                return loadFromResource(path);
+                E result = loadFromResource(path);
+                LOG.info("Succeeded to load " + dictionaryName + ".");
+                return result;
             } catch (IOException ioe) {
-                LOG.error(ioe.getMessage());
-                return null;
+                LOG.error("Failed to load " + dictionaryName + ":" + path + ": " + ioe.getMessage());
+                return supplier.get();
             }
         });
-        if (strings == null) {
-            throw new RedPenException("Failed to load " + dictionaryName + ":" + path);
-        }
-        LOG.info("Succeeded to load " + dictionaryName + ".");
-        return strings;
     }
 
 
@@ -122,7 +118,6 @@ public class DictionaryLoader<E> {
      */
     public E loadCachedFromFile(File file, String dictionaryName) throws RedPenException {
         String path = file.getAbsolutePath();
-        ensureFileIsInsideRedPenHomeOrWorkingDirectory(path);
         if (!file.exists()) {
             throw new RedPenException("File not found: " + file);
         }
@@ -154,35 +149,4 @@ public class DictionaryLoader<E> {
         LOG.info("Succeeded to load " + dictionaryName + ".");
         return loaded;
     }
-
-    /**
-     * Test the specified path is inside $REDPEN_HOME, or JVM working directory. If not, throw RedPenException
-     *
-     * @param path path to test
-     * @throws RedPenException the specified path is not inside $REDPEN_HOME
-     */
-    public static void ensureFileIsInsideRedPenHomeOrWorkingDirectory(String path) throws RedPenException {
-            try {
-                String canonicalPath = new File(path).getCanonicalPath();
-                String currentDirectory = new File("").getCanonicalPath();
-                if (canonicalPath.startsWith(currentDirectory)) {
-                    return;
-                }
-                String home = System.getProperty("REDPEN_HOME", System.getenv("REDPEN_HOME"));
-                String homeCanonicalPath;
-                if (home != null) {
-                    homeCanonicalPath = new File(home).getCanonicalPath();
-                    if (canonicalPath.startsWith(homeCanonicalPath)) {
-                        return;
-                    }
-                }else{
-                    homeCanonicalPath = "not specified";
-                }
-                throw new RedPenException(String.format("%s  is not under $REDPEN_HOME(%s) or current directory(%s).",
-                        canonicalPath , homeCanonicalPath, currentDirectory));
-
-            } catch (IOException e) {
-                throw new RedPenException(e);
-            }
-    }
 }
diff --git a/redpen-core/src/main/java/cc/redpen/util/SpellingUtils.java b/redpen-core/src/main/java/cc/redpen/util/SpellingUtils.java
index 59daa1a9..642246b4 100644
--- a/redpen-core/src/main/java/cc/redpen/util/SpellingUtils.java
+++ b/redpen-core/src/main/java/cc/redpen/util/SpellingUtils.java
@@ -37,14 +37,8 @@ public class SpellingUtils {
     protected static void loadDictionary(String lang) {
         if (dictionaries.get(lang) == null) {
             String defaultDictionaryFile = DEFAULT_RESOURCE_PATH + "/spellchecker-" + lang + ".dat";
-            Set<String> dictionary;
-            try {
-                dictionary = new DictionaryLoader<HashSet<String>>(
-                        HashSet::new, (set, line) -> set.add(line.toLowerCase())
-                ).loadCachedFromResource(defaultDictionaryFile, "spell dictionary");
-            } catch (Exception e) {
-                dictionary = new HashSet<>();
-            }
+            Set<String> dictionary = new DictionaryLoader<Set<String>>(HashSet::new, (set, line) -> set.add(line.toLowerCase()))
+              .loadCachedFromResource(defaultDictionaryFile, "spell dictionary");
             dictionaries.put(lang, Collections.unmodifiableSet(dictionary));
         }
     }
diff --git a/redpen-core/src/main/java/cc/redpen/validator/JavaScriptValidator.java b/redpen-core/src/main/java/cc/redpen/validator/JavaScriptValidator.java
index de6f3e59..512e4c8d 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/JavaScriptValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/JavaScriptValidator.java
@@ -22,7 +22,6 @@ import cc.redpen.model.Document;
 import cc.redpen.model.Section;
 import cc.redpen.model.Sentence;
 import cc.redpen.tokenizer.TokenElement;
-import cc.redpen.util.DictionaryLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -63,16 +62,10 @@ public class JavaScriptValidator extends Validator {
 
     @Override
     protected void init() throws RedPenException {
-        String home = System.getProperty("REDPEN_HOME", System.getenv("REDPEN_HOME"));
-        home = home != null ? home : ".";
-
-        String jsValidatorsPath = getConfigAttribute("script-path").orElse(home + File.separator + DEFAULT_JS_VALIDATORS_PATH);
-        File jsDirectory = new File(jsValidatorsPath);
-        if(!jsDirectory.exists()){
-            LOG.info("JavaScript validators directory is missing: {}", jsValidatorsPath);
-        }else {
+        Optional<String> jsValidatorsPath = getConfigAttribute("script-path");
+        try {
+            File jsDirectory = findFile(jsValidatorsPath.orElse(DEFAULT_JS_VALIDATORS_PATH));
             LOG.info("JavaScript validators directory: {}", jsValidatorsPath);
-            DictionaryLoader.ensureFileIsInsideRedPenHomeOrWorkingDirectory(jsValidatorsPath);
             File[] jsValidatorFiles = jsDirectory.listFiles();
             if (jsValidatorFiles != null) {
                 for (File file : jsValidatorFiles) {
@@ -86,6 +79,9 @@ public class JavaScriptValidator extends Validator {
                 }
             }
         }
+        catch (RedPenException e) {
+            LOG.warn("JavaScript validators directory is missing: {}", e.toString());
+        }
     }
 
     static final Map<File, String> fileCache = new HashMap<>();
diff --git a/redpen-core/src/main/java/cc/redpen/validator/Validator.java b/redpen-core/src/main/java/cc/redpen/validator/Validator.java
index e8ab1fd3..ad1bc32a 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/Validator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/Validator.java
@@ -19,6 +19,7 @@ package cc.redpen.validator;
 
 
 import cc.redpen.RedPenException;
+import cc.redpen.config.Configuration;
 import cc.redpen.config.SymbolTable;
 import cc.redpen.config.ValidatorConfiguration;
 import cc.redpen.model.Document;
@@ -31,6 +32,7 @@ import cc.redpen.util.RuleExtractor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
 import java.text.MessageFormat;
 import java.util.*;
 
@@ -44,7 +46,7 @@ public abstract class Validator {
 
     private ResourceBundle errorMessages = null;
     private ValidatorConfiguration config;
-    private SymbolTable symbolTable;
+    private Configuration globalConfig;
 
     public Validator() {
         setLocale(Locale.getDefault());
@@ -111,9 +113,9 @@ public abstract class Validator {
         return Collections.emptyList();
     }
 
-    final void preInit(ValidatorConfiguration config, SymbolTable symbolTable) throws RedPenException {
+    final void preInit(ValidatorConfiguration config, Configuration globalConfig) throws RedPenException {
         this.config = config;
-        this.symbolTable = symbolTable;
+        this.globalConfig = globalConfig;
         init();
     }
 
@@ -197,7 +199,11 @@ public abstract class Validator {
     }
 
     protected SymbolTable getSymbolTable() {
-        return symbolTable;
+        return globalConfig.getSymbolTable();
+    }
+
+    protected File findFile(String relativePath) throws RedPenException {
+        return globalConfig.findFile(relativePath);
     }
 
     /**
diff --git a/redpen-core/src/main/java/cc/redpen/validator/ValidatorFactory.java b/redpen-core/src/main/java/cc/redpen/validator/ValidatorFactory.java
index b7de637a..ea32b03e 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/ValidatorFactory.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/ValidatorFactory.java
@@ -19,7 +19,6 @@ package cc.redpen.validator;
 
 import cc.redpen.RedPenException;
 import cc.redpen.config.Configuration;
-import cc.redpen.config.SymbolTable;
 import cc.redpen.config.ValidatorConfiguration;
 
 import java.lang.reflect.Constructor;
@@ -47,18 +46,16 @@ public class ValidatorFactory {
     }
 
     public static Validator getInstance(String validatorName) throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration(validatorName))
                 .build();
-        return getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        return getInstance(conf.getValidatorConfigs().get(0), conf);
     }
 
     // store validator constructors to save reflection API call costs
     private static final Map<String, Constructor> validatorConstructorMap = new ConcurrentHashMap<>();
 
-    public static Validator getInstance(ValidatorConfiguration config, SymbolTable symbolTable)
-            throws RedPenException {
+    public static Validator getInstance(ValidatorConfiguration config, Configuration globalConfig) throws RedPenException {
         Constructor<?> constructor = validatorConstructorMap.computeIfAbsent(config.getValidatorClassName(), validatorClassName -> {
             try {
                 for (String validatorPackage : VALIDATOR_PACKAGES) {
@@ -86,7 +83,7 @@ public class ValidatorFactory {
         }
         try {
             Validator validator = (Validator) constructor.newInstance();
-            validator.preInit(config, symbolTable);
+            validator.preInit(config, globalConfig);
             return validator;
         } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
             throw new RuntimeException(e);
diff --git a/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java b/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java
index 52d33aad..c019c2d6 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/section/WordFrequencyValidator.java
@@ -63,17 +63,12 @@ public class WordFrequencyValidator extends Validator {
 
         String defaultDictionaryFile = DEFAULT_RESOURCE_PATH + "/word-frequency-" + getSymbolTable().getLang() + ".dat";
         referenceWordDeviations = new HashMap<>();
-        try {
-            referenceWordFrequencies =
-                    new DictionaryLoader<Map<String, Double>>(HashMap::new, (set, line) -> {
-                        String[] fields = line.split(" ");
-                        set.put(fields[1], Double.valueOf(fields[0]));
-                    }).loadCachedFromResource(defaultDictionaryFile, "word frequencies");
-            referenceStdDeviation = getDeviations(referenceWordFrequencies, referenceWordDeviations);
-
-        } catch (Exception ignored) {
-            referenceWordFrequencies = new HashMap<>();
-        }
+        referenceWordFrequencies =
+                new DictionaryLoader<Map<String, Double>>(HashMap::new, (set, line) -> {
+                    String[] fields = line.split(" ");
+                    set.put(fields[1], Double.valueOf(fields[0]));
+                }).loadCachedFromResource(defaultDictionaryFile, "word frequencies");
+        referenceStdDeviation = getDeviations(referenceWordFrequencies, referenceWordDeviations);
     }
 
     /**
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubleNegativeValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubleNegativeValidator.java
index ef17a943..f0cb21ac 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubleNegativeValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubleNegativeValidator.java
@@ -25,11 +25,12 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
+import static java.util.Arrays.asList;
+
 /**
  * Detect double negative expressions in Japanese texts.
  */
@@ -82,6 +83,6 @@ public class DoubleNegativeValidator extends Validator {
 
     @Override
     public List<String> getSupportedLanguages() {
-        return Arrays.asList(Locale.JAPANESE.getLanguage(), Locale.ENGLISH.getLanguage());
+        return asList(Locale.JAPANESE.getLanguage(), Locale.ENGLISH.getLanguage());
     }
 }
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubledWordValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubledWordValidator.java
index 2da8d99c..5b46e545 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubledWordValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/DoubledWordValidator.java
@@ -24,7 +24,6 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.HashSet;
 import java.util.Optional;
 import java.util.Set;
@@ -70,7 +69,7 @@ final public class DoubledWordValidator extends Validator {
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
-            customSkipList.addAll(WORD_LIST.loadCachedFromFile(new File(confFile.get()), "DoubledWordValidator user dictionary"));
+            customSkipList.addAll(WORD_LIST.loadCachedFromFile(findFile(confFile.get()), "DoubledWordValidator user dictionary"));
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidExpressionValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidExpressionValidator.java
index a988b8a6..2ace583f 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidExpressionValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidExpressionValidator.java
@@ -23,7 +23,6 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Optional;
@@ -71,7 +70,7 @@ final public class InvalidExpressionValidator extends Validator {
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
-            customInvalidExpressions.addAll(WORD_LIST.loadCachedFromFile(new File(confFile.get()), "InvalidExpressionValidator user dictionary"));
+            customInvalidExpressions.addAll(WORD_LIST.loadCachedFromFile(findFile(confFile.get()), "InvalidExpressionValidator user dictionary"));
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidWordValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidWordValidator.java
index 41581bc7..4673d581 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidWordValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/InvalidWordValidator.java
@@ -24,13 +24,7 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Detect invalid word occurrences.
@@ -74,7 +68,7 @@ final public class InvalidWordValidator extends Validator {
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
-            customInvalidWords.addAll(WORD_LIST.loadCachedFromFile(new File(confFile.get()), "InvalidWordValidator user dictionary"));
+            customInvalidWords.addAll(WORD_LIST.loadCachedFromFile(findFile(confFile.get()), "InvalidWordValidator user dictionary"));
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidator.java
index 30457a08..448dd495 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidator.java
@@ -24,13 +24,7 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Optional;
+import java.util.*;
 
 /**
  * Validate the end hyphens of Katakana words in Japanese documents.
@@ -121,7 +115,7 @@ final public class KatakanaEndHyphenValidator extends Validator {
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
-            customSkipList.addAll(WORD_LIST.loadCachedFromFile(new File(confFile.get()), "KatakanaEndHyphenValidator user dictionary"));
+            customSkipList.addAll(WORD_LIST.loadCachedFromFile(findFile(confFile.get()), "KatakanaEndHyphenValidator user dictionary"));
         }
     }
 
@@ -137,8 +131,7 @@ final public class KatakanaEndHyphenValidator extends Validator {
 
     @Override
     public int hashCode() {
-        int result = customSkipList != null ? customSkipList.hashCode() : 0;
-        return result;
+        return customSkipList != null ? customSkipList.hashCode() : 0;
     }
 
     @Override
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidator.java
index c6049876..e2368ea9 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidator.java
@@ -25,7 +25,6 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.*;
 
 /**
@@ -165,15 +164,14 @@ final public class KatakanaSpellCheckValidator extends Validator {
     protected void init() throws RedPenException {
         boolean disableDefault = getConfigAttributeAsBoolean("disable-default", false);
         if (!disableDefault) {
-            String defaultDictionaryFile = DEFAULT_RESOURCE_PATH
-                    + "/katakana-spellcheck.dat";
+            String defaultDictionaryFile = DEFAULT_RESOURCE_PATH + "/katakana-spellcheck.dat";
             exceptions = WORD_LIST.loadCachedFromResource(defaultDictionaryFile, "katakana word dictionary");
         }
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
             LOG.info("User defined Katakana word dictionary found.");
-            customExceptions.addAll(WORD_LIST.loadCachedFromFile(new File(confFile.get()),
+            customExceptions.addAll(WORD_LIST.loadCachedFromFile(findFile(confFile.get()),
                     "KatakanaSpellCheckValidator user dictionary"));
             LOG.info("Succeeded to add elements of user defined dictionary.");
         }
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/SpellingValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/SpellingValidator.java
index 3951d139..4f893b44 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/SpellingValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/SpellingValidator.java
@@ -25,7 +25,6 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Optional;
@@ -57,7 +56,7 @@ public class SpellingValidator extends Validator {
         Optional<String> userDictionaryFile = getConfigAttribute("dict");
         if (userDictionaryFile.isPresent()) {
             String f = userDictionaryFile.get();
-            customDictionary.addAll(WORD_LIST_LOWERCASED.loadCachedFromFile(new File(f), "SpellingValidator user dictionary"));
+            customDictionary.addAll(WORD_LIST_LOWERCASED.loadCachedFromFile(findFile(f), "SpellingValidator user dictionary"));
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidator.java
index 8a8acfb9..2f9fca04 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidator.java
@@ -24,13 +24,7 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Check if the input sentence start with a capital letter.
@@ -82,14 +76,12 @@ final public class StartWithCapitalLetterValidator extends Validator {
 
     @Override
     protected void init() throws RedPenException {
-
-        String defaultDictionaryFile = DEFAULT_RESOURCE_PATH
-                + "/default-capital-case-exception-list.dat";
+        String defaultDictionaryFile = DEFAULT_RESOURCE_PATH + "/default-capital-case-exception-list.dat";
         whiteList = WORD_LIST.loadCachedFromResource(defaultDictionaryFile, "capital letter exception dictionary");
 
         Optional<String> confFile = getConfigAttribute("dict");
         if (confFile.isPresent()) {
-            customWhiteList = WORD_LIST.loadCachedFromFile(new File(confFile.get()), "StartWithCapitalLetterValidator user dictionary");
+            customWhiteList = WORD_LIST.loadCachedFromFile(findFile(confFile.get()), "StartWithCapitalLetterValidator user dictionary");
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/SuggestExpressionValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/SuggestExpressionValidator.java
index da3658bb..e3883e08 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/SuggestExpressionValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/SuggestExpressionValidator.java
@@ -23,7 +23,6 @@ import cc.redpen.validator.Validator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
@@ -63,7 +62,7 @@ final public class SuggestExpressionValidator extends Validator {
             LOG.error("Dictionary file is not specified");
             throw new RedPenException("dictionary file is not specified");
         } else {
-            synonyms = KEY_VALUE.loadCachedFromFile(new File(confFile.get()), "SuggestExpressionValidator dictionary");
+            synonyms = KEY_VALUE.loadCachedFromFile(findFile(confFile.get()), "SuggestExpressionValidator dictionary");
         }
     }
 
diff --git a/redpen-core/src/main/java/cc/redpen/validator/sentence/WeakExpressionValidator.java b/redpen-core/src/main/java/cc/redpen/validator/sentence/WeakExpressionValidator.java
index e6160e65..429b7716 100644
--- a/redpen-core/src/main/java/cc/redpen/validator/sentence/WeakExpressionValidator.java
+++ b/redpen-core/src/main/java/cc/redpen/validator/sentence/WeakExpressionValidator.java
@@ -43,15 +43,8 @@ public class WeakExpressionValidator extends Validator {
         super.init();
 
         String defaultDictionaryFile = DEFAULT_RESOURCE_PATH + "/weak-expressions-" + getSymbolTable().getLang() + ".dat";
-        try {
-            weakExpressions =
-                    new DictionaryLoader<List<String>>(ArrayList::new, (list, line) -> {
-                        list.add(line.trim().toLowerCase());
-                    }).loadCachedFromResource(defaultDictionaryFile, "weak expressions");
-
-        } catch (Exception ignored) {
-            weakExpressions = new ArrayList<>();
-        }
+        weakExpressions = new DictionaryLoader<List<String>>(ArrayList::new, (list, line) -> list.add(line.trim().toLowerCase()))
+          .loadCachedFromResource(defaultDictionaryFile, "weak expressions");
     }
 
     /**
diff --git a/redpen-server/src/main/java/cc/redpen/server/api/RedPenService.java b/redpen-server/src/main/java/cc/redpen/server/api/RedPenService.java
index d666b0db..02f4914d 100644
--- a/redpen-server/src/main/java/cc/redpen/server/api/RedPenService.java
+++ b/redpen-server/src/main/java/cc/redpen/server/api/RedPenService.java
@@ -108,8 +108,7 @@ public class RedPenService {
      * @return a configured redpen instance
      */
     public RedPen getRedPen(String lang, Map<String, Map<String, String>> validatorProperties) {
-
-        Configuration.ConfigurationBuilder configBuilder = new Configuration.ConfigurationBuilder();
+        Configuration.ConfigurationBuilder configBuilder = Configuration.builder();
         configBuilder.setLanguage(lang);
 
         // add the validators and their properties


Test patch:
diff --git a/redpen-core/src/test/java/cc/redpen/AsciiDocParserTest.java b/redpen-core/src/test/java/cc/redpen/AsciiDocParserTest.java
index 739bdd83..d124127d 100644
--- a/redpen-core/src/test/java/cc/redpen/AsciiDocParserTest.java
+++ b/redpen-core/src/test/java/cc/redpen/AsciiDocParserTest.java
@@ -46,7 +46,7 @@ public class AsciiDocParserTest {
 
     @Test(expected = NullPointerException.class)
     public void testNullDocument() throws Exception {
-        Configuration configuration = new Configuration.ConfigurationBuilder().build();
+        Configuration configuration = Configuration.builder().build();
         DocumentParser parser = DocumentParser.ASCIIDOC;
         InputStream is = null;
         parser.parse(is, new SentenceExtractor(configuration.getSymbolTable()), configuration.getTokenizer());
@@ -130,7 +130,7 @@ public class AsciiDocParserTest {
         assertEquals(2, firstSection.getNumberOfParagraphs());
         assertEquals(0, firstSection.getNumberOfSubsections());
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
+        Configuration configuration = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Spelling"))
                 .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol")).build();
 
@@ -435,7 +435,7 @@ public class AsciiDocParserTest {
         Document doc = null;
         try {
             InputStream in = new FileInputStream(this.getClass().getClassLoader().getResource("asciidoc/" + filename).getFile());
-            Configuration configuration = new Configuration.ConfigurationBuilder().setLanguage(lang).build();
+            Configuration configuration = Configuration.builder().setLanguage(lang).build();
             doc = parser.parse(
                     in,
                     new SentenceExtractor(configuration.getSymbolTable()),
@@ -464,7 +464,7 @@ public class AsciiDocParserTest {
         DocumentParser parser = DocumentParser.ASCIIDOC;
         Document doc = null;
         try {
-            Configuration configuration = new Configuration.ConfigurationBuilder().build();
+            Configuration configuration = Configuration.builder().build();
             doc = parser.parse(
                     inputDocumentString,
                     new SentenceExtractor(configuration.getSymbolTable()),
diff --git a/redpen-core/src/test/java/cc/redpen/LaTeXParserTest.java b/redpen-core/src/test/java/cc/redpen/LaTeXParserTest.java
index e9a389f8..cd5834f2 100644
--- a/redpen-core/src/test/java/cc/redpen/LaTeXParserTest.java
+++ b/redpen-core/src/test/java/cc/redpen/LaTeXParserTest.java
@@ -20,13 +20,11 @@ package cc.redpen;
 import cc.redpen.config.Configuration;
 import cc.redpen.config.ValidatorConfiguration;
 import cc.redpen.model.Document;
-import cc.redpen.model.ListBlock;
 import cc.redpen.model.Paragraph;
 import cc.redpen.model.Section;
 import cc.redpen.parser.DocumentParser;
 import cc.redpen.parser.LineOffset;
 import cc.redpen.parser.SentenceExtractor;
-import cc.redpen.parser.latex.LaTeXProcessor;
 import cc.redpen.validator.ValidationError;
 import org.junit.Before;
 import org.junit.Test;
@@ -36,11 +34,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 
-import static cc.redpen.config.SymbolType.COMMA;
-import static cc.redpen.config.SymbolType.FULL_STOP;
-import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
-import static cc.redpen.parser.latex.Tools.*;
+import static org.junit.Assert.assertNotNull;
 
 public class LaTeXParserTest {
 
@@ -539,7 +534,7 @@ public class LaTeXParserTest {
             + "大きなベッドタウンであり、多くの人が住んでいる。"
             + "\\end{document}\n";
         Configuration config =
-                new Configuration.ConfigurationBuilder().setLanguage("ja").build();
+                Configuration.builder("ja").build();
         Document doc = createFileContent(sampleText, config);
 
         Section firstSections = doc.getSection(0);
@@ -557,15 +552,12 @@ public class LaTeXParserTest {
             + "\\begin{document}\n"
             + "This is a good day。\n" // invalid end of sentence symbol
             + "\\end{document}\n";
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
+        Configuration conf = Configuration.builder().build();
         List<Document> documents = new ArrayList<>();
         documents.add(createFileContent(sampleText, conf));
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         RedPen redPen = new RedPen(configuration);
@@ -588,7 +580,7 @@ public class LaTeXParserTest {
     }
 
     private Document createFileContent(String inputDocumentString) {
-        Configuration conf = new Configuration.ConfigurationBuilder().build();
+        Configuration conf = Configuration.builder().build();
         DocumentParser parser = DocumentParser.LATEX;
         Document doc = null;
         try {
diff --git a/redpen-core/src/test/java/cc/redpen/MarkdownParserTest.java b/redpen-core/src/test/java/cc/redpen/MarkdownParserTest.java
index 93572dd9..cb22eb83 100644
--- a/redpen-core/src/test/java/cc/redpen/MarkdownParserTest.java
+++ b/redpen-core/src/test/java/cc/redpen/MarkdownParserTest.java
@@ -39,7 +39,6 @@ import java.util.List;
 import static cc.redpen.config.SymbolType.COMMA;
 import static cc.redpen.config.SymbolType.FULL_STOP;
 import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
 
 public class MarkdownParserTest {
 
@@ -49,7 +48,7 @@ public class MarkdownParserTest {
 
     @Test(expected = NullPointerException.class)
     public void testNullDocument() throws Exception {
-        Configuration configuration = new Configuration.ConfigurationBuilder().build();
+        Configuration configuration = Configuration.builder().build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         InputStream is = null;
         parser.parse(is, new SentenceExtractor(configuration.getSymbolTable()), configuration.getTokenizer());
@@ -815,7 +814,7 @@ public class MarkdownParserTest {
         sampleText += "わたしもお寿司が大好きです。\n";
         sampleText += "\n";
 
-        Document doc = createFileContent(sampleText, new Configuration.ConfigurationBuilder().setLanguage("ja").build());
+        Document doc = createFileContent(sampleText, Configuration.builder("ja").build());
 
         assertNotNull("doc is null", doc);
         assertEquals(2, doc.size());
@@ -844,8 +843,7 @@ public class MarkdownParserTest {
     public void testGenerateJapaneseDocument() {
         String sampleText = "埼玉は東京の北に存在する。";
         sampleText += "大きなベッドタウンであり、多くの人が住んでいる。";
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("ja").build();
+        Configuration conf = Configuration.builder("ja").build();
 
         Document doc = createFileContent(sampleText, conf);
         Section firstSections = doc.getSection(0);
@@ -857,8 +855,7 @@ public class MarkdownParserTest {
     public void testGenerateJapaneseWithMultipleSentencesInOneLine() {
         String sampleText = "それは異なる．たとえば，\\n" +
                 "以下のとおりである．";
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("ja")
+        Configuration conf = Configuration.builder("ja")
                 .addSymbol(new Symbol(FULL_STOP, '．', "."))
                 .addSymbol(new Symbol(COMMA, '，', "、"))
                 .build();
@@ -877,15 +874,12 @@ public class MarkdownParserTest {
     @Test
     public void testErrorPositionOfMarkdownParser() throws RedPenException {
         String sampleText = "This is a good day。\n"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
+        Configuration conf = Configuration.builder().build();
         List<Document> documents = new ArrayList<>();
         documents.add(createFileContent(sampleText, conf));
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         RedPen redPen = new RedPen(configuration);
@@ -900,15 +894,12 @@ public class MarkdownParserTest {
     @Test
     public void testInvalidSentenceInBlockquote() throws UnsupportedEncodingException, RedPenException {
         String sampleText = "> This is a good day。\n"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
+        Configuration conf = Configuration.builder().build();
         List<Document> documents = new ArrayList<>();
         documents.add(createFileContent(sampleText, conf));
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
         RedPen redPen = new RedPen(configuration);
         List<ValidationError> errors = redPen.validate(documents).get(documents.get(0));
@@ -931,7 +922,7 @@ public class MarkdownParserTest {
         DocumentParser parser = DocumentParser.MARKDOWN;
         Document doc = null;
         try {
-            Configuration configuration = new Configuration.ConfigurationBuilder().build();
+            Configuration configuration = Configuration.builder().build();
             doc = parser.parse(inputDocumentString, new SentenceExtractor(configuration.getSymbolTable()),
                     configuration.getTokenizer());
         } catch (RedPenException e) {
diff --git a/redpen-core/src/test/java/cc/redpen/PlainTextParserTest.java b/redpen-core/src/test/java/cc/redpen/PlainTextParserTest.java
index d7b489dd..11da8dac 100644
--- a/redpen-core/src/test/java/cc/redpen/PlainTextParserTest.java
+++ b/redpen-core/src/test/java/cc/redpen/PlainTextParserTest.java
@@ -65,7 +65,7 @@ public class PlainTextParserTest {
 
     private Document generateDocument(String sampleText, String lang) {
         Document doc = null;
-        Configuration configuration = new Configuration.ConfigurationBuilder().setLanguage(lang).build();
+        Configuration configuration = Configuration.builder().setLanguage(lang).build();
 
         try {
             doc = parser.parse(sampleText, new SentenceExtractor(configuration.getSymbolTable()), configuration.getTokenizer());
@@ -77,10 +77,6 @@ public class PlainTextParserTest {
 
     @Before
     public void setup() {
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SentenceLength").addAttribute("max_length", "10"))
-                .build();
         parser = DocumentParser.PLAIN;
     }
 
@@ -325,18 +321,15 @@ public class PlainTextParserTest {
     @Test
     public void testErrorPositionOfPlainTextParser() throws RedPenException {
         String sampleText = "This is a good day。\n"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
+        Configuration conf = Configuration.builder().build();
         List<Document> documents = new ArrayList<>();
 
         DocumentParser parser = DocumentParser.PLAIN;
         Document doc = parser.parse(sampleText, new SentenceExtractor(conf.getSymbolTable()), conf.getTokenizer());
         documents.add(doc);
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         RedPen redPen = new RedPen(configuration);
diff --git a/redpen-core/src/test/java/cc/redpen/RedPenTest.java b/redpen-core/src/test/java/cc/redpen/RedPenTest.java
index 6616ec27..e33b59ec 100644
--- a/redpen-core/src/test/java/cc/redpen/RedPenTest.java
+++ b/redpen-core/src/test/java/cc/redpen/RedPenTest.java
@@ -46,7 +46,7 @@ public class RedPenTest {
     public void testEmptyValidator() throws RedPenException {
 
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("In a land far away, there once was as a hungry programmer.", 1))
@@ -57,7 +57,7 @@ public class RedPenTest {
                 .addSentence(new Sentence("One day while programming, he got a new idea.", 4))
                 .build());
 
-        Configuration configuration = new Configuration.ConfigurationBuilder().build();
+        Configuration configuration = Configuration.builder().build();
         RedPen redPen = new RedPen(configuration);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
         Assert.assertEquals(0, errors.get(documents.get(0)).size());
@@ -68,7 +68,7 @@ public class RedPenTest {
     public void testSentenceValidatorWithSimpleDocument()
             throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .setFileName("tested file")
                 .addSection(0)
                 .addParagraph()
@@ -94,7 +94,7 @@ public class RedPenTest {
             throws RedPenException {
         List<Document> documents = new ArrayList<>();
 
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .setFileName("tested file")
                 .addSection(0)
                 .addSectionHeader("foobar")
@@ -118,7 +118,7 @@ public class RedPenTest {
     @Test
     public void testDocumentWithHeader() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .setFileName("tested file")
                 .addSection(0)
                 .addSectionHeader("this is it.")
@@ -142,7 +142,7 @@ public class RedPenTest {
     @Test
     public void testDocumentWithList() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .setFileName("tested file")
                 .addSection(0)
                 .addSectionHeader("this is it")
@@ -168,7 +168,7 @@ public class RedPenTest {
     @Test
     public void testDocumentWithoutContent() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .setFileName("tested file")
                 .build());
 
@@ -183,18 +183,16 @@ public class RedPenTest {
     private RedPen getRedPenWithSentenceValidator() throws
             RedPenException {
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SentenceLength").addAttribute("max_len", "5"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SentenceLength").addAttribute("max_len", "5"))
                 .build();
         return new RedPen(configuration);
     }
 
     private RedPen getRedPenWithSectionValidator() throws
             RedPenException {
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SectionLength").addAttribute("max_num", "5"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SectionLength").addAttribute("max_num", "5"))
                 .build();
         return new RedPen(configuration);
     }
diff --git a/redpen-core/src/test/java/cc/redpen/SampleDocumentGenerator.java b/redpen-core/src/test/java/cc/redpen/SampleDocumentGenerator.java
index 86332b32..5687942e 100644
--- a/redpen-core/src/test/java/cc/redpen/SampleDocumentGenerator.java
+++ b/redpen-core/src/test/java/cc/redpen/SampleDocumentGenerator.java
@@ -40,10 +40,8 @@ public class SampleDocumentGenerator {
      * @param parser    document syntax: wiki, markdown or plain
      * @return DocumentCollection object
      */
-    public static List<Document> generateOneFileDocument(String docString,
-                                                             DocumentParser parser) throws RedPenException {
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .setLanguage("en").build();
+    public static List<Document> generateOneFileDocument(String docString, DocumentParser parser) throws RedPenException {
+        Configuration configuration = Configuration.builder().build();
         List<Document> docs = new ArrayList<>();
         docs.add(parser.parse(docString, new SentenceExtractor(configuration.getSymbolTable()), configuration.getTokenizer()));
         return docs;
diff --git a/redpen-core/src/test/java/cc/redpen/WikiParserTest.java b/redpen-core/src/test/java/cc/redpen/WikiParserTest.java
index d33e4d88..22c9f27b 100644
--- a/redpen-core/src/test/java/cc/redpen/WikiParserTest.java
+++ b/redpen-core/src/test/java/cc/redpen/WikiParserTest.java
@@ -591,8 +591,7 @@ public class WikiParserTest {
         String sampleText = "埼玉は東京の北に存在する。";
         sampleText += "大きなベッドタウンであり、多くの人が住んでいる。";
 
-        Configuration config =
-                new Configuration.ConfigurationBuilder().setLanguage("ja").build();
+        Configuration config = Configuration.builder("ja").build();
         Document doc = createFileContent(sampleText, config);
 
         Section firstSections = doc.getSection(0);
@@ -603,15 +602,12 @@ public class WikiParserTest {
     @Test
     public void testErrorPositionOfMarkdownParser() throws RedPenException {
         String sampleText = "This is a good day。\n"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
+        Configuration conf = Configuration.builder().build();
         List<Document> documents = new ArrayList<>();
         documents.add(createFileContent(sampleText, conf));
 
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         RedPen redPen = new RedPen(configuration);
@@ -634,7 +630,7 @@ public class WikiParserTest {
     }
 
     private Document createFileContent(String inputDocumentString) {
-        Configuration conf = new Configuration.ConfigurationBuilder().build();
+        Configuration conf = Configuration.builder().build();
         DocumentParser parser = DocumentParser.WIKI;
         Document doc = null;
         try {
diff --git a/redpen-core/src/test/java/cc/redpen/config/ConfigurationExporterTest.java b/redpen-core/src/test/java/cc/redpen/config/ConfigurationExporterTest.java
index efcdf998..7c561d2e 100644
--- a/redpen-core/src/test/java/cc/redpen/config/ConfigurationExporterTest.java
+++ b/redpen-core/src/test/java/cc/redpen/config/ConfigurationExporterTest.java
@@ -20,21 +20,21 @@ public class ConfigurationExporterTest {
 
   @Test
   public void emptyConfig() throws Exception {
-    Configuration config = new Configuration.ConfigurationBuilder().build();
+    Configuration config = Configuration.builder().build();
     exporter.export(config, out);
     assertEquals("<redpen-conf lang=\"en\">\n</redpen-conf>", out.toString());
   }
 
   @Test
   public void emptyConfigForJapaneseLanguage() throws Exception {
-    Configuration config = new Configuration.ConfigurationBuilder().setLanguage("ja").build();
+    Configuration config = Configuration.builder("ja").build();
     exporter.export(config, out);
     assertEquals("<redpen-conf lang=\"ja\" variant=\"zenkaku\">\n</redpen-conf>", out.toString());
   }
 
   @Test
   public void validators() throws Exception {
-    Configuration config = new Configuration.ConfigurationBuilder()
+    Configuration config = Configuration.builder()
       .addValidatorConfig(new ValidatorConfiguration("Mega"))
       .addValidatorConfig(new ValidatorConfiguration("Super").addAttribute("hello", "world")).build();
     exporter.export(config, out);
@@ -51,7 +51,7 @@ public class ConfigurationExporterTest {
 
   @Test
   public void symbols() throws Exception {
-    Configuration config = new Configuration.ConfigurationBuilder()
+    Configuration config = Configuration.builder()
       .addSymbol(new Symbol(ASTERISK, 'X'))
       .addSymbol(new Symbol(COLON, ';', ":", false, true))
       .addSymbol(new Symbol(SEMICOLON, ':', ";&", true, false)).build();
diff --git a/redpen-core/src/test/java/cc/redpen/config/ConfigurationLoaderTest.java b/redpen-core/src/test/java/cc/redpen/config/ConfigurationLoaderTest.java
index 7631ad47..7b1c4f50 100644
--- a/redpen-core/src/test/java/cc/redpen/config/ConfigurationLoaderTest.java
+++ b/redpen-core/src/test/java/cc/redpen/config/ConfigurationLoaderTest.java
@@ -20,6 +20,10 @@ package cc.redpen.config;
 import cc.redpen.RedPenException;
 import org.junit.Test;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
 import static cc.redpen.config.SymbolType.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -394,4 +398,14 @@ public class ConfigurationLoaderTest {
         new ConfigurationLoader().loadFromString(sampleConfigString);
     }
 
+    @Test
+    public void loadFromFileSetsBaseDir() throws Exception {
+        File file = File.createTempFile("redpen-conf", ".xml");
+        file.deleteOnExit();
+        try (OutputStream out = new FileOutputStream(file)) {
+            out.write("<redpen-conf/>".getBytes());
+        }
+        Configuration config = new ConfigurationLoader().load(file);
+        assertEquals(file.getParentFile(), config.getBase());
+    }
 }
diff --git a/redpen-core/src/test/java/cc/redpen/config/ConfigurationRedPenBuilderTest.java b/redpen-core/src/test/java/cc/redpen/config/ConfigurationRedPenBuilderTest.java
index c6f082f7..bf72e5a0 100644
--- a/redpen-core/src/test/java/cc/redpen/config/ConfigurationRedPenBuilderTest.java
+++ b/redpen-core/src/test/java/cc/redpen/config/ConfigurationRedPenBuilderTest.java
@@ -28,10 +28,10 @@ import static org.junit.Assert.*;
 public class ConfigurationRedPenBuilderTest {
     @Test
     public void testBuildSimpleConfiguration() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
                 .addValidatorConfig(new ValidatorConfiguration("SentenceLength"))
-                .setLanguage("en").build();
+                .build();
 
         assertEquals(2, config.getValidatorConfigs().size());
         assertNotNull(config.getSymbolTable());
@@ -43,7 +43,7 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationWithoutSymbolTable() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
                 .addValidatorConfig(new ValidatorConfiguration("SentenceLength")).build();
 
@@ -57,7 +57,7 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationAddingProperties() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression")
                         .addAttribute("dict", "./foobar.dict"))
                 .addValidatorConfig(new ValidatorConfiguration("SentenceLength")
@@ -77,9 +77,8 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationSpecifyingLanguage() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja")
                 .build();
 
         assertNotNull(config.getSymbolTable());
@@ -89,9 +88,8 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationSpecifyingLanguageAndType() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja")
                 .setVariant("hankaku")
                 .build();
 
@@ -102,9 +100,8 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationOverrideSymbolSetting() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja")
                 .addSymbol(new Symbol(FULL_STOP, '.'))
                 .build();
 
@@ -115,9 +112,8 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationOverrideAddInvalidSymbolSetting() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja")
                 .addSymbol(new Symbol(SymbolType.FULL_STOP, '。', ".．●"))
                 .build();
 
@@ -130,9 +126,8 @@ public class ConfigurationRedPenBuilderTest {
 
     @Test
     public void testBuildConfigurationAccessingSymbolByValue() {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja")
                 .addSymbol(new Symbol(SymbolType.FULL_STOP, '。', ".．●"))
                 .build();
 
@@ -147,9 +142,8 @@ public class ConfigurationRedPenBuilderTest {
     }
 
     @Test(expected = IllegalStateException.class)
-    public void testBuildTwice(){
-        Configuration.ConfigurationBuilder builder = new Configuration.ConfigurationBuilder();
-        builder.setLanguage("en");
+    public void testBuildTwice() {
+        Configuration.ConfigurationBuilder builder = Configuration.builder();
         builder.build();
         // ConfigurationBuilder is not designed to build more than one RedPen instance
         builder.setLanguage("ja");
diff --git a/redpen-core/src/test/java/cc/redpen/config/ConfigurationTest.java b/redpen-core/src/test/java/cc/redpen/config/ConfigurationTest.java
index ec97b6dc..7a90468d 100644
--- a/redpen-core/src/test/java/cc/redpen/config/ConfigurationTest.java
+++ b/redpen-core/src/test/java/cc/redpen/config/ConfigurationTest.java
@@ -17,12 +17,10 @@
  */
 package cc.redpen.config;
 
+import cc.redpen.RedPenException;
 import org.junit.Test;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.io.*;
 import java.util.Optional;
 
 import static cc.redpen.config.SymbolType.AMPERSAND;
@@ -36,8 +34,7 @@ public class ConfigurationTest {
 
     @Test
     public void testSentenceValidatorConfiguration() throws Exception {
-
-        Configuration configuration = new Configuration.ConfigurationBuilder()
+        Configuration configuration = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SentenceLength"))
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
@@ -57,7 +54,7 @@ public class ConfigurationTest {
         // NOTE: not throw a exception even when adding a non exist validator.
         // The errors occurs when creating the added non existing validator instance.
         try {
-            new Configuration.ConfigurationBuilder()
+            Configuration.builder()
                     .addValidatorConfig(new ValidatorConfiguration("ThereIsNoSuchValidator")).build();
         } catch (Exception e) {
             fail();
@@ -66,7 +63,7 @@ public class ConfigurationTest {
 
     @Test
     public void testSectionValidatorConfiguration() throws Exception {
-        Configuration configuration = new Configuration.ConfigurationBuilder().addValidatorConfig(new ValidatorConfiguration("SectionLength"))
+        Configuration configuration = Configuration.builder().addValidatorConfig(new ValidatorConfiguration("SectionLength"))
                 .addValidatorConfig(new ValidatorConfiguration("MaxParagraphNumber"))
                 .addValidatorConfig(new ValidatorConfiguration("ParagraphStartWith")).build();
         assertEquals(3, configuration.getValidatorConfigs().size());
@@ -74,7 +71,7 @@ public class ConfigurationTest {
 
     @Test
     public void testSymbolTableWithoutLanguageSetting() throws Exception {
-        Configuration configuration = new Configuration.ConfigurationBuilder().build(); // NOTE: load "en" setting when lang is not specified
+        Configuration configuration = Configuration.builder().build(); // NOTE: load "en" setting when lang is not specified
         assertEquals("en", configuration.getLang());
         assertNotNull(configuration.getLang());
     }
@@ -82,25 +79,77 @@ public class ConfigurationTest {
     @Test
     public void keyIsLangAndType() throws Exception {
         SymbolTable symbolTable = new SymbolTable("ja", Optional.of("hankaku"), emptyList());
-        assertEquals("ja.hankaku", new Configuration(symbolTable, emptyList(), "ja").getKey());
+        assertEquals("ja.hankaku", new Configuration(new File(""), symbolTable, emptyList(), "ja").getKey());
     }
 
     @Test
     public void keyIsLangOnlyIfTypeIsMissing() throws Exception {
         SymbolTable symbolTable = new SymbolTable("en", Optional.empty(), emptyList());
-        assertEquals("en", new Configuration(symbolTable, emptyList(), "en").getKey());
+        assertEquals("en", new Configuration(new File(""), symbolTable, emptyList(), "en").getKey());
     }
 
     @Test
     public void keyIsLangOnlyForZenkaku() throws Exception {
         SymbolTable symbolTable = new SymbolTable("ja", Optional.of("zenkaku"), emptyList());
-        assertEquals("ja", new Configuration(symbolTable, emptyList(), "ja").getKey());
+        assertEquals("ja", new Configuration(new File(""), symbolTable, emptyList(), "ja").getKey());
+    }
+
+    @Test
+    public void homeIsWorkingDirectoryByDefault() throws Exception {
+        System.clearProperty("REDPEN_HOME");
+        assertEquals(new File(""), Configuration.builder().build().getHome());
+    }
+
+    @Test
+    public void homeIsResolvedFromSystemPropertyOrEnvironment() throws Exception {
+        System.setProperty("REDPEN_HOME", "/foo");
+        assertEquals(new File("/foo"), Configuration.builder().build().getHome());
+    }
+
+    @Test
+    public void findFileLooksInWorkingDirectoryFirst() throws Exception {
+        String localFile = new File(".").list()[0];
+        assertEquals(new File(localFile), Configuration.builder().build().findFile(localFile));
+    }
+
+    @Test
+    public void findFileLooksInConfigBaseDirectorySecond() throws Exception {
+        assertEquals(new File("src/main"), Configuration.builder().setBaseDir(new File("src")).build().findFile("main"));
+    }
+
+    @Test
+    public void findFileLooksInRedPenHomeDirectoryThird() throws Exception {
+        System.setProperty("REDPEN_HOME", "src");
+        assertEquals(new File("src/main"), Configuration.builder().build().findFile("main"));
+    }
+
+    @Test
+    public void findFileFailsIfFileNotFound() throws Exception {
+        try {
+            System.setProperty("REDPEN_HOME", "src");
+            Configuration.builder().build().findFile("hello.xml");
+            fail("Expecting RedPenException");
+        }
+        catch (RedPenException e) {
+            assertEquals("hello.xml is not under working directory (" + new File("").getAbsoluteFile() + ") or $REDPEN_HOME (" + new File("src").getAbsoluteFile() + ").", e.getMessage());
+        }
+    }
+
+    @Test
+    public void findFileFailsIfFileNotFound_basePathPresent() throws Exception {
+        try {
+            System.setProperty("REDPEN_HOME", "src");
+            Configuration.builder().setBaseDir(new File("some/base/dir")).build().findFile("hello.xml");
+            fail("Expecting RedPenException");
+        }
+        catch (RedPenException e) {
+            assertEquals("hello.xml is not under working directory (" + new File("").getAbsoluteFile() + "), base (some/base/dir) or $REDPEN_HOME (" + new File("src").getAbsoluteFile() + ").", e.getMessage());
+        }
     }
 
     @Test
     public void canBeCloned() throws Exception {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-          .setLanguage("ja")
+        Configuration conf = Configuration.builder("ja")
           .setVariant("hankaku")
           .addValidatorConfig(new ValidatorConfiguration("SentenceLength")).build();
 
@@ -119,8 +168,7 @@ public class ConfigurationTest {
 
     @Test
     public void equals() throws Exception {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-          .setLanguage("ja")
+        Configuration conf = Configuration.builder("ja")
           .setVariant("hankaku")
           .addValidatorConfig(new ValidatorConfiguration("SentenceLength")).build();
 
@@ -138,8 +186,7 @@ public class ConfigurationTest {
 
     @Test
     public void serializable() throws Exception {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-          .setLanguage("ja")
+        Configuration conf = Configuration.builder("ja")
           .setVariant("hankaku")
           .addValidatorConfig(new ValidatorConfiguration("SentenceLength")).build();
 
diff --git a/redpen-core/src/test/java/cc/redpen/config/ValidatorConfigurationTest.java b/redpen-core/src/test/java/cc/redpen/config/ValidatorConfigurationTest.java
index f5ff2d4e..729e2669 100644
--- a/redpen-core/src/test/java/cc/redpen/config/ValidatorConfigurationTest.java
+++ b/redpen-core/src/test/java/cc/redpen/config/ValidatorConfigurationTest.java
@@ -2,8 +2,7 @@ package cc.redpen.config;
 
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.*;
 
 public class ValidatorConfigurationTest {
 
@@ -18,4 +17,25 @@ public class ValidatorConfigurationTest {
     assertNotSame(conf.getAttributes(), clone.getAttributes());
     assertEquals(conf.getAttributes(), clone.getAttributes());
   }
+
+  @Test
+  public void equals() throws Exception {
+    ValidatorConfiguration conf = new ValidatorConfiguration("test").addAttribute("foo", "bar");
+    ValidatorConfiguration conf2 = new ValidatorConfiguration("test").addAttribute("foo", "bar");
+    assertEquals(conf, conf2);
+  }
+
+  @Test
+  public void equals_attributes() throws Exception {
+    ValidatorConfiguration conf = new ValidatorConfiguration("test").addAttribute("foo", "bar");
+    ValidatorConfiguration conf2 = new ValidatorConfiguration("test").addAttribute("foo", "bar2");
+    assertFalse(conf.equals(conf2));
+  }
+
+  @Test
+  public void equals_names() throws Exception {
+    ValidatorConfiguration conf = new ValidatorConfiguration("test");
+    ValidatorConfiguration conf2 = new ValidatorConfiguration("test2");
+    assertFalse(conf.equals(conf2));
+  }
 }
\ No newline at end of file
diff --git a/redpen-core/src/test/java/cc/redpen/formatter/FormatterTest.java b/redpen-core/src/test/java/cc/redpen/formatter/FormatterTest.java
index cce47d4f..dd7b7a9b 100644
--- a/redpen-core/src/test/java/cc/redpen/formatter/FormatterTest.java
+++ b/redpen-core/src/test/java/cc/redpen/formatter/FormatterTest.java
@@ -50,7 +50,7 @@ public class FormatterTest extends Validator {
         setErrorList(errors);
         addLocalizedError(new Sentence("sentence", 1));
         Map<Document, List<ValidationError>> docErrorsMap = new HashMap<>();
-        Document document = new Document.DocumentBuilder().build();
+        Document document = Document.builder().build();
         docErrorsMap.put(document, errors);
         String result = formatter.format(docErrorsMap);
         Pattern p = Pattern.compile("foobar");
diff --git a/redpen-core/src/test/java/cc/redpen/formatter/JSONBySentenceFormatterTest.java b/redpen-core/src/test/java/cc/redpen/formatter/JSONBySentenceFormatterTest.java
index 6e87cfa6..807c7be2 100644
--- a/redpen-core/src/test/java/cc/redpen/formatter/JSONBySentenceFormatterTest.java
+++ b/redpen-core/src/test/java/cc/redpen/formatter/JSONBySentenceFormatterTest.java
@@ -29,7 +29,7 @@ public class JSONBySentenceFormatterTest extends Validator {
         List<ValidationError> errors = new ArrayList<>();
         setErrorList(errors);
         addLocalizedError(new Sentence("testing JSONFormatter", 1));
-        Document document = new Document.DocumentBuilder().setFileName("docName").build();
+        Document document = Document.builder().setFileName("docName").build();
         String result = formatter.format(document, errors);
 
         JSONObject jsonObject = new JSONObject(result);
@@ -54,12 +54,9 @@ public class JSONBySentenceFormatterTest extends Validator {
     @Test
     public void testFormatErrorsFromMarkdownParser() throws RedPenException, JSONException {
         String sampleText = "This is a good day。"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration conf = Configuration.builder().build();
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/formatter/JSONFormatterTest.java b/redpen-core/src/test/java/cc/redpen/formatter/JSONFormatterTest.java
index de63712b..f8d2487b 100644
--- a/redpen-core/src/test/java/cc/redpen/formatter/JSONFormatterTest.java
+++ b/redpen-core/src/test/java/cc/redpen/formatter/JSONFormatterTest.java
@@ -48,7 +48,7 @@ public class JSONFormatterTest extends Validator {
         List<ValidationError> errors = new ArrayList<>();
         setErrorList(errors);
         addLocalizedError(new Sentence("testing JSONFormatter", 1));
-        Document document = new Document.DocumentBuilder().setFileName("docName").build();
+        Document document = Document.builder().setFileName("docName").build();
         String result = formatter.format(document, errors);
         JSONObject jsonObject = new JSONObject(result);
         String docName = jsonObject.getString("document");
@@ -68,7 +68,7 @@ public class JSONFormatterTest extends Validator {
         List<ValidationError> errors = new ArrayList<>();
         setErrorList(errors);
         addLocalizedError(new Sentence("testing JSONFormatter", 1));
-        Document document = new Document.DocumentBuilder().setFileName("docName").build();
+        Document document = Document.builder().setFileName("docName").build();
         Map<Document, List<ValidationError>> documentListMap = new HashMap<>();
         documentListMap.put(document, errors);
 
@@ -91,12 +91,9 @@ public class JSONFormatterTest extends Validator {
     @Test
     public void testFormatDocumentsAndErrorsWithPosition() throws RedPenException, JSONException {
         String sampleText = "This is a good day。"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration conf = Configuration.builder().build();
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/formatter/XMLFormatterTest.java b/redpen-core/src/test/java/cc/redpen/formatter/XMLFormatterTest.java
index 77d3b13e..feeb7add 100644
--- a/redpen-core/src/test/java/cc/redpen/formatter/XMLFormatterTest.java
+++ b/redpen-core/src/test/java/cc/redpen/formatter/XMLFormatterTest.java
@@ -103,12 +103,9 @@ public class XMLFormatterTest extends Validator {
     public void testConvertedValidationErrorWithErrorPosition() throws RedPenException {
         // TODO: shorten the procedure before getting formatter result.
         String sampleText = "This is a good day。\n"; // invalid end of sentence symbol
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
-                .build();
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidSymbol"))
+        Configuration conf = Configuration.builder().build();
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
                 .build();
 
         List<cc.redpen.model.Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/model/DocumentCollectionTest.java b/redpen-core/src/test/java/cc/redpen/model/DocumentCollectionTest.java
index 4e59d694..18a5b4c9 100644
--- a/redpen-core/src/test/java/cc/redpen/model/DocumentCollectionTest.java
+++ b/redpen-core/src/test/java/cc/redpen/model/DocumentCollectionTest.java
@@ -29,7 +29,7 @@ public class DocumentCollectionTest {
     @Test
     public void testCreateDocumentCollection() {
         List<Document> docs = new ArrayList<>();
-        docs.add(new Document.DocumentBuilder()
+        docs.add(Document.builder()
                 .setFileName("Foobar")
                 .addSection(0)
                 .addSectionHeader("baz")
@@ -56,14 +56,14 @@ public class DocumentCollectionTest {
     @Test
     public void testDocumentCollectionWithMultipleDocument() {
         List<Document> docs = new ArrayList<>();
-        docs.add(new Document.DocumentBuilder()
+        docs.add(Document.builder()
                 .setFileName("doc1")
                 .addSection(0)
                 .addSectionHeader("sec1")
                 .addParagraph()
                 .addSentence(new Sentence("sentence00", 1))
                 .addSentence(new Sentence("sentence01", 2)).build());
-        docs.add(new Document.DocumentBuilder()
+        docs.add(Document.builder()
                 .setFileName("doc2")
                 .addSection(0)
                 .addSectionHeader("sec2")
diff --git a/redpen-core/src/test/java/cc/redpen/model/DocumentTest.java b/redpen-core/src/test/java/cc/redpen/model/DocumentTest.java
index 3d467fbd..a9ebc339 100644
--- a/redpen-core/src/test/java/cc/redpen/model/DocumentTest.java
+++ b/redpen-core/src/test/java/cc/redpen/model/DocumentTest.java
@@ -27,14 +27,14 @@ import static org.junit.Assert.assertEquals;
 public class DocumentTest {
     @Test
     public void testCreateDocument() {
-        Document doc = new Document.DocumentBuilder()
+        Document doc = Document.builder()
                         .setFileName("Foobar").build();
         assertEquals(0, doc.size());
     }
 
     @Test
     public void testCreateDocumentWithList() {
-        Document doc = new Document.DocumentBuilder()
+        Document doc = Document.builder()
                 .setFileName("Foobar")
                 .addSection(0)
                 .addSectionHeader("baz")
@@ -70,7 +70,7 @@ public class DocumentTest {
 
     @Test
     public void testSentenceIsTokenized() {
-        Document doc = new Document.DocumentBuilder()
+        Document doc = Document.builder()
                 .setFileName("foobar")
                 .addSection(0)
                 .addSectionHeader("baz")
@@ -83,7 +83,7 @@ public class DocumentTest {
 
     @Test
     public void testJapaneseSentenceIsTokenized() {
-        Document doc = new Document.DocumentBuilder(new JapaneseTokenizer())
+        Document doc = Document.builder(new JapaneseTokenizer())
                 .setFileName("今日")
                 .addSection(0)
                 .addSectionHeader("天気")
@@ -96,7 +96,7 @@ public class DocumentTest {
 
     @Test(expected = IllegalStateException.class)
     public void testCreateParagraphBeforeSection() {
-        new Document.DocumentBuilder()
+        Document.builder()
                 .setFileName("Foobar")
                 .addParagraph()
                 .addSection(0)
@@ -105,7 +105,7 @@ public class DocumentTest {
 
     @Test(expected = IllegalStateException.class)
     public void testCreateListBlockBeforeSection() {
-        new Document.DocumentBuilder()
+        Document.builder()
                 .setFileName("Foobar")
                 .addListBlock()
                 .addSection(0)
@@ -114,7 +114,7 @@ public class DocumentTest {
 
     @Test(expected = IllegalStateException.class)
     public void testCreateListElementBeforeListBlock() {
-        new Document.DocumentBuilder()
+        Document.builder()
                 .setFileName("Foobar")
                 .addListElement(0, "foo")
                 .addListBlock()
diff --git a/redpen-core/src/test/java/cc/redpen/parser/SentenceExtractorTest.java b/redpen-core/src/test/java/cc/redpen/parser/SentenceExtractorTest.java
index 3978e333..e8dffec7 100644
--- a/redpen-core/src/test/java/cc/redpen/parser/SentenceExtractorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/parser/SentenceExtractorTest.java
@@ -41,7 +41,7 @@ public class SentenceExtractorTest {
     @Test
     public void testSimple() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         final String input = "this is a pen.";
         int lastPosition = extractor.extract(input, outputPositions);
@@ -54,7 +54,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentences() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a pen. that is a paper.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -68,7 +68,7 @@ public class SentenceExtractorTest {
     @Test
     public void testTwoSentencesWithDifferentStopCharacters() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "is this a pen? that is a paper.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -81,7 +81,7 @@ public class SentenceExtractorTest {
 
     @Test
     public void testMultipleSentencesWithoutPeriodInTheEnd() {
-        SentenceExtractor extractor = new SentenceExtractor(new Configuration.ConfigurationBuilder().build().getSymbolTable());
+        SentenceExtractor extractor = new SentenceExtractor(Configuration.builder().build().getSymbolTable());
         final String input = "this is a pen. that is a paper";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -94,7 +94,7 @@ public class SentenceExtractorTest {
     @Test
     public void testEndWithDoubleQuotation() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         final String input = "this is a \"pen.\"";
         int lastPosition = extractor.extract(input, outputPositions);
@@ -107,7 +107,7 @@ public class SentenceExtractorTest {
     @Test
     public void testEndWithSingleQuotation() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a \'pen.\'";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -120,7 +120,7 @@ public class SentenceExtractorTest {
     @Test
     public void testEndWithDoubleQuotationEnglishVersion() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a \"pen\".";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -133,7 +133,7 @@ public class SentenceExtractorTest {
     @Test
     public void testEndWithSingleQuotationEnglishVersion() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a \'pen\'.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -146,7 +146,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentencesOneOfThemIsEndWithDoubleQuotation() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a \"pen.\" Another one is not a pen.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -160,7 +160,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentencesWithPartialSplit() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a pen. Another\n" + "one is not a pen.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -174,7 +174,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentencesWithSplitInEndOfSentence() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a pen.\nAnother one is not a pen.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -188,7 +188,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentencesWithPartialSentence() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "this is a pen. Another\n";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -288,7 +288,7 @@ public class SentenceExtractorTest {
     @Test
     public void testSentenceWithWhiteWordPosition() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "He is a Dr. candidate.";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -301,7 +301,7 @@ public class SentenceExtractorTest {
     @Test
     public void testMultipleSentencesWithWhiteWordPosition() {
         SentenceExtractor extractor = new SentenceExtractor
-                (new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                (Configuration.builder().build().getSymbolTable());
         final String input = "Is he a Dr. candidate? Yes, he is.";  // NOTE: white word list contains "Dr."
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -315,7 +315,7 @@ public class SentenceExtractorTest {
     @Test
     public void testVoidLine() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = "";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -327,7 +327,7 @@ public class SentenceExtractorTest {
     @Test
     public void testJustPeriodLine() {
         SentenceExtractor extractor = new SentenceExtractor(
-                new Configuration.ConfigurationBuilder().build().getSymbolTable());
+                Configuration.builder().build().getSymbolTable());
         final String input = ".";
         List<Pair<Integer, Integer>> outputPositions = new ArrayList<>();
         int lastPosition = extractor.extract(input, outputPositions);
@@ -370,7 +370,7 @@ public class SentenceExtractorTest {
 
     @Test
     public void testThrowExceptionGivenNull() {
-        SentenceExtractor extractor = new SentenceExtractor(new Configuration.ConfigurationBuilder().build().getSymbolTable());
+        SentenceExtractor extractor = new SentenceExtractor(Configuration.builder().build().getSymbolTable());
         extractor.constructEndSentencePattern(); // not a throw exception
     }
 }
diff --git a/redpen-core/src/test/java/cc/redpen/parser/asciidoc/AsciiDocTest.java b/redpen-core/src/test/java/cc/redpen/parser/asciidoc/AsciiDocTest.java
index 004f6f26..4186a1d8 100644
--- a/redpen-core/src/test/java/cc/redpen/parser/asciidoc/AsciiDocTest.java
+++ b/redpen-core/src/test/java/cc/redpen/parser/asciidoc/AsciiDocTest.java
@@ -32,8 +32,7 @@ public class AsciiDocTest {
      */
     @Test
     public void testModelErasure() {
-
-        Configuration configuration = new Configuration.ConfigurationBuilder().build();
+        Configuration configuration = Configuration.builder().build();
 
         String asciidocText =
                 "[[purpose]]\n" +
diff --git a/redpen-core/src/test/java/cc/redpen/util/DictionaryLoaderTest.java b/redpen-core/src/test/java/cc/redpen/util/DictionaryLoaderTest.java
index 60251967..bbf7f510 100644
--- a/redpen-core/src/test/java/cc/redpen/util/DictionaryLoaderTest.java
+++ b/redpen-core/src/test/java/cc/redpen/util/DictionaryLoaderTest.java
@@ -25,13 +25,15 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import java.nio.file.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 public class DictionaryLoaderTest extends Validator {
     @Test
@@ -107,17 +109,8 @@ public class DictionaryLoaderTest extends Validator {
     }
 
     @Test
-    public void testEnsureFileIsInsideRedPenHomeOrWorkingDirectory() throws RedPenException, IOException {
-        File tempFile = File.createTempFile("redpenTest", "redpenTest");
-        String path = tempFile.getAbsolutePath();
-        System.setProperty("REDPEN_HOME", path);
-        DictionaryLoader.ensureFileIsInsideRedPenHomeOrWorkingDirectory(path + File.separator + "test");
-        DictionaryLoader.ensureFileIsInsideRedPenHomeOrWorkingDirectory(new File("fileInCurrentDirectory.txt").getCanonicalPath());
-        try {
-            File file = new File(path + File.separator + ".." + File.separator + "test");
-            DictionaryLoader.ensureFileIsInsideRedPenHomeOrWorkingDirectory(file.getCanonicalPath());
-            fail("expecting RedPenException");
-        } catch (RedPenException expected) {
-        }
+    public void testLoadingInexistingResourceReturnsAnEmptyCollection() throws Exception {
+        Set<String> result = new DictionaryLoader<Set<String>>(HashSet::new, null).loadCachedFromResource("hello.xml", "hello");
+        assertTrue(result.isEmpty());
     }
 }
diff --git a/redpen-core/src/test/java/cc/redpen/validator/BaseValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/BaseValidatorTest.java
index 6c39d721..46cc9419 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/BaseValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/BaseValidatorTest.java
@@ -15,13 +15,13 @@ public abstract class BaseValidatorTest {
   }
 
   protected Configuration getConfiguration(String language) {
-    return new Configuration.ConfigurationBuilder()
+    return Configuration.builder()
       .addValidatorConfig(new ValidatorConfiguration(validatorName))
       .setLanguage(language).build();
   }
 
   protected Document prepareSimpleDocument(String sentrence) {
-    return new Document.DocumentBuilder(config.getTokenizer())
+    return Document.builder(config.getTokenizer())
       .addSection(1)
       .addParagraph()
       .addSentence(new Sentence(sentrence, 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/JavaScriptValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/JavaScriptValidatorTest.java
index c2003f6a..a4e130c7 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/JavaScriptValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/JavaScriptValidatorTest.java
@@ -28,27 +28,34 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
 import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 public class JavaScriptValidatorTest extends JavaScriptValidator {
+    @Test
+    public void doNotCrashIfJsDirectoryDoesNotExist() throws Exception {
+        JavaScriptValidator validator = new JavaScriptValidator();
+        validator.preInit(new ValidatorConfiguration("JavaScript"), Configuration.builder().build());
+        validator.init();
+        assertTrue(validator.scripts.isEmpty());
+    }
+
     @Test
     public void testLoadFile() throws Exception {
         File file = File.createTempFile("test", "txt");
         String content = "hello\nred\npen.";
-        Files.write(Paths.get(file.getAbsolutePath()), content.getBytes(Charset.forName("UTF-8")));
+        Files.write(Paths.get(file.getAbsolutePath()), content.getBytes(UTF_8));
         String loadCached = JavaScriptValidator.loadCached(file);
         assertEquals(content, loadCached);
 
         String content2 = "hello\nred\npen.\nmodified\n";
-        Files.write(Paths.get(file.getAbsolutePath()), content2.getBytes(Charset.forName("UTF-8")));
+        Files.write(Paths.get(file.getAbsolutePath()), content2.getBytes(UTF_8));
         // ensure the modified date differs
         file.setLastModified(System.currentTimeMillis() + 2000);
 
@@ -62,18 +69,18 @@ public class JavaScriptValidatorTest extends JavaScriptValidator {
         // delete the temporary file, make a directory, and store JavaScript validator in it
         javaScriptValidatorsDir.delete();
         javaScriptValidatorsDir.mkdirs();
-        System.setProperty("REDPEN_HOME",javaScriptValidatorsDir.getAbsolutePath());
+        System.setProperty("REDPEN_HOME", javaScriptValidatorsDir.getAbsolutePath());
         File validatorJS = new File(javaScriptValidatorsDir.getAbsolutePath() + File.separator + "MyValidator.js");
         String content2 = "function validateSentence(sentence) {\n" +
                 "addLocalizedError(sentence, 'validation error in JavaScript Validator');}";
-        Files.write(Paths.get(validatorJS.getAbsolutePath()), content2.getBytes(Charset.forName("UTF-8")));
+        Files.write(Paths.get(validatorJS.getAbsolutePath()), content2.getBytes(UTF_8));
         validatorJS.deleteOnExit();
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("JavaScript").addAttribute("script-path", javaScriptValidatorsDir.getAbsolutePath()))
                 .build();
 
-        Document document = new Document.DocumentBuilder()
+        Document document = Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("the good item is a good example.", 1))
@@ -112,7 +119,7 @@ public class JavaScriptValidatorTest extends JavaScriptValidator {
                         "_JavaScriptValidatorTest.calledFunctions.add('validateSection');" +
                         // add ValidationError
                         "addLocalizedError(section.getHeaderContent(0), 'section');}"));
-        Document document = new Document.DocumentBuilder()
+        Document document = Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("the good item is a good example.", 1))
@@ -149,7 +156,7 @@ public class JavaScriptValidatorTest extends JavaScriptValidator {
                         "function validateSentence(sentence) {" +
                         // add ValidationError
                         "addLocalizedError(sentence, '[placeholder]');}"));
-        Document document = new Document.DocumentBuilder()
+        Document document = Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("the good item is a good example.", 1))
@@ -175,7 +182,7 @@ public class JavaScriptValidatorTest extends JavaScriptValidator {
                                          + "addLocalizedError(sentence, 'runtime environment is confined');"
                                          + "}"
                                          + "}"));
-        Document document = new Document.DocumentBuilder()
+        Document document = Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("the good item is a good example.", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/ValidatorFactoryTest.java b/redpen-core/src/test/java/cc/redpen/validator/ValidatorFactoryTest.java
index e39011f4..b95aecb2 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/ValidatorFactoryTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/ValidatorFactoryTest.java
@@ -23,8 +23,6 @@ import cc.redpen.config.ValidatorConfiguration;
 import cc.redpen.model.Sentence;
 import org.junit.Test;
 
-import java.util.List;
-
 import static junit.framework.Assert.fail;
 
 class NotImplementInterfaceValidator {}
@@ -38,13 +36,12 @@ class NoConstructorWithConfigsValidator extends Validator {
 public class ValidatorFactoryTest {
     @Test
     public void testCreateValidator() {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SentenceLength"))
                 .build();
         try {
             ValidatorFactory.getInstance(
-                    conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+                    conf.getValidatorConfigs().get(0), conf);
         } catch (RedPenException e) {
             fail();
         }
@@ -52,32 +49,29 @@ public class ValidatorFactoryTest {
 
     @Test(expected = RedPenException.class)
     public void testThrowExceptionWhenCreateNonExistValidator() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Foobar"))
                 .build();
         ValidatorFactory.getInstance(
-                conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+                conf.getValidatorConfigs().get(0), conf);
     }
 
     @Test(expected = RuntimeException.class)
     public void testThrowExceptionWhenCreateValidatorNotImplementsInterface() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("NotImplementInterface"))
                 .build();
         ValidatorFactory.getInstance(
-                conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+                conf.getValidatorConfigs().get(0), conf);
     }
 
     @Test(expected = RuntimeException.class)
     public void testThrowExceptionWhenCreateValidatorWithoutConstructorWithConfigs() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("NoConstructorWithConfigs"))
                 .build();
         ValidatorFactory.getInstance(
-                conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+                conf.getValidatorConfigs().get(0), conf);
     }
 
 }
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/DuplicatedSectionValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/section/DuplicatedSectionValidatorTest.java
index 20f444ff..698a8f41 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/DuplicatedSectionValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/section/DuplicatedSectionValidatorTest.java
@@ -35,13 +35,13 @@ public class DuplicatedSectionValidatorTest {
 
     @Test
     public void testDetectDuplicatedSection() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("DuplicatedSection"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addSectionHeader("this is header")
                         .addParagraph()
@@ -57,16 +57,15 @@ public class DuplicatedSectionValidatorTest {
         Assert.assertEquals(2, errors.get(documents.get(0)).size());
     }
 
-
     @Test
     public void testDetectNonDuplicatedSection() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("DuplicatedSection"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addSectionHeader("foobar")
                         .addParagraph()
@@ -84,13 +83,13 @@ public class DuplicatedSectionValidatorTest {
 
     @Test
     public void testDetectDuplicatedSectionWithSameHeader() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("DuplicatedSection"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addSectionHeader("this is header.")
                         .addParagraph()
@@ -108,14 +107,14 @@ public class DuplicatedSectionValidatorTest {
 
     @Test
     public void testDetectNonDuplicatedSectionWithLowThreshold() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("DuplicatedSection").addAttribute("threshold", "0.0"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         // create two section which contains only one same word, "baz"
         documents.add(
-        new Document.DocumentBuilder()
+        Document.builder()
                 .addSection(1)
                 .addSectionHeader("foobar")
                 .addParagraph()
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java
index 60246dc2..3b7abb1c 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/section/FrequentSentenceStartValidatorTest.java
@@ -37,7 +37,7 @@ public class FrequentSentenceStartValidatorTest {
         FrequentSentenceStartValidator validator = (FrequentSentenceStartValidator) ValidatorFactory.getInstance("FrequentSentenceStart");
 
         Document document =
-                new Document.DocumentBuilder(new WhiteSpaceTokenizer())
+                Document.builder(new WhiteSpaceTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("When it comes to the Subject Of Cake (the sweet and delicious baked delicacy), one should" +
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/ParagraphNumberValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/section/ParagraphNumberValidatorTest.java
index 26528812..f75e0563 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/ParagraphNumberValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/section/ParagraphNumberValidatorTest.java
@@ -60,7 +60,7 @@ public class ParagraphNumberValidatorTest {
         Section section = new Section(0);
         section.appendParagraph(new Paragraph());
 
-        Document document = new Document.DocumentBuilder().appendSection(section).build();
+        Document document = Document.builder().appendSection(section).build();
 
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java
index 71fe00a3..51d9ce53 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/section/UnexpandedAcronymValidatorTest.java
@@ -37,7 +37,7 @@ public class UnexpandedAcronymValidatorTest {
         UnexpandedAcronymValidator validator = (UnexpandedAcronymValidator) ValidatorFactory.getInstance("UnexpandedAcronym");
 
         Document document =
-                new Document.DocumentBuilder(new WhiteSpaceTokenizer())
+                Document.builder(new WhiteSpaceTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("When it comes to the Subject Of Cake (the sweet and delicious baked delicacy), one should" +
diff --git a/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java
index 52cefd7a..e8fdcd48 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/section/WordFrequencyValidatorTest.java
@@ -51,7 +51,7 @@ public class WordFrequencyValidatorTest {
                 "By 1285, following a period of social and environmental instability driven by a series of severe and prolonged droughts, they abandoned the area and moved south to locations in Arizona and New Mexico, including Rio Chama, Pajarito Plateau, and Santa Fe."
         };
 
-        Document.DocumentBuilder builder = new Document.DocumentBuilder(new WhiteSpaceTokenizer()).addSection(1).addParagraph();
+        Document.DocumentBuilder builder = Document.builder(new WhiteSpaceTokenizer()).addSection(1).addParagraph();
         int sentenceNumber = 1;
         for (String line : text) {
             builder.addSentence(new Sentence(line, sentenceNumber++));
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/ContractionValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/ContractionValidatorTest.java
index 44e5080e..473c5f51 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/ContractionValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/ContractionValidatorTest.java
@@ -34,13 +34,13 @@ import java.util.Map;
 public class ContractionValidatorTest {
     @Test
     public void testContraction() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Contraction"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("he is a super man.", 1))
@@ -55,13 +55,13 @@ public class ContractionValidatorTest {
 
     @Test
     public void testNoContraction() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Contraction"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("he is a super man.", 1))
@@ -76,13 +76,13 @@ public class ContractionValidatorTest {
 
     @Test
     public void testUpperCaseContraction() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Contraction"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("He is a super man.", 1))
@@ -100,13 +100,13 @@ public class ContractionValidatorTest {
      */
     @Test
     public void testManyContractions() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Contraction"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("he's a super man.", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubleNegativeValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubleNegativeValidatorTest.java
index 9ed235d0..986aa8de 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubleNegativeValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubleNegativeValidatorTest.java
@@ -28,7 +28,6 @@ import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
-
 import java.util.Map;
 
 import static junit.framework.Assert.assertEquals;
@@ -37,10 +36,8 @@ public class DoubleNegativeValidatorTest {
     @Test
     public void testDetectDoubleNegative() throws Exception {
         String sampleText = "そういう話なら、理解できないこともない。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("DoubleNegative"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
@@ -62,10 +59,8 @@ public class DoubleNegativeValidatorTest {
     public void testNotDetectSingleNegative() throws Exception {
         String sampleText =
                 "そういう話は理解できない。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("DoubleNegative"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -84,10 +79,8 @@ public class DoubleNegativeValidatorTest {
     public void testNotDetectPositiveType() throws Exception {
         String sampleText =
                 "そういう話は理解できる。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("DoubleNegative"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -105,10 +98,8 @@ public class DoubleNegativeValidatorTest {
     public void testDetectFuzzyDoubleNegative() throws Exception {
         String sampleText =
                 "そういう話なら、ないことないでしょう。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("DoubleNegative"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -127,10 +118,10 @@ public class DoubleNegativeValidatorTest {
     @Test
     public void testDetectEnDoubleNegative() throws Exception {
         String sampleText = "We believe it, unless it is not true";
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(
                         new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("en")
+
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
@@ -152,10 +143,8 @@ public class DoubleNegativeValidatorTest {
     @Test
     public void testDetectEnDoubleNegativeWithDistance() throws Exception {
         String sampleText = "unless that is not true, I will go there.";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("DoubleNegative"))
-                .setLanguage("en")
+        Configuration config = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("DoubleNegative"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledJoshiValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledJoshiValidatorTest.java
index 1df7cbb2..c081b85a 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledJoshiValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledJoshiValidatorTest.java
@@ -36,15 +36,15 @@ public class DoubledJoshiValidatorTest {
     @Test
     public void testDetectDoubledJoshi() throws Exception {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder(new JapaneseTokenizer())
+        documents.add(Document.builder(new JapaneseTokenizer())
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("私は彼は好き。", 1))
                 .build());
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("DoubledJoshi"))
-                .setLanguage("ja").build();
+                .build();
 
         RedPen redPen = new RedPen(config);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
@@ -54,15 +54,15 @@ public class DoubledJoshiValidatorTest {
     @Test
     public void testNotDetectSingleJoshi() throws Exception {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder(new JapaneseTokenizer())
+        documents.add(Document.builder(new JapaneseTokenizer())
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("私は彼が好き。", 1))
                 .build());
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("DoubledJoshi"))
-                .setLanguage("ja").build();
+                .build();
 
         RedPen redPen = new RedPen(config);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
@@ -72,15 +72,15 @@ public class DoubledJoshiValidatorTest {
     @Test
     public void testLoadSkipList() throws Exception {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder(new JapaneseTokenizer())
+        documents.add(Document.builder(new JapaneseTokenizer())
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("私は彼は好き。", 1))
                 .build());
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("DoubledJoshi").addAttribute("list", "は"))
-                .setLanguage("ja").build();
+                .build();
 
         RedPen redPen = new RedPen(config);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledWordValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledWordValidatorTest.java
index 3da0ae82..97ccd029 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledWordValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/DoubledWordValidatorTest.java
@@ -69,10 +69,10 @@ public class DoubledWordValidatorTest extends BaseValidatorTest {
 
     @Test
     public void testDoubledUserDefinedSkipWord() throws RedPenException {
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration(validatorName)
                         .addAttribute("list", "redpen,tool"))
-                .setLanguage("en").build();
+                .build();
 
         Document document = prepareSimpleDocument("RedPen is RedPen right?");
 
@@ -83,10 +83,9 @@ public class DoubledWordValidatorTest extends BaseValidatorTest {
 
     @Test
     public void testDoubledUserDefinedSkipWordWithoutNormalization() throws RedPenException {
-        config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(new ValidatorConfiguration(validatorName)
-                        .addAttribute("list", "RedPen,Tool"))
-                .setLanguage("en").build();
+        config = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration(validatorName).addAttribute("list", "RedPen,Tool"))
+                .build();
 
         Document document = prepareSimpleDocument("redPen is redPen right?");
 
@@ -97,9 +96,9 @@ public class DoubledWordValidatorTest extends BaseValidatorTest {
 
     @Test
     public void testDoubledWordInJapaneseSentence() throws RedPenException {
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration(validatorName))
-                .setLanguage("ja").build();
+                .build();
 
         Document document = prepareSimpleDocument("それは真実であり，それが正しい");
 
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/EndOfSentenceValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/EndOfSentenceValidatorTest.java
index 0f55954c..a09398bc 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/EndOfSentenceValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/EndOfSentenceValidatorTest.java
@@ -76,12 +76,12 @@ public class EndOfSentenceValidatorTest {
 
     @Test
     public void testJapaneseInvalidEndOfSentence() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("EndOfSentence"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("彼は言った，“今日は誕生日”。", 1))
@@ -95,9 +95,8 @@ public class EndOfSentenceValidatorTest {
     @Test
     public void testErrorPosition() throws RedPenException {
         String sampleText = "He said \"that is right\".";
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("EndOfSentence"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("EndOfSentence"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/HyphenationValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/HyphenationValidatorTest.java
index 574bf216..26dc56e4 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/HyphenationValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/HyphenationValidatorTest.java
@@ -37,7 +37,7 @@ public class HyphenationValidatorTest {
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new WhiteSpaceTokenizer())
+                Document.builder(new WhiteSpaceTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("Hyphenation is very useful to stop a sentence such as bad tempered " +
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidExpressionValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidExpressionValidatorTest.java
index 306467b9..a261f0af 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidExpressionValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidExpressionValidatorTest.java
@@ -43,10 +43,10 @@ public class InvalidExpressionValidatorTest {
 
     @Test
     public void testSimpleRun() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression").addAttribute("list", "may"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(new Sentence("The experiments may be true.", 0));
@@ -55,10 +55,10 @@ public class InvalidExpressionValidatorTest {
 
     @Test
     public void testVoid() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression").addAttribute("list", "may"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(new Sentence("", 0));
@@ -67,12 +67,12 @@ public class InvalidExpressionValidatorTest {
 
     @Test
     public void testLoadDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("You know. He is a super man.", 1))
@@ -85,12 +85,12 @@ public class InvalidExpressionValidatorTest {
 
     @Test
     public void testLoadJapaneseDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("明日地球が滅亡するってマジですか。", 1))
@@ -104,12 +104,12 @@ public class InvalidExpressionValidatorTest {
 
     @Test
     public void testLoadJapaneseInvalidList() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidExpression").addAttribute("list", "うふぉ,ガチ"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("うふぉっ本当ですか？", 1))
@@ -123,9 +123,8 @@ public class InvalidExpressionValidatorTest {
     @Test
     public void testErrorPosition() throws RedPenException {
         String sampleText = "Hello You know."; // invalid expression "You know"
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("InvalidExpression"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("InvalidExpression"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidSymbolValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidSymbolValidatorTest.java
index 9f36a62e..e1748a64 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidSymbolValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidSymbolValidatorTest.java
@@ -44,15 +44,14 @@ public class InvalidSymbolValidatorTest {
     public void testWithInvalidSymbol() throws RedPenException {
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("わたしはカラオケが大好き！", 1))
                         .build());
 
-        Configuration conf = new Configuration.ConfigurationBuilder()
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(EXCLAMATION_MARK, '!', "！"))
                 .build();
 
@@ -67,15 +66,14 @@ public class InvalidSymbolValidatorTest {
     public void testWithoutInvalidSymbol() throws RedPenException {
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("I like Karaoke", 1))
                         .build());
 
-        Configuration conf = new Configuration.ConfigurationBuilder()
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(EXCLAMATION_MARK, '!', "！"))
                 .build();
 
@@ -89,15 +87,14 @@ public class InvalidSymbolValidatorTest {
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("わたしは、カラオケが大好き！", 1)) // NOTE: two invalid symbols
                         .build());
 
-        Configuration conf = new Configuration.ConfigurationBuilder()
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidSymbol"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(EXCLAMATION_MARK, '!', "！"))
                 .addSymbol(new Symbol(COMMA, ',', "、"))
                 .build();
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidWordValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidWordValidatorTest.java
index 41d5ac9e..065a9a1f 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidWordValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/InvalidWordValidatorTest.java
@@ -42,16 +42,16 @@ public class InvalidWordValidatorTest {
     @Test
     public void testSimpleRun() throws RedPenException {
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("He is a foolish guy.", 1))
                         .build());
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidWord").addAttribute("list", "foolish"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
 
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -62,16 +62,16 @@ public class InvalidWordValidatorTest {
     @Test
     public void testVoid() throws RedPenException {
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("", 1))
                         .build());
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidWord").addAttribute("list", "foolish"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -80,12 +80,12 @@ public class InvalidWordValidatorTest {
 
     @Test
     public void testLoadDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidWord"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("he is a foolish man.", 1))
@@ -100,12 +100,12 @@ public class InvalidWordValidatorTest {
 
     @Test
     public void testLoadUserDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("InvalidWord").addAttribute("list", "boom,domo"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("Domo is a greeting word in Japan.", 1))
@@ -113,20 +113,20 @@ public class InvalidWordValidatorTest {
 
         RedPen redPen = new RedPen(config);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
-        Assert.assertEquals(1, errors.get(documents.get(0)).size());
+        assertEquals(1, errors.get(documents.get(0)).size());
     }
 
     /**
      * Assert not throw a exception even when there is no default dictionary.
      */
-    @Test(expected = RedPenException.class)
-    public void testLoadNotExistDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+    @Test
+    public void testLoadNotExistingDefaultDictionary() throws RedPenException {
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("InvalidWord"))
-                .setLanguage("ja").build(); // NOTE: no dictionary for japanese or other languages whose words are not split by white space.
+                .build(); // NOTE: no dictionary for japanese or other languages whose words are not split by white space.
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("こんにちは、群馬にきました。", 1))
@@ -134,6 +134,6 @@ public class InvalidWordValidatorTest {
 
         RedPen redPen = new RedPen(config);
         Map<Document, List<ValidationError>> errors = redPen.validate(documents);
-        Assert.assertEquals(0, errors.get(documents.get(0)).size());
+        assertEquals(0, errors.get(documents.get(0)).size());
     }
 }
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/JapaneseStyleValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/JapaneseStyleValidatorTest.java
index 7b47495f..0e404e23 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/JapaneseStyleValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/JapaneseStyleValidatorTest.java
@@ -41,10 +41,8 @@ public class JapaneseStyleValidatorTest {
                 "今日はいい天気ですね。\n" +
                 "昨日は雨だったのだが、持ち直した。\n" +
                 "明日もいい天気だといいですね。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("JapaneseStyle"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("JapaneseStyle"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -64,13 +62,13 @@ public class JapaneseStyleValidatorTest {
 
     @Test
     public void desuMasuStyle() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("JapaneseStyle"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("今日はいい天気ですね。", 1))
@@ -85,13 +83,13 @@ public class JapaneseStyleValidatorTest {
 
     @Test
     public void dearuStyle() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("JapaneseStyle"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("今日はいい天気である。", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidatorTest.java
index c4255a56..aef1cc08 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaEndHyphenValidatorTest.java
@@ -17,21 +17,19 @@
  */
 package cc.redpen.validator.sentence;
 
-import cc.redpen.model.Sentence;
-import cc.redpen.validator.ValidationError;
-import org.junit.Test;
-
 import cc.redpen.RedPen;
 import cc.redpen.RedPenException;
 import cc.redpen.config.Configuration;
 import cc.redpen.config.ValidatorConfiguration;
 import cc.redpen.model.Document;
+import cc.redpen.model.Sentence;
+import cc.redpen.validator.ValidationError;
+import org.junit.Test;
 
 import java.io.File;
-import java.util.Map;
-
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.assertEquals;
 
@@ -181,13 +179,12 @@ public class KatakanaEndHyphenValidatorTest {
 
     @Test
     public void testHonorsSkipWordList() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(new ValidatorConfiguration("KatakanaEndHyphen")
-                        .addAttribute("list", "コーヒー"))
-                .setLanguage("ja").build();
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("KatakanaEndHyphen").addAttribute("list", "コーヒー"))
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("濃いコーヒーは胃にわるい。", 1))
@@ -200,13 +197,13 @@ public class KatakanaEndHyphenValidatorTest {
 
     @Test
     public void testHonorsSkipWordDict() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("KatakanaEndHyphen")
                         .addAttribute("dict", "src/test/resources/cc/redpen/validator/KatakanaEndHyphenValidatorTest-skipworddict.txt")) // XXX
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("コーヒーと紅茶と、どちらがお好きですか。", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidatorTest.java
index cdb261d1..3b8a52d8 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/KatakanaSpellCheckValidatorTest.java
@@ -69,13 +69,13 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testLoadDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのインデクスとこのインデックス", 1))
@@ -88,13 +88,13 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testDefaultSetting() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのミニマムサポートとこのミニマムサポータ", 1))
@@ -107,14 +107,13 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testSetMinimumRatio() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck")
-                        .addAttribute("min_ratio", "0.001"))
-                .setLanguage("ja").build();
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck").addAttribute("min_ratio", "0.001"))
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのミニマムサポートとこのミニマムサポータ", 1))
@@ -127,14 +126,13 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testSetMinimumFrequency() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck")
-                        .addAttribute("min_freq", "0"))
-                .setLanguage("ja").build();
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck").addAttribute("min_freq", "0"))
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのミニマムサポートとこのミニマムサポータ", 1))
@@ -147,13 +145,13 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testLoadUserDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck").addAttribute("list", "ミニマムサポート,ミニマムサポータ"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのミニマムサポートとこのミニマムサポータ。", 1))
@@ -166,12 +164,12 @@ public class KatakanaSpellCheckValidatorTest {
 
     @Test
     public void testDisableDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("KatakanaSpellCheck").addAttribute("disable-default", "true"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder()
+                Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("あのインデクスとこのインデックス", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/OkuriganaValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/OkuriganaValidatorTest.java
index 439730df..d0e38205 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/OkuriganaValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/OkuriganaValidatorTest.java
@@ -36,10 +36,8 @@ public class OkuriganaValidatorTest {
     @Test
     public void testInvalidOkurigana() throws Exception {
         String sampleText = "このタスクに長い年月を費してきた。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("Okurigana"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("Okurigana"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
@@ -60,10 +58,8 @@ public class OkuriganaValidatorTest {
     @Test
     public void testNoInvalidOkurigana() throws Exception {
         String sampleText = "このタスクに長い年月を費やしてきた。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("Okurigana"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("Okurigana"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
@@ -83,10 +79,8 @@ public class OkuriganaValidatorTest {
     @Test
     public void testInvalidOkuriganaWithRule() throws Exception {
         String sampleText = "彼に合せた。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("Okurigana"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("Okurigana"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
@@ -109,10 +103,8 @@ public class OkuriganaValidatorTest {
     @Test
     public void testValidOkuriganaWithRule() throws Exception {
         String sampleText = "それとは競合している。";
-        Configuration config = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("Okurigana"))
-                .setLanguage("ja")
+        Configuration config = Configuration.builder("ja")
+                .addValidatorConfig(new ValidatorConfiguration("Okurigana"))
                 .build();
 
         DocumentParser parser = DocumentParser.MARKDOWN;
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/ParenthesizedSentenceValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/ParenthesizedSentenceValidatorTest.java
index f3c80e7a..9ed58408 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/ParenthesizedSentenceValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/ParenthesizedSentenceValidatorTest.java
@@ -35,7 +35,7 @@ public class ParenthesizedSentenceValidatorTest {
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new WhiteSpaceTokenizer())
+                Document.builder(new WhiteSpaceTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("When it comes to the subject of cake (the sweet and delicious baked delicacy), one should" +
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/QuotationValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/QuotationValidatorTest.java
index 4c1b9b81..d8a94c69 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/QuotationValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/QuotationValidatorTest.java
@@ -169,11 +169,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testAsciiExceptionCase() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", false))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("I'm a jedi knight.", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -184,11 +183,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testAsciiDoubleQuotationMakrk() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", false))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("I said \"that is true\".", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -199,11 +197,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testNoQuotationMakrk() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", true))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("I said that is true.", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -214,11 +211,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testNoInput() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", true))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -262,11 +258,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testLeftAsciiDoubleQuotationsWihtoutSpace() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", true))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("I said\"that is true\".", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -288,11 +283,10 @@ public class QuotationValidatorTest {
 
     @Test
     public void testRightAsciiDoubleQuotationsWihtoutSpace() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", true))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
         Sentence str = new Sentence("I said \"that is true\"is true.", 0);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -303,12 +297,11 @@ public class QuotationValidatorTest {
 
     @Test
     public void testDoubleQuotationsWithNonAsciiPeriod() throws RedPenException {
-        Configuration conf = new Configuration.ConfigurationBuilder()
-                .setLanguage("en")
+        Configuration conf = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("Quotation").addAttribute("use_ascii", true))
                 .addSymbol(new Symbol(SymbolType.FULL_STOP, '。'))
                 .build();
-        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(conf.getValidatorConfigs().get(0), conf);
 
 //        QuotationValidator validator =
 //                new QuotationValidator(true, '。');
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBeginningOfSpenceValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBeginningOfSpenceValidatorTest.java
index 5f149e49..d2cce5bb 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBeginningOfSpenceValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBeginningOfSpenceValidatorTest.java
@@ -35,12 +35,12 @@ import static org.junit.Assert.assertEquals;
 public class SpaceBeginningOfSpenceValidatorTest {
     @Test
     public void testProcessSentenceWithoutEndSpace() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("this is a test.", 1)) // ok since the sentence begins with the beginning of the line 1
@@ -54,12 +54,12 @@ public class SpaceBeginningOfSpenceValidatorTest {
 
     @Test
     public void testProcessFirstSpace() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("this is a test", 1))
@@ -73,12 +73,12 @@ public class SpaceBeginningOfSpenceValidatorTest {
 
     @Test
     public void testProcessHeadSentenceInAParagraph() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("This is a test", 1))
@@ -91,12 +91,12 @@ public class SpaceBeginningOfSpenceValidatorTest {
 
     @Test
     public void testProcessZeroLengthSentence() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("", 0))
@@ -109,12 +109,12 @@ public class SpaceBeginningOfSpenceValidatorTest {
 
     @Test
     public void testProcessNewLineSentenceWithoutEndSpace() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("this is a test.", 1))
@@ -128,12 +128,12 @@ public class SpaceBeginningOfSpenceValidatorTest {
 
     @Test
     public void testProcessVoidSentence() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-                documents.add(new Document.DocumentBuilder()
+                documents.add(Document.builder()
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBetweenAlphabeticalWordValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBetweenAlphabeticalWordValidatorTest.java
index c0232521..ff0e1fbd 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBetweenAlphabeticalWordValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpaceBetweenAlphabeticalWordValidatorTest.java
@@ -85,12 +85,12 @@ public class SpaceBetweenAlphabeticalWordValidatorTest {
 
     @Test
     public void testWithParenthesis() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("きょうは（Coke）を飲みたい。", 1))
@@ -103,12 +103,12 @@ public class SpaceBetweenAlphabeticalWordValidatorTest {
 
     @Test
     public void testWithComma() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder("ja")
                 .addValidatorConfig(new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
-                .setLanguage("ja").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();documents.add(
-                new Document.DocumentBuilder(new JapaneseTokenizer())
+                Document.builder(new JapaneseTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("きょうは、Coke を飲みたい。", 1))
@@ -122,9 +122,8 @@ public class SpaceBetweenAlphabeticalWordValidatorTest {
     @Test
     public void testErrorBeforePosition() throws RedPenException {
         String sampleText = "きょうはCoke を飲みたい。";
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -143,9 +142,8 @@ public class SpaceBetweenAlphabeticalWordValidatorTest {
     @Test
     public void testErrorAfterPosition() throws RedPenException {
         String sampleText = "きょうは Cokeを飲みたい。";
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SpaceBetweenAlphabeticalWord"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpellingValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpellingValidatorTest.java
index 3f0ed135..315fd109 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/SpellingValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/SpellingValidatorTest.java
@@ -42,13 +42,13 @@ public class SpellingValidatorTest extends BaseValidatorTest {
 
     @Test
     public void testValidate() throws Exception {
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
           .addValidatorConfig(new ValidatorConfiguration(validatorName).addAttribute("list", "this,a,pen"))
-          .setLanguage("en").build();
+          .build();
 
         Document document = prepareSimpleDocument("this iz a pen");
 
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
 
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
@@ -86,9 +86,9 @@ public class SpellingValidatorTest extends BaseValidatorTest {
 
     @Test
     public void testUserSkipList() throws RedPenException {
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration(validatorName).addAttribute("list", "abeshi,baz"))
-                .setLanguage("en").build();
+                .build();
 
         Document document = prepareSimpleDocument("Abeshi is a word used in a comic.");
 
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidatorTest.java
index f85699e4..3cb36277 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/StartWithCapitalLetterValidatorTest.java
@@ -40,15 +40,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testDetectStartWithSmallCharacter() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("this is it.", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -58,15 +58,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testDetectStartWithCapitalCharacter() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("This is it.", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -76,15 +76,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testStartWithElementOfWhiteList() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("iPhone is a mobile computer.", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter").addAttribute("list", "iPhone"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -94,15 +94,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testStartWithWhiteListItemInJapaneseSentence() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder(new JapaneseTokenizer())
+        documents.add(Document.builder(new JapaneseTokenizer())
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("iPhone はカッコイイ．", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter").addAttribute("list", "iPhone"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -112,15 +112,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testStartWithWhiteSpaceAndThenItemOfWhiteList() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence(" iPhone is a mobile computer.", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter").addAttribute("list", "iPhone"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -130,15 +130,15 @@ public class StartWithCapitalLetterValidatorTest {
     @Test
     public void testVoid() throws RedPenException {
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("", 1))
                 .build());
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter").addAttribute("list", "iPhone"))
-                .setLanguage("en").build();
-        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config.getSymbolTable());
+                .build();
+        Validator validator = ValidatorFactory.getInstance(config.getValidatorConfigs().get(0), config);
         List<ValidationError> errors = new ArrayList<>();
         validator.setErrorList(errors);
         validator.validate(documents.get(0).getLastSection().getParagraph(0).getSentence(0));
@@ -147,12 +147,12 @@ public class StartWithCapitalLetterValidatorTest {
 
     @Test
     public void testLoadDefaultDictionary() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("mixi is a Japanese company.", 1))
@@ -166,12 +166,12 @@ public class StartWithCapitalLetterValidatorTest {
 
     @Test
     public void testDetectStartWithSmallCharacterInSecondSentence() throws RedPenException {
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("StartWithCapitalLetter"))
-                .setLanguage("en").build();
+                .build();
 
         List<Document> documents = new ArrayList<>();
-        documents.add(new Document.DocumentBuilder()
+        documents.add(Document.builder()
                 .addSection(1)
                 .addParagraph()
                 .addSentence(new Sentence("This is true.", 1))
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/SymbolWithSpaceValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/SymbolWithSpaceValidatorTest.java
index f6ded740..12eaa027 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/SymbolWithSpaceValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/SymbolWithSpaceValidatorTest.java
@@ -50,9 +50,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     public void testNotNeedSpace() throws RedPenException {
         Document document = prepareSimpleDocument("I like apple/orange");
 
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(SLASH, '/'))
                 .build();
 
@@ -65,9 +64,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     public void testNeedAfterSpace() throws RedPenException {
         Document document = prepareSimpleDocument("I like her:yes it is");
 
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(COLON, ':', "", false, true))
                 .build();
 
@@ -82,9 +80,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     public void testNeedBeforeSpace() throws RedPenException {
         Document document = prepareSimpleDocument("I like her(Nancy) very much.");
 
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(LEFT_PARENTHESIS, '(', "", true, false))
                 .build();
 
@@ -99,9 +96,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     public void testNeedSpaceInMultiplePosition() throws RedPenException {
         Document document = prepareSimpleDocument("I like her(Nancy)very much.");
 
-        config = new Configuration.ConfigurationBuilder()
+        config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(LEFT_PARENTHESIS, '(', "", true, false))
                 .addSymbol(new Symbol(RIGHT_PARENTHESIS, ')', "", false, true))
                 .build();
@@ -117,9 +113,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     public void testReturnOnlyOneForHitBothBeforeAndAfter() throws RedPenException {
         Document document = prepareSimpleDocument("I like 1*10.");
 
-        Configuration config = new Configuration.ConfigurationBuilder()
+        Configuration config = Configuration.builder()
                 .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
-                .setLanguage("en")
                 .addSymbol(new Symbol(ASTERISK, '*', "", true, true))
                 .build();
 
@@ -132,9 +127,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     @Test
     public void testErrorBeforePosition() throws RedPenException {
         String sampleText = "I like her(Nancy) very much.";
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SymbolWithSpace"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
@@ -154,9 +148,8 @@ public class SymbolWithSpaceValidatorTest extends BaseValidatorTest {
     @Test
     public void testErrorAfterPosition() throws RedPenException {
         String sampleText = "I like her (Nancy)very much.";
-        Configuration configuration = new Configuration.ConfigurationBuilder()
-                .addValidatorConfig(
-                        new ValidatorConfiguration("SymbolWithSpace"))
+        Configuration configuration = Configuration.builder()
+                .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace"))
                 .build();
         DocumentParser parser = DocumentParser.MARKDOWN;
         List<Document> documents = new ArrayList<>();
diff --git a/redpen-core/src/test/java/cc/redpen/validator/sentence/WeakExpressionValidatorTest.java b/redpen-core/src/test/java/cc/redpen/validator/sentence/WeakExpressionValidatorTest.java
index 9a514d65..6ae4514d 100644
--- a/redpen-core/src/test/java/cc/redpen/validator/sentence/WeakExpressionValidatorTest.java
+++ b/redpen-core/src/test/java/cc/redpen/validator/sentence/WeakExpressionValidatorTest.java
@@ -37,7 +37,7 @@ public class WeakExpressionValidatorTest {
 
         List<Document> documents = new ArrayList<>();
         documents.add(
-                new Document.DocumentBuilder(new WhiteSpaceTokenizer())
+                Document.builder(new WhiteSpaceTokenizer())
                         .addSection(1)
                         .addParagraph()
                         .addSentence(new Sentence("As a matter of fact, some things are very small.", 1))