Gridarta Editor
MapArchObjectParserTest.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.var.crossfire.model.io;
21 
22 import java.io.BufferedReader;
23 import java.io.IOException;
24 import java.io.StringReader;
26 import org.junit.Assert;
27 import org.junit.Test;
28 
33 
38  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
39  @Test
40  public void testLoadFirstLoad() throws IOException {
42  final BufferedReader reader = new BufferedReader(new StringReader("arch map\nfirst_load 1234\nend\n"));
43  final MapArchObject mapArchObject = new MapArchObject();
44  parser.load(reader, mapArchObject);
45  Assert.assertEquals(1234, mapArchObject.getFirstLoad());
46  }
47 
52  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
53  @Test
54  public void testLoadResetGroup1() throws IOException {
56  final BufferedReader reader = new BufferedReader(new StringReader("arch map\nreset_group xyz\nend\n"));
57  final MapArchObject mapArchObject = new MapArchObject();
58  parser.load(reader, mapArchObject);
59  Assert.assertEquals("xyz", mapArchObject.getResetGroup());
60  }
61 
66  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
67  @Test
68  public void testLoadResetGroup2() throws IOException {
70  final BufferedReader reader = new BufferedReader(new StringReader("arch map\nend\n"));
71  final MapArchObject mapArchObject = new MapArchObject();
72  parser.load(reader, mapArchObject);
73  Assert.assertEquals("", mapArchObject.getResetGroup());
74  }
75 
76 }
net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject.getResetGroup
String getResetGroup()
Returns the reset group.
Definition: MapArchObject.java:640
net.sf.gridarta
Base package of all Gridarta classes.
net.sf
net.sf.gridarta.var
net.sf.gridarta.var.crossfire.model.io.MapArchObjectParserTest.testLoadFirstLoad
void testLoadFirstLoad()
Checks that the "first_load" attribute can be parsed.
Definition: MapArchObjectParserTest.java:40
net.sf.gridarta.var.crossfire.model.io.MapArchObjectParserTest.testLoadResetGroup1
void testLoadResetGroup1()
Checks that the "reset_group" attribute can be parsed.
Definition: MapArchObjectParserTest.java:54
net
net.sf.gridarta.model.io.MapArchObjectParser
Interface for classes that read or write MapArchObject instances.
Definition: MapArchObjectParser.java:33
net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject
MapArchObject contains the specific meta data about a map that is stored in the map-arch,...
Definition: MapArchObject.java:39
net.sf.gridarta.var.crossfire.model.io.MapArchObjectParserTest.testLoadResetGroup2
void testLoadResetGroup2()
Checks that the "reset_group" attribute can be parsed.
Definition: MapArchObjectParserTest.java:68
net.sf.gridarta.var.crossfire
Main package of Gridarta4Crossfire, contains all classes specific to the Crossfire version of the Gri...
net.sf.gridarta.var.crossfire.model.io.MapArchObjectParserTest
Regression tests for MapArchObjectParser.
Definition: MapArchObjectParserTest.java:32
net.sf.gridarta.var.crossfire.model
net.sf.gridarta.model.io
Reading and writing of maps, handling of paths.
Definition: AbstractAnimationObjectsReader.java:20
net.sf.gridarta.model
net.sf.gridarta.var.crossfire.model.io.MapArchObjectParser
A net.sf.gridarta.model.io.MapArchObjectParser for Crossfire map arch object instances.
Definition: MapArchObjectParser.java:43
net.sf.gridarta.var.crossfire.model.maparchobject
Definition: DefaultMapArchObjectFactory.java:20
net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject.getFirstLoad
int getFirstLoad()
Returns the timestamp the Crossfire server has loaded this map.
Definition: MapArchObject.java:618