//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTransformFromInputStreamToByteArray() public virtual void shouldTransformFromInputStreamToByteArray() { string testString = "Test String"; Stream inputStream = IoUtil.stringAsInputStream(testString); assertThat(IoUtil.inputStreamAsByteArray(inputStream)).isEqualTo(testString.GetBytes(IoUtil.ENCODING_CHARSET)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTransformBetweenInputStreamAndString() public virtual void shouldTransformBetweenInputStreamAndString() { Stream inputStream = IoUtil.stringAsInputStream("test"); string @string = IoUtil.inputStreamAsString(inputStream); assertThat(@string).isEqualTo("test"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUseFallBackWhenCustomClassLoaderIsNull() public virtual void shouldUseFallBackWhenCustomClassLoaderIsNull() { File file = IoUtil.getClasspathFile(TEST_FILE_NAME, null); assertThat(file).NotNull; assertThat(file.Name).isEqualTo("testFile.txt"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldUseFallBackWhenCustomClassLoaderIsWrong() public virtual void shouldUseFallBackWhenCustomClassLoaderIsWrong() { File file = IoUtil.getClasspathFile(TEST_FILE_NAME, new ClassLoaderAnonymousInnerClass(this)); assertThat(file).NotNull; assertThat(file.Name).isEqualTo("testFile.txt"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getFileFromClassPath() public virtual void getFileFromClassPath() { File file = IoUtil.getClasspathFile(TEST_FILE_NAME); assertThat(file).NotNull; assertThat(file.Name).isEqualTo("testFile.txt"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailGetFileContentAsStringWithGarbageAsFilename() public virtual void shouldFailGetFileContentAsStringWithGarbageAsFilename() { try { IoUtil.fileAsString("asd123"); fail("Expected: IoUtilException"); } catch (IoUtilException) { // happy way } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailGetFileFromClassPathWithNull() public virtual void shouldFailGetFileFromClassPathWithNull() { try { IoUtil.getClasspathFile(null); fail("Expected: IoUtilException"); } catch (IoUtilException) { // happy way } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTransformFromStringToInputStreamToByteArray() public virtual void shouldTransformFromStringToInputStreamToByteArray() { string testString = "Test String"; Stream inputStream = IoUtil.stringAsInputStream(testString); string newString = IoUtil.inputStreamAsString(inputStream); assertThat(testString).isEqualTo(newString); inputStream = IoUtil.stringAsInputStream(testString); sbyte[] newBytes = newString.GetBytes(IoUtil.ENCODING_CHARSET); assertThat(IoUtil.inputStreamAsByteArray(inputStream)).isEqualTo(newBytes); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getFileContentAsStream() public virtual void getFileContentAsStream() { Stream stream = IoUtil.fileAsStream(TEST_FILE_NAME); StreamReader reader = new StreamReader(stream); StringBuilder output = new StringBuilder(); string line; try { while (!string.ReferenceEquals((line = reader.ReadLine()), null)) { output.Append(line); } assertThat(output.ToString()).isEqualTo("This is a Test!"); } catch (Exception) { fail("Something went wrong while reading the input stream"); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getFileContentAsString() public virtual void getFileContentAsString() { assertThat(IoUtil.fileAsString(TEST_FILE_NAME)).isEqualTo("This is a Test!"); }