From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- .../enigma/TestJarIndexConstructorReferences.java | 63 ++++++++++++---------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java') diff --git a/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java b/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java index 01d4bab..edb859a 100644 --- a/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java +++ b/src/test/java/cuchaz/enigma/TestJarIndexConstructorReferences.java @@ -4,62 +4,67 @@ * are made available under the terms of the GNU Lesser General Public * License v3.0 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl.html - * + * * Contributors: * Jeff Martin - initial API and implementation ******************************************************************************/ + package cuchaz.enigma; -import static cuchaz.enigma.TestEntryFactory.*; -import static org.hamcrest.MatcherAssert.*; -import static org.hamcrest.Matchers.*; +import cuchaz.enigma.analysis.EntryReference; +import cuchaz.enigma.analysis.JarIndex; +import cuchaz.enigma.mapping.BehaviorEntry; +import cuchaz.enigma.mapping.ClassEntry; +import org.junit.Test; import java.io.File; import java.util.Collection; import java.util.jar.JarFile; -import org.junit.Test; - -import cuchaz.enigma.analysis.EntryReference; -import cuchaz.enigma.analysis.JarIndex; -import cuchaz.enigma.mapping.BehaviorEntry; -import cuchaz.enigma.mapping.ClassEntry; +import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByConstructor; +import static cuchaz.enigma.TestEntryFactory.newBehaviorReferenceByMethod; +import static cuchaz.enigma.TestEntryFactory.newClass; +import static cuchaz.enigma.TestEntryFactory.newConstructor; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.is; public class TestJarIndexConstructorReferences { - + private JarIndex index; - - private ClassEntry baseClass = newClass("a"); - private ClassEntry subClass = newClass("d"); - private ClassEntry subsubClass = newClass("e"); + + private ClassEntry baseClass = newClass("a"); + private ClassEntry subClass = newClass("d"); + private ClassEntry subsubClass = newClass("e"); private ClassEntry defaultClass = newClass("c"); - private ClassEntry callerClass = newClass("b"); - + private ClassEntry callerClass = newClass("b"); + public TestJarIndexConstructorReferences() - throws Exception { + throws Exception { File jarFile = new File("build/test-obf/constructors.jar"); index = new JarIndex(); index.indexJar(new JarFile(jarFile), false); } - + @Test public void obfEntries() { assertThat(index.getObfClassEntries(), containsInAnyOrder(newClass("cuchaz/enigma/inputs/Keep"), baseClass, - subClass, subsubClass, defaultClass, callerClass)); + subClass, subsubClass, defaultClass, callerClass)); } - + @Test @SuppressWarnings("unchecked") public void baseDefault() { BehaviorEntry source = newConstructor(baseClass, "()V"); - Collection> references = index.getBehaviorReferences(source); + Collection> references = index.getBehaviorReferences(source); assertThat(references, containsInAnyOrder( newBehaviorReferenceByMethod(source, callerClass.getName(), "a", "()V"), newBehaviorReferenceByConstructor(source, subClass.getName(), "()V"), newBehaviorReferenceByConstructor(source, subClass.getName(), "(III)V") )); } - + @Test @SuppressWarnings("unchecked") public void baseInt() { @@ -68,7 +73,7 @@ public class TestJarIndexConstructorReferences { newBehaviorReferenceByMethod(source, callerClass.getName(), "b", "()V") )); } - + @Test @SuppressWarnings("unchecked") public void subDefault() { @@ -78,7 +83,7 @@ public class TestJarIndexConstructorReferences { newBehaviorReferenceByConstructor(source, subClass.getName(), "(I)V") )); } - + @Test @SuppressWarnings("unchecked") public void subInt() { @@ -89,7 +94,7 @@ public class TestJarIndexConstructorReferences { newBehaviorReferenceByConstructor(source, subsubClass.getName(), "(I)V") )); } - + @Test @SuppressWarnings("unchecked") public void subIntInt() { @@ -98,13 +103,13 @@ public class TestJarIndexConstructorReferences { newBehaviorReferenceByMethod(source, callerClass.getName(), "e", "()V") )); } - + @Test public void subIntIntInt() { BehaviorEntry source = newConstructor(subClass, "(III)V"); assertThat(index.getBehaviorReferences(source), is(empty())); } - + @Test @SuppressWarnings("unchecked") public void subsubInt() { @@ -113,7 +118,7 @@ public class TestJarIndexConstructorReferences { newBehaviorReferenceByMethod(source, callerClass.getName(), "f", "()V") )); } - + @Test @SuppressWarnings("unchecked") public void defaultConstructable() { -- cgit v1.2.3