//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldGiveAClearErrorMessageIfTheArchiveIsNotInGzipFormat() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldGiveAClearErrorMessageIfTheArchiveIsNotInGzipFormat() { Path archive = _testDirectory.file("the-archive.dump").toPath(); Files.write(archive, singletonList("some incorrectly formatted data")); Path destination = _testDirectory.file("the-destination").toPath(); IncorrectFormat incorrectFormat = assertThrows(typeof(IncorrectFormat), () => (new Loader()).load(archive, destination, destination)); assertEquals(archive.ToString(), incorrectFormat.Message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldGiveAClearErrorMessageIfTheArchiveIsNotInTarFormat() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldGiveAClearErrorMessageIfTheArchiveIsNotInTarFormat() { Path archive = _testDirectory.file("the-archive.dump").toPath(); using (GzipCompressorOutputStream compressor = new GzipCompressorOutputStream(Files.newOutputStream(archive))) { sbyte[] bytes = new sbyte[1000]; (new Random()).NextBytes(bytes); compressor.write(bytes); } Path destination = _testDirectory.file("the-destination").toPath(); IncorrectFormat incorrectFormat = assertThrows(typeof(IncorrectFormat), () => (new Loader()).load(archive, destination, destination)); assertEquals(archive.ToString(), incorrectFormat.Message); }