Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 JBoss Inc
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.uberfire.io;
 
 import org.junit.Test;
 import  org.uberfire.java.nio.file.DirectoryNotEmptyException;
 import  org.uberfire.java.nio.file.FileAlreadyExistsException;
 import  org.uberfire.java.nio.file.NoSuchFileException;
 import  org.uberfire.java.nio.file.Path;

 
 
     @Test(expected = NoSuchFileException.class)
     public void deleteNoSuchFileException() {
         final Path path = getFilePath();
         ioService().deleteIfExistspath );
 
         ioService().deletepath );
     }
 
     @Test(expected = DirectoryNotEmptyException.class)
     public void deleteDirectoryNotEmptyException() {
         final Path path = getDirectoryPath().resolveSibling( "dirToBug" );
 
         ioService().createDirectoriespath );
 
         ioService().writepath.resolve( "myFile.txt" ), "ooooo!" );
 
         ioService().deletepath );
     }
 
     @Test(expected = DirectoryNotEmptyException.class)
     public void deleteIfExistsDirectoryNotEmptyException() {
         final Path path = getDirectoryPath().resolveSibling( "dirToBugIfExists" );
 
         ioService().createDirectoriespath );
 
         ioService().writepath.resolve( "myFile.txt" ), "ooooo!" );
 
         ioService().deleteIfExistspath );
     }
 
     @Test(expected = FileAlreadyExistsException.class)
     public void newByteChannelFileAlreadyExistsException() {
         final Path path = getFilePath().resolveSibling( "alreadyExists.txt" );
 
         ioService().deleteIfExistspath );
 
         ioService().writepath"ooooo!" );
 
         ioService().newByteChannelpath );
     }
 
     @Test(expected = FileAlreadyExistsException.class)
     public void createDirectoryFileAlreadyExistsException() {
         final Path path = getDirectoryPath().resolveSibling( "otherDir" );
 
         ioService().deleteIfExistspath );
 
         ioService().createDirectorypath );
 
         ioService().createDirectorypath );
     }
 
     @Test(expected = FileAlreadyExistsException.class)
         final Path path = getDirectoryPath().resolveSibling( "otherDir" ).resolve( "innerDir" );
 
         ioService().deleteIfExistspath );
 
         ioService().createDirectoriespath );
 
         ioService().createDirectoriespath );
     }
 
     @Test(expected = FileAlreadyExistsException.class)
     public void copyFileAlreadyExistsException() {
         final Path path = getDirectoryPath().resolveSibling( "alreadyExistsTest" );
 
         ioService().deleteIfExistspath );
         ioService().createDirectoriespath );
 
        ioService().writepath.resolve( "myFile.txt" ), "ooooo!" );
        ioService().writepath.resolve( "mytarget" ), "xooooo!" );
        ioService().copypath.resolve( "myFile.txt" ), path.resolve( "mytarget" ) );
    }
    @Test(expected = NoSuchFileException.class)
    public void readAttributesNoSuchFileException() {
        final Path path = getDirectoryPath().resolveSibling( "somethingXXX" );
        ioService().deleteIfExistspath );
        ioService().readAttributespath );
    }
New to GrepCode? Check out our FAQ X