//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotObtainLockWhenStoreDirCannotBeCreated() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotObtainLockWhenStoreDirCannotBeCreated() { FileSystemAbstraction fileSystemAbstraction = new DelegatingFileSystemAbstractionAnonymousInnerClass3(this, FileSystemRule.get()); StoreLayout storeLayout = Target.storeLayout(); try { using (StoreLocker storeLocker = new StoreLocker(fileSystemAbstraction, storeLayout)) { storeLocker.CheckLock(); fail(); } } catch (StoreLockException e) { string msg = format("Unable to create path for store dir: %s. " + "Please ensure no other process is using this database, and that " + "the directory is writable (required even for read-only access)", storeLayout); assertThat(e.Message, @is(msg)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCloseAllStreamsDespiteError() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCloseAllStreamsDespiteError() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<java.io.OutputStream> mockStreams = new java.util.ArrayList<>(); IList <Stream> mockStreams = new List <Stream>(); FileSystemAbstraction fs = new DelegatingFileSystemAbstractionAnonymousInnerClass3(this, _fileSystem, mockStreams); RotatingFileOutputStreamSupplier supplier = new RotatingFileOutputStreamSupplier(fs, _logFile, 10, 0, 10, _directExecutor); Write(supplier, "A string longer than 10 bytes"); Write(supplier, "A string longer than 10 bytes"); IOException exception = new IOException("test exception"); Stream mockStream = mockStreams[1]; doThrow(exception).when(mockStream).close(); IOException ioException = assertThrows(typeof(IOException), supplier.close); assertThat(ioException, sameInstance(exception)); verify(mockStream).close(); }