summaryrefslogtreecommitdiff
path: root/src/test/java/cuchaz/enigma/TestSignature.java
diff options
context:
space:
mode:
authorGravatar Thog2017-03-08 08:17:04 +0100
committerGravatar Thog2017-03-08 08:17:04 +0100
commit6e464ea251cab63c776ece0b2a356f1498ffa294 (patch)
tree5ed30c03f5ac4cd2d6877874f5ede576049954f7 /src/test/java/cuchaz/enigma/TestSignature.java
parentDrop unix case style and implement hashCode when equals is overrided (diff)
downloadenigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.gz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.xz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.zip
Follow Fabric guidelines
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestSignature.java')
-rw-r--r--src/test/java/cuchaz/enigma/TestSignature.java40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/test/java/cuchaz/enigma/TestSignature.java b/src/test/java/cuchaz/enigma/TestSignature.java
index 8537adf..534b43a 100644
--- a/src/test/java/cuchaz/enigma/TestSignature.java
+++ b/src/test/java/cuchaz/enigma/TestSignature.java
@@ -4,31 +4,33 @@
4 * are made available under the terms of the GNU Lesser General Public 4 * are made available under the terms of the GNU Lesser General Public
5 * License v3.0 which accompanies this distribution, and is available at 5 * License v3.0 which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/lgpl.html 6 * http://www.gnu.org/licenses/lgpl.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * Jeff Martin - initial API and implementation 9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/ 10 ******************************************************************************/
11package cuchaz.enigma;
12
13import static org.hamcrest.MatcherAssert.*;
14import static org.hamcrest.Matchers.*;
15 11
16import org.junit.Test; 12package cuchaz.enigma;
17 13
18import cuchaz.enigma.mapping.ClassNameReplacer; 14import cuchaz.enigma.mapping.ClassNameReplacer;
19import cuchaz.enigma.mapping.Signature; 15import cuchaz.enigma.mapping.Signature;
20import cuchaz.enigma.mapping.Type; 16import cuchaz.enigma.mapping.Type;
17import org.junit.Test;
21 18
19import static org.hamcrest.MatcherAssert.assertThat;
20import static org.hamcrest.Matchers.contains;
21import static org.hamcrest.Matchers.empty;
22import static org.hamcrest.Matchers.is;
23import static org.hamcrest.Matchers.not;
22 24
23public class TestSignature { 25public class TestSignature {
24 26
25 @Test 27 @Test
26 public void easiest() { 28 public void easiest() {
27 final Signature sig = new Signature("()V"); 29 final Signature sig = new Signature("()V");
28 assertThat(sig.getArgumentTypes(), is(empty())); 30 assertThat(sig.getArgumentTypes(), is(empty()));
29 assertThat(sig.getReturnType(), is(new Type("V"))); 31 assertThat(sig.getReturnType(), is(new Type("V")));
30 } 32 }
31 33
32 @Test 34 @Test
33 public void primitives() { 35 public void primitives() {
34 { 36 {
@@ -56,7 +58,7 @@ public class TestSignature {
56 assertThat(sig.getReturnType(), is(new Type("Z"))); 58 assertThat(sig.getReturnType(), is(new Type("Z")));
57 } 59 }
58 } 60 }
59 61
60 @Test 62 @Test
61 public void classes() { 63 public void classes() {
62 { 64 {
@@ -82,7 +84,7 @@ public class TestSignature {
82 assertThat(sig.getReturnType(), is(new Type("LBar;"))); 84 assertThat(sig.getReturnType(), is(new Type("LBar;")));
83 } 85 }
84 } 86 }
85 87
86 @Test 88 @Test
87 public void arrays() { 89 public void arrays() {
88 { 90 {
@@ -109,7 +111,7 @@ public class TestSignature {
109 assertThat(sig.getReturnType(), is(new Type("[D"))); 111 assertThat(sig.getReturnType(), is(new Type("[D")));
110 } 112 }
111 } 113 }
112 114
113 @Test 115 @Test
114 public void mixed() { 116 public void mixed() {
115 { 117 {
@@ -131,7 +133,7 @@ public class TestSignature {
131 assertThat(sig.getReturnType(), is(new Type("[LFoo;"))); 133 assertThat(sig.getReturnType(), is(new Type("[LFoo;")));
132 } 134 }
133 } 135 }
134 136
135 @Test 137 @Test
136 public void replaceClasses() { 138 public void replaceClasses() {
137 { 139 {
@@ -195,7 +197,7 @@ public class TestSignature {
195 assertThat(sig.getReturnType(), is(new Type("LCow;"))); 197 assertThat(sig.getReturnType(), is(new Type("LCow;")));
196 } 198 }
197 } 199 }
198 200
199 @Test 201 @Test
200 public void replaceArrayClasses() { 202 public void replaceArrayClasses() {
201 { 203 {
@@ -217,13 +219,13 @@ public class TestSignature {
217 assertThat(sig.getReturnType(), is(new Type("[[[LBeer;"))); 219 assertThat(sig.getReturnType(), is(new Type("[[[LBeer;")));
218 } 220 }
219 } 221 }
220 222
221 @Test 223 @Test
222 public void equals() { 224 public void equals() {
223 225
224 // base 226 // base
225 assertThat(new Signature("()V"), is(new Signature("()V"))); 227 assertThat(new Signature("()V"), is(new Signature("()V")));
226 228
227 // arguments 229 // arguments
228 assertThat(new Signature("(I)V"), is(new Signature("(I)V"))); 230 assertThat(new Signature("(I)V"), is(new Signature("(I)V")));
229 assertThat(new Signature("(ZIZ)V"), is(new Signature("(ZIZ)V"))); 231 assertThat(new Signature("(ZIZ)V"), is(new Signature("(ZIZ)V")));
@@ -238,7 +240,7 @@ public class TestSignature {
238 assertThat(new Signature("([[Z)V"), is(not(new Signature("([[LFoo;)V")))); 240 assertThat(new Signature("([[Z)V"), is(not(new Signature("([[LFoo;)V"))));
239 assertThat(new Signature("(LFoo;LBar;)V"), is(not(new Signature("(LFoo;LCow;)V")))); 241 assertThat(new Signature("(LFoo;LBar;)V"), is(not(new Signature("(LFoo;LCow;)V"))));
240 assertThat(new Signature("([LFoo;LBar;)V"), is(not(new Signature("(LFoo;LCow;)V")))); 242 assertThat(new Signature("([LFoo;LBar;)V"), is(not(new Signature("(LFoo;LCow;)V"))));
241 243
242 // return type 244 // return type
243 assertThat(new Signature("()I"), is(new Signature("()I"))); 245 assertThat(new Signature("()I"), is(new Signature("()I")));
244 assertThat(new Signature("()Z"), is(new Signature("()Z"))); 246 assertThat(new Signature("()Z"), is(new Signature("()Z")));
@@ -246,7 +248,7 @@ public class TestSignature {
246 assertThat(new Signature("()[[[Z"), is(new Signature("()[[[Z"))); 248 assertThat(new Signature("()[[[Z"), is(new Signature("()[[[Z")));
247 assertThat(new Signature("()LFoo;"), is(new Signature("()LFoo;"))); 249 assertThat(new Signature("()LFoo;"), is(new Signature("()LFoo;")));
248 assertThat(new Signature("()[LFoo;"), is(new Signature("()[LFoo;"))); 250 assertThat(new Signature("()[LFoo;"), is(new Signature("()[LFoo;")));
249 251
250 assertThat(new Signature("()I"), is(not(new Signature("()Z")))); 252 assertThat(new Signature("()I"), is(not(new Signature("()Z"))));
251 assertThat(new Signature("()Z"), is(not(new Signature("()I")))); 253 assertThat(new Signature("()Z"), is(not(new Signature("()I"))));
252 assertThat(new Signature("()[D"), is(not(new Signature("()[J")))); 254 assertThat(new Signature("()[D"), is(not(new Signature("()[J"))));
@@ -254,7 +256,7 @@ public class TestSignature {
254 assertThat(new Signature("()LFoo;"), is(not(new Signature("()LBar;")))); 256 assertThat(new Signature("()LFoo;"), is(not(new Signature("()LBar;"))));
255 assertThat(new Signature("()[LFoo;"), is(not(new Signature("()[LBar;")))); 257 assertThat(new Signature("()[LFoo;"), is(not(new Signature("()[LBar;"))));
256 } 258 }
257 259
258 @Test 260 @Test
259 public void testToString() { 261 public void testToString() {
260 assertThat(new Signature("()V").toString(), is("()V")); 262 assertThat(new Signature("()V").toString(), is("()V"));