//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void test_ofPath() throws Exception public virtual void test_ofPath() { Path path = Paths.get("src/test/resources/com/opengamma/strata/collect/io/TestFile.txt"); ResourceLocator test = ResourceLocator.ofPath(path); assertEquals(test.Locator.Replace('\\', '/'), "file:src/test/resources/com/opengamma/strata/collect/io/TestFile.txt"); assertEquals(test.ByteSource.read()[0], 'H'); assertEquals(test.CharSource.readLines(), ImmutableList.of("HelloWorld")); assertEquals(test.getCharSource(StandardCharsets.UTF_8).readLines(), ImmutableList.of("HelloWorld")); assertEquals(test.ToString().Replace('\\', '/'), "file:src/test/resources/com/opengamma/strata/collect/io/TestFile.txt"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void test_ofPath_zipFile() throws Exception public virtual void test_ofPath_zipFile() { Path path = Paths.get("src/test/resources/com/opengamma/strata/collect/io/TestFile.zip"); ResourceLocator test = ResourceLocator.ofPath(path); assertEquals(test.Locator.Replace('\\', '/'), "file:src/test/resources/com/opengamma/strata/collect/io/TestFile.zip"); sbyte[] read = test.ByteSource.read(); assertEquals(read[0], 80); // these are the standard header of a zip file assertEquals(read[1], 75); assertEquals(read[2], 3); assertEquals(read[3], 4); assertEquals(test.ToString().Replace('\\', '/'), "file:src/test/resources/com/opengamma/strata/collect/io/TestFile.zip"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void test_ofPath_fileInZipFile() throws Exception public virtual void test_ofPath_fileInZipFile() { Path zip = Paths.get("src/test/resources/com/opengamma/strata/collect/io/TestFile.zip"); using (FileSystem fs = FileSystems.newFileSystem(zip, null)) { Path path = fs.getPath("TestFile.txt").toAbsolutePath(); ResourceLocator test = ResourceLocator.ofPath(path); string locator = test.Locator; assertTrue(locator.StartsWith("url:jar:file:", StringComparison.Ordinal)); assertTrue(locator.EndsWith("src/test/resources/com/opengamma/strata/collect/io/TestFile.zip!/TestFile.txt", StringComparison.Ordinal)); assertEquals(test.ByteSource.read()[0], 'H'); assertEquals(test.CharSource.readLines(), ImmutableList.of("HelloWorld")); assertEquals(test.getCharSource(StandardCharsets.UTF_8).readLines(), ImmutableList.of("HelloWorld")); assertEquals(test.ToString(), locator); } }