//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldContinueAfterError() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldContinueAfterError() { DiagnosticsReporter reporter = new DiagnosticsReporter(); MyProvider myProvider = new MyProvider(_fileSystem); reporter.RegisterOfflineProvider(myProvider); myProvider.AddFile("logs/a.txt", CreateNewFileWithContent("a.txt", "file a")); Path destination = _testDirectory.file("logs.zip").toPath(); ISet <string> classifiers = new HashSet <string>(); classifiers.Add("logs"); classifiers.Add("fail"); using (MemoryStream baos = new MemoryStream()) { PrintStream @out = new PrintStream(baos); NonInteractiveProgress progress = new NonInteractiveProgress(@out, false); reporter.Dump(classifiers, destination, progress, true); assertThat(baos.ToString(), @is(string.Format("1/2 fail.txt%n" + ".................... 20%%%n" + "..........%n" + "Error: Step failed%n" + "2/2 logs/a.txt%n" + ".................... 20%%%n" + ".................... 40%%%n" + ".................... 60%%%n" + ".................... 80%%%n" + ".................... 100%%%n%n"))); } // Verify content URI uri = URI.create("jar:file:" + destination.toAbsolutePath().toUri().RawPath); using (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) { IList <string> fileA = Files.readAllLines(fs.getPath("logs/a.txt")); assertEquals(1, fileA.Count); assertEquals("file a", fileA[0]); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void supportPathsWithSpaces() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void SupportPathsWithSpaces() { DiagnosticsReporter reporter = SetupDiagnosticsReporter(); Path destination = _testDirectory.file("log files.zip").toPath(); reporter.Dump(Collections.singleton("logs"), destination, mock(typeof(DiagnosticsReporterProgress)), true); VerifyContent(destination); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private DiagnosticsReporter setupDiagnosticsReporter() throws java.io.IOException private DiagnosticsReporter SetupDiagnosticsReporter() { DiagnosticsReporter reporter = new DiagnosticsReporter(); MyProvider myProvider = new MyProvider(_fileSystem); reporter.RegisterOfflineProvider(myProvider); myProvider.AddFile("logs/a.txt", CreateNewFileWithContent("a.txt", "file a")); myProvider.AddFile("logs/b.txt", CreateNewFileWithContent("b.txt", "file b")); return(reporter); }