Gridarta Editor
CodecTest.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2025 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.preferences;
21 
22 import org.junit.Assert;
23 import org.junit.Test;
24 
28 @SuppressWarnings("MissingJavadoc")
29 public class CodecTest {
30 
31  @Test
32  public void encode1() {
33  Assert.assertEquals("rn\\r\\n\\\\", Codec.encode("rn\r\n\\"));
34  }
35 
36  @Test
37  public void decode1() {
38  Assert.assertEquals("rn\r\n\\", Codec.decode("rn\\r\\n\\\\"));
39  }
40 
41  @Test
42  public void encode2() {
43  Assert.assertEquals("\\\\r\\\\n", Codec.encode("\\r\\n"));
44  }
45 
46  @Test
47  public void decode2() {
48  Assert.assertEquals("\\r\\n", Codec.decode("\\\\r\\\\n"));
49  }
50 
51 }
net.sf.gridarta.preferences.Codec.encode
static String encode(@NotNull final String str)
Encode a string to make it fit into one line.
Definition: Codec.java:73
net.sf.gridarta.preferences.Codec
Utility class to encode arbitrary Strings to fit in a single text line.
Definition: Codec.java:32
net.sf.gridarta.preferences.CodecTest.encode1
void encode1()
Definition: CodecTest.java:32
net.sf.gridarta.preferences.CodecTest
Tests for Codec.
Definition: CodecTest.java:29
net.sf.gridarta.preferences.CodecTest.encode2
void encode2()
Definition: CodecTest.java:42
net.sf.gridarta.preferences.CodecTest.decode2
void decode2()
Definition: CodecTest.java:47
net.sf.gridarta.preferences.Codec.decode
static String decode(@NotNull final String str)
Decode a string which was encoded by encode(String).
Definition: Codec.java:105
net.sf.gridarta.preferences.CodecTest.decode1
void decode1()
Definition: CodecTest.java:37