本文整理汇总了Java中org.ini4j.Config.setEmptyOption方法的典型用法代码示例。如果您正苦于以下问题:Java Config.setEmptyOption方法的具体用法?Java Config.setEmptyOption怎么用?Java Config.setEmptyOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ini4j.Config
的用法示例。
在下文中一共展示了Config.setEmptyOption方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWithEmptyOption
import org.ini4j.Config; //导入方法依赖的package包/类
@Test public void testWithEmptyOption() throws Exception
{
Config cfg = new Config();
cfg.setEmptyOption(true);
Ini ini = new Ini();
Ini.Section sec = ini.add(Dwarfs.PROP_BASHFUL);
sec.put(Dwarf.PROP_FORTUNE_NUMBER, null);
ini.setConfig(cfg);
IniHandler handler = EasyMock.createMock(IniHandler.class);
handler.startIni();
handler.startSection(Dwarfs.PROP_BASHFUL);
handler.handleOption(Dwarf.PROP_FORTUNE_NUMBER, "");
handler.endSection();
handler.endIni();
EasyMock.replay(handler);
verify(ini, handler);
}
示例2: testEmptyOption
import org.ini4j.Config; //导入方法依赖的package包/类
@Test public void testEmptyOption() throws Exception
{
OptionsParser parser = new OptionsParser();
OptionsHandler handler = EasyMock.createMock(OptionsHandler.class);
handler.startOptions();
handler.handleOption(OPTION, null);
handler.endOptions();
EasyMock.replay(handler);
Config cfg = new Config();
cfg.setEmptyOption(true);
parser.setConfig(cfg);
parser.parse(new StringReader(CFG_EMPTY_OPTION), handler);
EasyMock.verify(handler);
}
示例3: testWithStrictOperatorEmptyOptions
import org.ini4j.Config; //导入方法依赖的package包/类
@Test public void testWithStrictOperatorEmptyOptions() throws Exception
{
Config cfg = new Config();
cfg.setStrictOperator(true);
cfg.setEmptyOption(true);
Options opts = new Options();
opts.setConfig(cfg);
opts.put(Dwarf.PROP_AGE, DwarfsData.bashful.age);
opts.put(Dwarf.PROP_WEIGHT, null);
StringWriter writer = new StringWriter();
opts.store(writer);
StringBuilder exp = new StringBuilder();
exp.append(Dwarf.PROP_AGE);
exp.append('=');
exp.append(DwarfsData.bashful.age);
exp.append(NL);
exp.append(Dwarf.PROP_WEIGHT);
exp.append('=');
exp.append(NL);
assertEquals(exp.toString(), writer.toString());
}
示例4: testWithStrictOperatorNoEmptyOptions
import org.ini4j.Config; //导入方法依赖的package包/类
@Test public void testWithStrictOperatorNoEmptyOptions() throws Exception
{
Config cfg = new Config();
cfg.setStrictOperator(true);
cfg.setEmptyOption(false);
Options opts = new Options();
opts.setConfig(cfg);
opts.put(Dwarf.PROP_AGE, DwarfsData.bashful.age);
opts.put(Dwarf.PROP_WEIGHT, null);
StringWriter writer = new StringWriter();
opts.store(writer);
StringBuilder exp = new StringBuilder();
exp.append(Dwarf.PROP_AGE);
exp.append('=');
exp.append(DwarfsData.bashful.age);
exp.append(NL);
assertEquals(exp.toString(), writer.toString());
}
示例5: testEmptyOption
import org.ini4j.Config; //导入方法依赖的package包/类
@Test public void testEmptyOption() throws Exception
{
IniParser parser = new IniParser();
IniHandler handler = EasyMock.createMock(IniHandler.class);
handler.startIni();
handler.startSection(SECTION);
handler.handleOption(OPTION, null);
handler.endSection();
handler.endIni();
EasyMock.replay(handler);
Config cfg = new Config();
cfg.setEmptyOption(true);
parser.setConfig(cfg);
parser.parse(new StringReader(CFG_EMPTY_OPTION), handler);
EasyMock.verify(handler);
}