001/* 002 * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. 003 * Copyright (C) 2000-2010 The Gridarta Developers. 004 * 005 * This program is free software; you can redistribute it and/or modify 006 * it under the terms of the GNU General Public License as published by 007 * the Free Software Foundation; either version 2 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU General Public License for more details. 014 * 015 * You should have received a copy of the GNU General Public License along 016 * with this program; if not, write to the Free Software Foundation, Inc., 017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 018 */ 019 020package net.sf.gridarta.model.mapmanager; 021 022import java.io.File; 023import net.sf.gridarta.model.archetype.TestArchetype; 024import net.sf.gridarta.model.gameobject.TestGameObject; 025import net.sf.gridarta.model.maparchobject.TestMapArchObject; 026import net.sf.gridarta.model.mapcontrol.MapControl; 027import org.jetbrains.annotations.NotNull; 028import org.jetbrains.annotations.Nullable; 029 030/** 031 * A {@link FileControl} implementation for testing purposes. 032 * @author Andreas Kirschbaum 033 */ 034public class TestFileControl implements FileControl<TestGameObject, TestMapArchObject, TestArchetype> { 035 036 /** 037 * Collects the performed actions. 038 */ 039 @NotNull 040 private final StringBuilder sb = new StringBuilder(); 041 042 /** 043 * {@inheritDoc} 044 */ 045 @Override 046 public void openFile(final boolean mapFile) { 047 throw new AssertionError(); 048 } 049 050 /** 051 * {@inheritDoc} 052 */ 053 @Override 054 public boolean save(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { 055 throw new AssertionError(); 056 } 057 058 /** 059 * {@inheritDoc} 060 */ 061 @Override 062 public void saveAllMaps() { 063 throw new AssertionError(); 064 } 065 066 /** 067 * {@inheritDoc} 068 */ 069 @Override 070 public boolean closeAllMaps() { 071 throw new AssertionError(); 072 } 073 074 /** 075 * {@inheritDoc} 076 */ 077 @Override 078 public boolean saveAs(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { 079 throw new AssertionError(); 080 } 081 082 /** 083 * {@inheritDoc} 084 */ 085 @Override 086 public boolean confirmSaveChanges(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { 087 throw new AssertionError(); 088 } 089 090 /** 091 * {@inheritDoc} 092 */ 093 @Override 094 public void reportSaveError(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final String message) { 095 throw new AssertionError(); 096 } 097 098 /** 099 * {@inheritDoc} 100 */ 101 @Override 102 public void reportSaveError(@NotNull final File mapFile, @NotNull final String message) { 103 sb.append("reportSaveError: "); 104 sb.append(mapFile); 105 sb.append(" "); 106 sb.append(message); 107 sb.append("\n"); 108 } 109 110 /** 111 * {@inheritDoc} 112 */ 113 @Override 114 public void reportLoadError(@Nullable final File file, @NotNull final String message) { 115 throw new AssertionError(); 116 } 117 118 /** 119 * {@inheritDoc} 120 */ 121 @Override 122 public void reportOutOfMapBoundsDeleted(@NotNull final File file, final int outOfMapBoundsDeleted, @NotNull final StringBuilder outOfMapBoundsObjects) { 123 throw new AssertionError(); 124 } 125 126 /** 127 * {@inheritDoc} 128 */ 129 @Override 130 public void reportOutOfMemory(@NotNull final File file) { 131 throw new AssertionError(); 132 } 133 134 /** 135 * {@inheritDoc} 136 */ 137 @Override 138 public void reportTeleportCharacterError(@NotNull final String mapPath, @NotNull final String message) { 139 throw new AssertionError(); 140 } 141 142 /** 143 * {@inheritDoc} 144 */ 145 @Override 146 public String toString() { 147 return sb.toString(); 148 } 149 150}