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.var.daimonin.model.maparchobject; 021 022import java.io.BufferedReader; 023import java.io.IOException; 024import java.io.StringReader; 025import net.sf.gridarta.model.io.AbstractMapArchObjectParser; 026import net.sf.gridarta.model.maparchobject.AbstractMapArchObject; 027import net.sf.gridarta.utils.Size2D; 028import net.sf.gridarta.var.daimonin.model.io.MapArchObjectParser; 029import org.junit.Assert; 030import org.junit.Test; 031 032/** 033 * Test for {@link MapArchObject}. 034 * @author <a href="mailto:cher@riedquat.de">Christian Hujer</a> 035 */ 036public class MapArchObjectTest { 037 038 /** 039 * Test for {@link net.sf.gridarta.model.io.AbstractMapArchObjectParser#load(BufferedReader, 040 * net.sf.gridarta.model.maparchobject.MapArchObject)}. 041 * @throws IOException (unexpected) 042 */ 043 @Test 044 public void testParseMapArchNoAttributes() throws IOException { 045 final MapArchObject mao = new MapArchObject(); 046 final AbstractMapArchObjectParser<MapArchObject> maop = new MapArchObjectParser(); 047 final StringReader stringReader = new StringReader("arch map\n" + "end\n"); 048 final BufferedReader in = new BufferedReader(stringReader); 049 try { 050 maop.load(in, mao); 051 } finally { 052 in.close(); 053 } 054 Assert.assertEquals(AbstractMapArchObject.MAP_NAME_UNNAMED, mao.getMapName()); 055 Assert.assertEquals(Size2D.ONE, mao.getMapSize()); 056 } 057 058}