| 85 | } |
| 86 | |
| 87 | @Test |
| 88 | public void constructorWithFile() throws Exception { |
| 89 | PowerMockito.whenNew(FileInputStream.class).withAnyArguments() |
| 90 | .thenReturn(mock(FileInputStream.class)); |
| 91 | final Properties props = new Properties(); |
| 92 | props.setProperty("asynchbase.test", "val1"); |
| 93 | PowerMockito.whenNew(Properties.class).withNoArguments().thenReturn(props); |
| 94 | |
| 95 | final Config config = new Config("/tmp/config.file"); |
| 96 | assertNotNull(config); |
| 97 | assertEquals("/tmp/config.file", config.config_location); |
| 98 | assertEquals("val1", config.getString("asynchbase.test")); |
| 99 | } |
| 100 | |
| 101 | @Test(expected = FileNotFoundException.class) |
| 102 | public void constructorFileNotFound() throws Exception { |