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.java.nio.fs.file;
 
 import java.io.File;
 
 import org.junit.Test;
 import  org.uberfire.java.nio.base.GeneralPathImpl;
 import  org.uberfire.java.nio.file.FileStore;
 import  org.uberfire.java.nio.file.FileSystem;
 import  org.uberfire.java.nio.file.Path;
 import  org.uberfire.java.nio.file.spi.FileSystemProvider;
 
 import static org.fest.assertions.api.Assertions.*;
 import static org.mockito.Mockito.*;
 
 public class SimpleWindowsFileSystemTest {
 
     final FileSystemProvider fsProvider = mock( FileSystemProvider.class );
     final File[]             roots      = new File[]{ new File"c:\\" ), new File"a:\\" ) };
 
     @Test
     public void simpleTests() {
 
         final FileSystem fileSystem = new SimpleWindowsFileSystem"c:\\" );
 
         assertThatfileSystem.isOpen() ).isTrue();
         assertThatfileSystem.isReadOnly() ).isFalse();
         assertThatfileSystem.getSeparator() ).isEqualTo( "\\" );
         assertThatfileSystem.provider() ).isEqualTo(  );
         assertThatfileSystem.supportedFileAttributeViews() ).isNotEmpty().hasSize( 1 ).contains( "basic" );
 
         assertThatfileSystem.getPath( "c:\\path\\to\\file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem"c:\\path\\to\\file.txt"false ) );
         assertThatfileSystem.getPath( "c:\\path\\to\\file.txt"null ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem"c:\\path\\to\\file.txt"false ) );
         assertThatfileSystem.getPath( "c:\\path""to""file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem"c:\\path\\to\\file.txt"false ) );
 
         try {
             fileSystem.close();
             fail"can't close this fileSystem" );
         } catch ( UnsupportedOperationException ex ) {
         }
 
         assertThatfileSystem.getFileStores() ).isNotNull().hasSize( 2 );
         assertThatfileSystem.getFileStores().iterator().next().name() ).isEqualTo( "c:\\" );
 
         assertThatfileSystem.getRootDirectories() ).isNotNull().hasSize( 2 );
         assertThatfileSystem.getRootDirectories().iterator().next().toString() ).isEqualTo( "c:\\" );
         assertThatfileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue();
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void invalidCOnstructorPath() {
         new SimpleWindowsFileSystem"home" );
     }
 
     @Test(expected = UnsupportedOperationException.class)
     public void getPathMatcherUnsupportedOp() {
         new SimpleWindowsFileSystem"c:\\" ).getPathMatcher"*.*" );
     }
 
     @Test(expected = UnsupportedOperationException.class)
     }
 
     @Test(expected = UnsupportedOperationException.class)
     public void newWatchServiceUnsupportedOp() {
         new SimpleWindowsFileSystem"c:\\" ).newWatchService();
     }
 
     @Test(expected = UnsupportedOperationException.class)
         new SimpleWindowsFileSystem"c:\\" ).getRootDirectories().iterator().remove();
     }
 
     @Test(expected = NoSuchElementException.class)
     public void invalidElementFromRootIterator() {
         final Iterator<Path> iterator = new SimpleWindowsFileSystem"c:\\" ).getRootDirectories().iterator();
         try {
             iterator.next();
         } catch ( Exception e ) {
             fail"first is valid" );
        }
        iterator.next();
    }
    @Test(expected = UnsupportedOperationException.class)
        new SimpleWindowsFileSystem"c:\\" ).getFileStores().iterator().remove();
    }
    @Test(expected = NoSuchElementException.class)
    public void invalidElementFromFStoreIterator() {
        final Iterator<FileStore> iterator = new SimpleWindowsFileSystem"c:\\" ).getFileStores().iterator();
        try {
            iterator.next();
        } catch ( Exception e ) {
            fail"first is valid" );
        }
        iterator.next();
    }
New to GrepCode? Check out our FAQ X