| 68 | } |
| 69 | |
| 70 | @Test |
| 71 | public void constructorWithFile() throws Exception { |
| 72 | PowerMockito.whenNew(FileInputStream.class).withAnyArguments() |
| 73 | .thenReturn(mock(FileInputStream.class)); |
| 74 | final Properties props = new Properties(); |
| 75 | props.setProperty("tsd.test", "val1"); |
| 76 | PowerMockito.whenNew(Properties.class).withNoArguments().thenReturn(props); |
| 77 | |
| 78 | final Config config = new Config("/tmp/config.file"); |
| 79 | assertNotNull(config); |
| 80 | assertEquals("/tmp/config.file", config.config_location); |
| 81 | assertEquals("val1", config.getString("tsd.test")); |
| 82 | } |
| 83 | |
| 84 | @Test(expected = FileNotFoundException.class) |
| 85 | public void constructorFileNotFound() throws Exception { |