use of com.tvd12.properties.file.writer.BaseFileWriter in project properties-file by tvd12.
the class PropertiesFileWriterTest method writeToOuputStreamInvalidCase.
@Test(expectedExceptions = { PropertiesFileException.class })
public void writeToOuputStreamInvalidCase() throws PropertiesFileException, IOException {
Properties properties = mock(Properties.class);
doThrow(IOException.class).when(properties).store(any(OutputStream.class), any(String.class));
new BaseFileWriter().write(properties);
}
use of com.tvd12.properties.file.writer.BaseFileWriter in project properties-file by tvd12.
the class BaseFileWriterTest method test2.
@Test(expectedExceptions = { PropertiesFileException.class })
public void test2() {
String filePath1 = "BaseFileWriterTestFile2.txt";
File file1 = new File(filePath1) {
private static final long serialVersionUID = -1227507502469046517L;
@Override
public boolean createNewFile() throws IOException {
throw new IOException();
}
};
if (file1.exists())
file1.delete();
Properties properties = new Properties();
properties.setProperty("a", "1");
properties.setProperty("b", "2");
BaseFileWriter fileWriter = new BaseFileWriter();
fileWriter.write(properties, file1);
}
Aggregations