1 33 34 package edu.rice.cs.drjava; 35 36 import edu.rice.cs.drjava.config.FileConfiguration; 37 import edu.rice.cs.drjava.config.OptionConstants; 38 import edu.rice.cs.plt.io.IOUtil; 39 40 import java.awt.*; 41 import java.io.File ; 42 import java.io.IOException ; 43 44 48 public final class ConfigFileTest extends DrJavaTestCase { 49 private static final String CUSTOM_PROPS = 50 "indent.level = 5\n" + 51 "history.max.size = 1\n" + 52 "definitions.keyword.color = #0000ff\n"; 53 54 55 56 public ConfigFileTest(String name) { super(name); } 57 58 59 public void testCustomConfigFile() throws IOException { 60 File propsFile = IOUtil.createAndMarkTempFile("DrJavaProps", ".txt"); 61 IOUtil.writeStringToFile(propsFile, CUSTOM_PROPS); 62 DrJava.setPropertiesFile(propsFile.getAbsolutePath()); 63 DrJava._initConfig(); 64 FileConfiguration config = DrJava.getConfig(); 65 66 assertEquals("custom indent level", 5, config.getSetting(OptionConstants.INDENT_LEVEL).intValue()); 67 assertEquals("custom history size", 1, config.getSetting(OptionConstants.HISTORY_MAX_SIZE).intValue()); 68 assertEquals("definitions.keyword.color", Color.blue, config.getSetting(OptionConstants.DEFINITIONS_KEYWORD_COLOR)); 70 assertEquals("default javac location", OptionConstants.JAVAC_LOCATION.getDefault(), 71 config.getSetting(OptionConstants.JAVAC_LOCATION)); 72 } 73 } | Popular Tags |