1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2005 Kevin Rogers
4   //
5   // This file is part of MillScript.
6   //
7   // MillScript is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
20  ////////////////////////////////////////////////////////////////////////////////
21  package org.millscript.office.compound.vfs;
22  
23  import org.millscript.commons.vfs.AbstractVVolumeTest;
24  import org.millscript.commons.vfs.VFS;
25  import org.millscript.commons.vfs.protocols.file.LocalFile;
26  
27  import java.io.File;
28  import java.net.URI;
29  
30  /**
31   * @
32   */
33  public class CompoundDocumentVolumeTest extends AbstractVVolumeTest {
34  
35      /**
36       * Constructor for ReadOnlyZipVolumeTest.
37       * @param arg0
38       */
39      public CompoundDocumentVolumeTest(String arg0) {
40          super(arg0);
41      }
42  
43      /**
44       * @see org.millscript.commons.vfs.AbstractVVolumeTest#getTestURI()
45       */
46      @Override
47      public URI getTestURI() {
48          return new File( "src/test/office/credit_card_tracker_excel5.xls/" ).toURI();
49      }
50  
51      /**
52       * @see junit.framework.TestCase#setUp()
53       */
54      @Override
55      protected void setUp() throws Exception {
56          super.setUp();
57          final VFS vfs = new VFS();
58          final LocalFile file = (LocalFile) vfs.resolveAsFile( this.getTestURI() );
59          this.setTestVolume( new CompoundDocumentVolume( file ) );
60      }
61  
62      public void testGetURI() {
63          // Check that the correct root is returned for a sample volume
64          assertEquals( this.getTestURI(), this.getTestVolume().getURI() );
65      }
66  
67      /**
68       * @see org.millscript.commons.vfs.AbstractVVolumeTest#testToString()
69       */
70      @Override
71      public void testToString() {
72          // Construct the expected string version of the volume, which will
73          // include the full path to the virtual volume, so we have to add in
74          // the current working directory
75          final StringBuffer expected = new StringBuffer( "VVOLUME( file:" );
76          expected.append( System.getProperty( "user.dir" ) );
77          expected.append( "/src/test/office/credit_card_tracker_excel5.xls )" );
78          assertEquals( expected.toString(), this.getTestVolume().toString() );
79      }
80  
81  }