@Test public void readResourceFile_shouldReadSampleFile() throws SyncException { final String sampleResourcePath = "sampleTextFile.txt"; final String expectedResult = "sampleContent"; String result = readResourceFile(sampleResourcePath); Assert.assertEquals(result, expectedResult); }
public static String readResourceFile(String file) throws SyncException { try (InputStream in = SyncUtils.class.getClassLoader().getResourceAsStream(file)) { if (in == null) { throw new SyncException("Resource '" + file + "' doesn't exist"); } return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new SyncException(e); } }
SyncConfigurationUtils { public static String readResourceFile(String file) throws SyncException { try (InputStream in = SyncUtils.class.getClassLoader().getResourceAsStream(file)) { if (in == null) { throw new SyncException("Resource '" + file + "' doesn't exist"); } return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new SyncException(e); } } }
SyncConfigurationUtils { public static String readResourceFile(String file) throws SyncException { try (InputStream in = SyncUtils.class.getClassLoader().getResourceAsStream(file)) { if (in == null) { throw new SyncException("Resource '" + file + "' doesn't exist"); } return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new SyncException(e); } }  }
SyncConfigurationUtils { public static String readResourceFile(String file) throws SyncException { try (InputStream in = SyncUtils.class.getClassLoader().getResourceAsStream(file)) { if (in == null) { throw new SyncException("Resource '" + file + "' doesn't exist"); } return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new SyncException(e); } }  static void checkIfConfigurationIsValid(); static String readResourceFile(String file); static String readResourceFileAbsolutePath(String file); static SyncConfiguration parseJsonFileToSyncConfiguration(String path, ResourcePathType absolutePath); static SyncConfiguration parseJsonStringToSyncConfiguration(String value); static boolean isValidateJson(String json); static String writeSyncConfigurationToJsonString(SyncConfiguration syncConfiguration); static void writeSyncConfigurationToJsonFile(SyncConfiguration syncConfigurations, String absolutePath); static boolean resourceFileExists(String path); static boolean customConfigExists(String path); static ClientConfiguration getClientConfiguration(String clientName); }
SyncConfigurationUtils { public static String readResourceFile(String file) throws SyncException { try (InputStream in = SyncUtils.class.getClassLoader().getResourceAsStream(file)) { if (in == null) { throw new SyncException("Resource '" + file + "' doesn't exist"); } return IOUtils.toString(in, "UTF-8"); } catch (IOException e) { throw new SyncException(e); } }  static void checkIfConfigurationIsValid(); static String readResourceFile(String file); static String readResourceFileAbsolutePath(String file); static SyncConfiguration parseJsonFileToSyncConfiguration(String path, ResourcePathType absolutePath); static SyncConfiguration parseJsonStringToSyncConfiguration(String value); static boolean isValidateJson(String json); static String writeSyncConfigurationToJsonString(SyncConfiguration syncConfiguration); static void writeSyncConfigurationToJsonFile(SyncConfiguration syncConfigurations, String absolutePath); static boolean resourceFileExists(String path); static boolean customConfigExists(String path); static ClientConfiguration getClientConfiguration(String clientName);  }