@Test public void testLoadWithRelativePath() { String cowfileSpec = String.join(File.separator, "src", "test", "resources", "cattle", "cheese.cow"); Assume.assumeTrue("file required for this test " + cowfileSpec, new File(cowfileSpec).exists()); String actual = Cowloader.load(cowfileSpec); Assert.assertNotNull(actual); }
public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSpec += COWFILE_EXT; } InputStream cowInputStream; if (effectiveCowfileSpec.indexOf(File.separatorChar) >= 0) { cowInputStream = getCowFromPath(effectiveCowfileSpec); } else { cowInputStream = getCowFromCowPath(effectiveCowfileSpec); } if (cowInputStream == null) { cowInputStream = getCowFromResources(DEFAULT_COW + COWFILE_EXT); } if (cowInputStream != null) { return cowInputStreamToString(cowInputStream); } } return null; }
Cowloader { public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSpec += COWFILE_EXT; } InputStream cowInputStream; if (effectiveCowfileSpec.indexOf(File.separatorChar) >= 0) { cowInputStream = getCowFromPath(effectiveCowfileSpec); } else { cowInputStream = getCowFromCowPath(effectiveCowfileSpec); } if (cowInputStream == null) { cowInputStream = getCowFromResources(DEFAULT_COW + COWFILE_EXT); } if (cowInputStream != null) { return cowInputStreamToString(cowInputStream); } } return null; } }
Cowloader { public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSpec += COWFILE_EXT; } InputStream cowInputStream; if (effectiveCowfileSpec.indexOf(File.separatorChar) >= 0) { cowInputStream = getCowFromPath(effectiveCowfileSpec); } else { cowInputStream = getCowFromCowPath(effectiveCowfileSpec); } if (cowInputStream == null) { cowInputStream = getCowFromResources(DEFAULT_COW + COWFILE_EXT); } if (cowInputStream != null) { return cowInputStreamToString(cowInputStream); } } return null; } private  Cowloader(); }
Cowloader { public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSpec += COWFILE_EXT; } InputStream cowInputStream; if (effectiveCowfileSpec.indexOf(File.separatorChar) >= 0) { cowInputStream = getCowFromPath(effectiveCowfileSpec); } else { cowInputStream = getCowFromCowPath(effectiveCowfileSpec); } if (cowInputStream == null) { cowInputStream = getCowFromResources(DEFAULT_COW + COWFILE_EXT); } if (cowInputStream != null) { return cowInputStreamToString(cowInputStream); } } return null; } private  Cowloader(); static String load(final String cowfileSpec); static void setCowEnvironment(final Environment env); static String[] listAllCowfiles(); static String[] listAllCowfiles(final ClassLoader classloader); }
Cowloader { public static String load(final String cowfileSpec) { String effectiveCowfileSpec = (cowfileSpec != null) ? cowfileSpec.trim() : DEFAULT_COW; if (effectiveCowfileSpec.length() > 0) { if (!effectiveCowfileSpec.endsWith(COWFILE_EXT)) { effectiveCowfileSpec += COWFILE_EXT; } InputStream cowInputStream; if (effectiveCowfileSpec.indexOf(File.separatorChar) >= 0) { cowInputStream = getCowFromPath(effectiveCowfileSpec); } else { cowInputStream = getCowFromCowPath(effectiveCowfileSpec); } if (cowInputStream == null) { cowInputStream = getCowFromResources(DEFAULT_COW + COWFILE_EXT); } if (cowInputStream != null) { return cowInputStreamToString(cowInputStream); } } return null; } private  Cowloader(); static String load(final String cowfileSpec); static void setCowEnvironment(final Environment env); static String[] listAllCowfiles(); static String[] listAllCowfiles(final ClassLoader classloader); static final String COWFILE_EXT; static final String DEFAULT_COW; }