Search in sources :

Example 6 with BaseFileReader

use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.

the class YamlFileReaderTest method testEmptyKey.

@Test(expectedExceptions = YamlInvalidSyntaxException.class)
public void testEmptyKey() {
    BaseFileReader reader = new BaseFileReader();
    reader.read("invalid_yaml2.txt");
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) Test(org.testng.annotations.Test)

Example 7 with BaseFileReader

use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.

the class YamlFileReaderTest method testInvalidSpaces.

@Test
public void testInvalidSpaces() {
    BaseFileReader reader = new BaseFileReader();
    Properties properties = reader.read("invalid_yaml3.txt");
    System.out.println("testInvalidSpaces: " + properties);
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Example 8 with BaseFileReader

use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.

the class YamlFileReaderTest method readInvalidYamlFileLastSpaceCountEqualsLastSpaceCount.

@Test
public void readInvalidYamlFileLastSpaceCountEqualsLastSpaceCount() {
    // given
    BaseFileReader sut = new BaseFileReader();
    // when
    Throwable e = Asserts.assertThrows(() -> sut.read("v112_application_invalid2.yaml"));
    // then
    Asserts.assertEquals(YamlInvalidSyntaxException.class, e.getClass());
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) Test(org.testng.annotations.Test)

Example 9 with BaseFileReader

use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.

the class PropertiesFileReaderTest method testWithValidData2.

@Test
public void testWithValidData2() throws PropertiesFileException {
    File file = new File(getClass().getClassLoader().getResource("classes.properties").getFile());
    assertNotNull(new BaseFileReader().read(Lists.newArrayList(file, file)));
    assertNotNull(new BaseFileReader().read(Lists.newArrayList(file, file)));
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) File(java.io.File) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Example 10 with BaseFileReader

use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.

the class PropertiesFileReaderTest method getInputStreamByAbsolutePathTest.

@Test
public void getInputStreamByAbsolutePathTest() {
    Method method = MethodBuilder.create().clazz(InputStreamUtil.class).method("getInputStreamByAbsolutePath").argument(File.class).build();
    ReflectMethodUtil.invokeMethod(method, new BaseFileReader(), new File(getClass().getResource("/invalid.properties").getFile()));
    ReflectMethodUtil.invokeMethod(method, new BaseFileReader(), new ExFile("abc"));
}
Also used : BaseFileReader(com.tvd12.properties.file.reader.BaseFileReader) InputStreamUtil(com.tvd12.properties.file.util.InputStreamUtil) Method(java.lang.reflect.Method) File(java.io.File) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

BaseFileReader (com.tvd12.properties.file.reader.BaseFileReader)28 Test (org.testng.annotations.Test)26 Properties (java.util.Properties)8 BaseTest (com.tvd12.test.base.BaseTest)6 File (java.io.File)5 HashMap (java.util.HashMap)5 InputStreamUtil (com.tvd12.properties.file.util.InputStreamUtil)2 InputStream (java.io.InputStream)2 Method (java.lang.reflect.Method)2 EzyFileUtil.getFileName (com.tvd12.ezyfox.util.EzyFileUtil.getFileName)1 ResourceFile (com.tvd12.ezyhttp.server.core.resources.ResourceFile)1 ResourceLoader (com.tvd12.ezyhttp.server.core.resources.ResourceLoader)1 PropertiesMapper (com.tvd12.properties.file.mapping.PropertiesMapper)1 FileReader (com.tvd12.properties.file.reader.FileReader)1 MultiFileReader (com.tvd12.properties.file.reader.MultiFileReader)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 AllArgsConstructor (lombok.AllArgsConstructor)1