diff options
| author | 2017-03-08 08:17:04 +0100 | |
|---|---|---|
| committer | 2017-03-08 08:17:04 +0100 | |
| commit | 6e464ea251cab63c776ece0b2a356f1498ffa294 (patch) | |
| tree | 5ed30c03f5ac4cd2d6877874f5ede576049954f7 /src/test/java/cuchaz/enigma/TestTokensConstructors.java | |
| parent | Drop unix case style and implement hashCode when equals is overrided (diff) | |
| download | enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.gz enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.xz enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.zip | |
Follow Fabric guidelines
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestTokensConstructors.java')
| -rw-r--r-- | src/test/java/cuchaz/enigma/TestTokensConstructors.java | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/test/java/cuchaz/enigma/TestTokensConstructors.java b/src/test/java/cuchaz/enigma/TestTokensConstructors.java index 890a4fd..e40d5fd 100644 --- a/src/test/java/cuchaz/enigma/TestTokensConstructors.java +++ b/src/test/java/cuchaz/enigma/TestTokensConstructors.java | |||
| @@ -4,35 +4,40 @@ | |||
| 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 | ******************************************************************************/ |
| 11 | |||
| 11 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 12 | 13 | ||
| 13 | import static cuchaz.enigma.TestEntryFactory.*; | 14 | import cuchaz.enigma.mapping.BehaviorEntry; |
| 14 | import static org.hamcrest.MatcherAssert.*; | 15 | import org.junit.Test; |
| 15 | import static org.hamcrest.Matchers.*; | ||
| 16 | 16 | ||
| 17 | import java.util.jar.JarFile; | 17 | import java.util.jar.JarFile; |
| 18 | 18 | ||
| 19 | import org.junit.Test; | 19 | import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByConstructor; |
| 20 | 20 | import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByMethod; | |
| 21 | import cuchaz.enigma.mapping.BehaviorEntry; | 21 | import static cuchaz.enigma.TestEntryFactory.newConstructor; |
| 22 | import static org.hamcrest.MatcherAssert.assertThat; | ||
| 23 | import static org.hamcrest.Matchers.containsInAnyOrder; | ||
| 24 | import static org.hamcrest.Matchers.empty; | ||
| 25 | import static org.hamcrest.Matchers.is; | ||
| 26 | import static org.hamcrest.Matchers.nullValue; | ||
| 22 | 27 | ||
| 23 | public class TestTokensConstructors extends TokenChecker { | 28 | public class TestTokensConstructors extends TokenChecker { |
| 24 | 29 | ||
| 25 | public TestTokensConstructors() | 30 | public TestTokensConstructors() |
| 26 | throws Exception { | 31 | throws Exception { |
| 27 | super(new JarFile("build/test-obf/constructors.jar")); | 32 | super(new JarFile("build/test-obf/constructors.jar")); |
| 28 | } | 33 | } |
| 29 | 34 | ||
| 30 | @Test | 35 | @Test |
| 31 | public void baseDeclarations() { | 36 | public void baseDeclarations() { |
| 32 | assertThat(getDeclarationToken(newConstructor("a", "()V")), is("a")); | 37 | assertThat(getDeclarationToken(newConstructor("a", "()V")), is("a")); |
| 33 | assertThat(getDeclarationToken(newConstructor("a", "(I)V")), is("a")); | 38 | assertThat(getDeclarationToken(newConstructor("a", "(I)V")), is("a")); |
| 34 | } | 39 | } |
| 35 | 40 | ||
| 36 | @Test | 41 | @Test |
| 37 | public void subDeclarations() { | 42 | public void subDeclarations() { |
| 38 | assertThat(getDeclarationToken(newConstructor("d", "()V")), is("d")); | 43 | assertThat(getDeclarationToken(newConstructor("d", "()V")), is("d")); |
| @@ -40,17 +45,17 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 40 | assertThat(getDeclarationToken(newConstructor("d", "(II)V")), is("d")); | 45 | assertThat(getDeclarationToken(newConstructor("d", "(II)V")), is("d")); |
| 41 | assertThat(getDeclarationToken(newConstructor("d", "(III)V")), is("d")); | 46 | assertThat(getDeclarationToken(newConstructor("d", "(III)V")), is("d")); |
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | @Test | 49 | @Test |
| 45 | public void subsubDeclarations() { | 50 | public void subsubDeclarations() { |
| 46 | assertThat(getDeclarationToken(newConstructor("e", "(I)V")), is("e")); | 51 | assertThat(getDeclarationToken(newConstructor("e", "(I)V")), is("e")); |
| 47 | } | 52 | } |
| 48 | 53 | ||
| 49 | @Test | 54 | @Test |
| 50 | public void defaultDeclarations() { | 55 | public void defaultDeclarations() { |
| 51 | assertThat(getDeclarationToken(newConstructor("c", "()V")), nullValue()); | 56 | assertThat(getDeclarationToken(newConstructor("c", "()V")), nullValue()); |
| 52 | } | 57 | } |
| 53 | 58 | ||
| 54 | @Test | 59 | @Test |
| 55 | public void baseDefaultReferences() { | 60 | public void baseDefaultReferences() { |
| 56 | BehaviorEntry source = newConstructor("a", "()V"); | 61 | BehaviorEntry source = newConstructor("a", "()V"); |
| @@ -67,7 +72,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 67 | is(empty()) // implicit call, not decompiled to token | 72 | is(empty()) // implicit call, not decompiled to token |
| 68 | ); | 73 | ); |
| 69 | } | 74 | } |
| 70 | 75 | ||
| 71 | @Test | 76 | @Test |
| 72 | public void baseIntReferences() { | 77 | public void baseIntReferences() { |
| 73 | BehaviorEntry source = newConstructor("a", "(I)V"); | 78 | BehaviorEntry source = newConstructor("a", "(I)V"); |
| @@ -76,7 +81,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 76 | containsInAnyOrder("a") | 81 | containsInAnyOrder("a") |
| 77 | ); | 82 | ); |
| 78 | } | 83 | } |
| 79 | 84 | ||
| 80 | @Test | 85 | @Test |
| 81 | public void subDefaultReferences() { | 86 | public void subDefaultReferences() { |
| 82 | BehaviorEntry source = newConstructor("d", "()V"); | 87 | BehaviorEntry source = newConstructor("d", "()V"); |
| @@ -89,7 +94,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 89 | containsInAnyOrder("this") | 94 | containsInAnyOrder("this") |
| 90 | ); | 95 | ); |
| 91 | } | 96 | } |
| 92 | 97 | ||
| 93 | @Test | 98 | @Test |
| 94 | public void subIntReferences() { | 99 | public void subIntReferences() { |
| 95 | BehaviorEntry source = newConstructor("d", "(I)V"); | 100 | BehaviorEntry source = newConstructor("d", "(I)V"); |
| @@ -106,7 +111,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 106 | containsInAnyOrder("super") | 111 | containsInAnyOrder("super") |
| 107 | ); | 112 | ); |
| 108 | } | 113 | } |
| 109 | 114 | ||
| 110 | @Test | 115 | @Test |
| 111 | public void subIntIntReferences() { | 116 | public void subIntIntReferences() { |
| 112 | BehaviorEntry source = newConstructor("d", "(II)V"); | 117 | BehaviorEntry source = newConstructor("d", "(II)V"); |
| @@ -115,7 +120,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 115 | containsInAnyOrder("d") | 120 | containsInAnyOrder("d") |
| 116 | ); | 121 | ); |
| 117 | } | 122 | } |
| 118 | 123 | ||
| 119 | @Test | 124 | @Test |
| 120 | public void subsubIntReferences() { | 125 | public void subsubIntReferences() { |
| 121 | BehaviorEntry source = newConstructor("e", "(I)V"); | 126 | BehaviorEntry source = newConstructor("e", "(I)V"); |
| @@ -124,7 +129,7 @@ public class TestTokensConstructors extends TokenChecker { | |||
| 124 | containsInAnyOrder("e") | 129 | containsInAnyOrder("e") |
| 125 | ); | 130 | ); |
| 126 | } | 131 | } |
| 127 | 132 | ||
| 128 | @Test | 133 | @Test |
| 129 | public void defaultConstructableReferences() { | 134 | public void defaultConstructableReferences() { |
| 130 | BehaviorEntry source = newConstructor("c", "()V"); | 135 | BehaviorEntry source = newConstructor("c", "()V"); |