From 6e464ea251cab63c776ece0b2a356f1498ffa294 Mon Sep 17 00:00:00 2001 From: Thog Date: Wed, 8 Mar 2017 08:17:04 +0100 Subject: Follow Fabric guidelines --- .../java/cuchaz/enigma/TestJarIndexLoneClass.java | 67 ++++++++++------------ 1 file changed, 29 insertions(+), 38 deletions(-) (limited to 'src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java') diff --git a/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java b/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java index 8efa57c..6cab1c8 100644 --- a/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java +++ b/src/test/java/cuchaz/enigma/TestJarIndexLoneClass.java @@ -4,44 +4,35 @@ * 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.*; +import cuchaz.enigma.mapping.*; +import org.junit.Test; import java.util.Collection; import java.util.Set; import java.util.jar.JarFile; -import org.junit.Test; - -import cuchaz.enigma.analysis.Access; -import cuchaz.enigma.analysis.ClassImplementationsTreeNode; -import cuchaz.enigma.analysis.ClassInheritanceTreeNode; -import cuchaz.enigma.analysis.EntryReference; -import cuchaz.enigma.analysis.JarIndex; -import cuchaz.enigma.analysis.MethodInheritanceTreeNode; -import cuchaz.enigma.mapping.BehaviorEntry; -import cuchaz.enigma.mapping.ClassEntry; -import cuchaz.enigma.mapping.FieldEntry; -import cuchaz.enigma.mapping.MethodEntry; -import cuchaz.enigma.mapping.Translator; +import static cuchaz.enigma.TestEntryFactory.*; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; public class TestJarIndexLoneClass { - + private JarIndex index; - + public TestJarIndexLoneClass() - throws Exception { + throws Exception { index = new JarIndex(); index.indexJar(new JarFile("build/test-obf/loneClass.jar"), false); } - + @Test public void obfEntries() { assertThat(index.getObfClassEntries(), containsInAnyOrder( @@ -49,7 +40,7 @@ public class TestJarIndexLoneClass { newClass("a") )); } - + @Test public void translationIndex() { assertThat(index.getTranslationIndex().getSuperclass(new ClassEntry("a")), is(new ClassEntry("java/lang/Object"))); @@ -59,7 +50,7 @@ public class TestJarIndexLoneClass { assertThat(index.getTranslationIndex().getSubclass(new ClassEntry("a")), is(empty())); assertThat(index.getTranslationIndex().getSubclass(new ClassEntry("cuchaz/enigma/inputs/Keep")), is(empty())); } - + @Test public void access() { assertThat(index.getAccess(newField("a", "a", "Ljava/lang/String;")), is(Access.PRIVATE)); @@ -67,7 +58,7 @@ public class TestJarIndexLoneClass { assertThat(index.getAccess(newField("a", "b", "Ljava/lang/String;")), is(nullValue())); assertThat(index.getAccess(newField("a", "a", "LFoo;")), is(nullValue())); } - + @Test public void classInheritance() { ClassInheritanceTreeNode node = index.getClassInheritance(new Translator(), newClass("a")); @@ -75,7 +66,7 @@ public class TestJarIndexLoneClass { assertThat(node.getObfClassName(), is("a")); assertThat(node.getChildCount(), is(0)); } - + @Test public void methodInheritance() { MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); @@ -84,19 +75,19 @@ public class TestJarIndexLoneClass { assertThat(node.getMethodEntry(), is(source)); assertThat(node.getChildCount(), is(0)); } - + @Test public void classImplementations() { ClassImplementationsTreeNode node = index.getClassImplementations(new Translator(), newClass("a")); assertThat(node, is(nullValue())); } - + @Test public void methodImplementations() { MethodEntry source = newMethod("a", "a", "()Ljava/lang/String;"); assertThat(index.getMethodImplementations(new Translator(), source), is(empty())); } - + @Test public void relatedMethodImplementations() { Set entries = index.getRelatedMethodImplementations(newMethod("a", "a", "()Ljava/lang/String;")); @@ -104,53 +95,53 @@ public class TestJarIndexLoneClass { newMethod("a", "a", "()Ljava/lang/String;") )); } - + @Test @SuppressWarnings("unchecked") public void fieldReferences() { FieldEntry source = newField("a", "a", "Ljava/lang/String;"); - Collection> references = index.getFieldReferences(source); + Collection> references = index.getFieldReferences(source); assertThat(references, containsInAnyOrder( newFieldReferenceByConstructor(source, "a", "(Ljava/lang/String;)V"), newFieldReferenceByMethod(source, "a", "a", "()Ljava/lang/String;") )); } - + @Test public void behaviorReferences() { assertThat(index.getBehaviorReferences(newMethod("a", "a", "()Ljava/lang/String;")), is(empty())); } - + @Test public void innerClasses() { assertThat(index.getInnerClasses(newClass("a")), is(empty())); } - + @Test public void outerClass() { assertThat(index.getOuterClass(newClass("a")), is(nullValue())); } - + @Test public void isAnonymousClass() { assertThat(index.isAnonymousClass(newClass("a")), is(false)); } - + @Test public void interfaces() { assertThat(index.getInterfaces("a"), is(empty())); } - + @Test public void implementingClasses() { assertThat(index.getImplementingClasses("a"), is(empty())); } - + @Test public void isInterface() { assertThat(index.isInterface("a"), is(false)); } - + @Test public void testContains() { assertThat(index.containsObfClass(newClass("a")), is(true)); -- cgit v1.2.3