コード例 #1
0
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_ofFile() throws Exception
        public virtual void test_ofFile()
        {
            File            file = new File("src/test/resources/com/opengamma/strata/collect/io/TestFile.txt");
            ResourceLocator test = ResourceLocator.ofFile(file);

            assertEquals(test.Locator, "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(), "file:src/test/resources/com/opengamma/strata/collect/io/TestFile.txt");
        }
コード例 #2
0
        //-------------------------------------------------------------------------
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void test_equalsHashCode() throws Exception
        public virtual void test_equalsHashCode()
        {
            File            file1 = new File("src/test/resources/com/opengamma/strata/collect/io/TestFile.txt");
            File            file2 = new File("src/test/resources/com/opengamma/strata/collect/io/Other.txt");
            ResourceLocator a1    = ResourceLocator.ofFile(file1);
            ResourceLocator a2    = ResourceLocator.ofFile(file1);
            ResourceLocator b     = ResourceLocator.ofFile(file2);

            assertEquals(a1.Equals(a1), true);
            assertEquals(a1.Equals(a2), true);
            assertEquals(a1.Equals(b), false);
            assertEquals(a1.Equals(null), false);
            assertEquals(a1.Equals(ANOTHER_TYPE), false);
            assertEquals(a1.GetHashCode(), a2.GetHashCode());
        }