001: /*BEGIN_COPYRIGHT_BLOCK
002: *
003: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are met:
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: * * Redistributions in binary form must reproduce the above copyright
011: * notice, this list of conditions and the following disclaimer in the
012: * documentation and/or other materials provided with the distribution.
013: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014: * names of its contributors may be used to endorse or promote products
015: * derived from this software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028: *
029: * This software is Open Source Initiative approved Open Source Software.
030: * Open Source Initative Approved is a trademark of the Open Source Initiative.
031: *
032: * This file is part of DrJava. Download the current version of this project
033: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034: *
035: * END_COPYRIGHT_BLOCK*/
036:
037: package edu.rice.cs.drjava.model;
038:
039: import junit.framework.*;
040:
041: import java.io.File;
042:
043: import edu.rice.cs.drjava.DrJavaTestCase;
044:
045: /**
046: * DummyGetDocumentsTest for unit testing DummyGetDocuments. Uses
047: * JUnit for testing.
048: *
049: * @author <a href="mailto:ericc@rice.edu">Eric Shao-yu Cheng</a>
050: * @version $Id: DummyGlobalModelTest.java 4255 2007-08-28 19:17:37Z mgricken $
051: */
052: public class DummyGlobalModelTest extends DrJavaTestCase {
053:
054: /**
055: * Creates a new instance of DummyGetDocuments, calls
056: * getDocumentsForFile() and ensures the method throws an
057: * UnsupportedOperationException.
058: *
059: * @exception java.io.IOException if an error occurs
060: */
061: public void testGetDocumentForFile() throws java.io.IOException {
062: DummyGlobalModel dummy = new DummyGlobalModel();
063: try {
064: dummy.getDocumentForFile(new File(""));
065: } catch (UnsupportedOperationException e) {
066: assertTrue("This message should never be seen", true);
067: return;
068: }
069: fail("expected that UnsupportedOperationException is thrown");
070: }
071:
072: /**
073: * Creates a new instance of DummyGetDocuments, calls
074: * getDocumentForFile() and ensures the method throws an
075: * UnsupportedOperationException.
076: *
077: * @exception java.io.IOException if an error occurs
078: */
079: public void testIsAlreadyOpen() throws java.io.IOException {
080: DummyGlobalModel dummy = new DummyGlobalModel();
081: try {
082: dummy.getDocumentForFile(new File(""));
083: } catch (UnsupportedOperationException e) {
084: assertTrue("This message should never be seen", true);
085: return;
086: }
087: fail("expected that UnsupportedOperationException is thrown");
088: }
089:
090: /**
091: * Creates a new instance of DummyGetDocuments, calls
092: * getOpenDefinitionsDocuments() and ensures the method throws an
093: * UnsupportedOperationException.
094: *
095: * @exception java.io.IOException if an error occurs
096: */
097: public void testGetDefinitionsDocuments() {
098: DummyGlobalModel dummy = new DummyGlobalModel();
099: try {
100: dummy.getOpenDefinitionsDocuments();
101: } catch (UnsupportedOperationException e) {
102: assertTrue("This message should never be seen", true);
103: return;
104: }
105: fail("expected that UnsupportedOperationException is thrown");
106: }
107:
108: /**
109: * Creates a new instance of DummyGetDocuments, calls
110: * hasModifiedDocuments() and ensures the method throws an
111: * UnsupportedOperationException.
112: *
113: * @exception java.io.IOException if an error occurs
114: */
115: public void testHasModifiedDocuments() {
116: DummyGlobalModel dummy = new DummyGlobalModel();
117: try {
118: dummy.hasModifiedDocuments();
119: } catch (UnsupportedOperationException e) {
120: assertTrue("This message should never be seen", true);
121: return;
122: }
123: fail("expected that UnsupportedOperationException is thrown");
124: }
125:
126: }
|