Example #1
0
  @org.testng.annotations.Test(priority = 3)
  public void loadConfig() throws InvalidConfigurationException {
    SetConfig setConfig1 = new SetConfig();
    setConfig1.load(file);

    Assert.assertEquals(setConfig1.StringSet.size(), 2);
  }
Example #2
0
 public SetConfig findSetConfig(String name) {
   String baseName = getBaseName(name);
   SetConfig config = lookupByPattern(setConfigs, baseName);
   if (config != null) {
     return config.getAsReadOnly();
   }
   return getSetConfig("default").getAsReadOnly();
 }
Example #3
0
 public SetConfig getSetConfig(String name) {
   String baseName = getBaseName(name);
   SetConfig config = lookupByPattern(setConfigs, baseName);
   if (config != null) {
     return config;
   }
   SetConfig defConfig = setConfigs.get("default");
   if (defConfig == null) {
     defConfig = new SetConfig();
     defConfig.setName("default");
     addSetConfig(defConfig);
   }
   config = new SetConfig(defConfig);
   config.setName(name);
   addSetConfig(config);
   return config;
 }
Example #4
0
  @Test(priority = 1)
  public void initNull() throws InvalidConfigurationException, IOException {
    setConfig.init(file);

    String fileContents = Util.readFile(file);

    Assert.assertEquals(fileContents.replace("\r", ""), "StringSet:\n" + "- Test\n");
  }
Example #5
0
  @org.testng.annotations.Test(priority = 2)
  public void changeBoolean() throws InvalidConfigurationException, IOException {
    setConfig.StringSet.add("Test1");
    setConfig.save();

    String fileContents = Util.readFile(file);

    Assert.assertEquals(fileContents.replace("\r", ""), "StringSet:\n" + "- Test\n" + "- Test1\n");
  }
Example #6
0
 public Config addSetConfig(SetConfig setConfig) {
   setConfigs.put(setConfig.getName(), setConfig);
   return this;
 }