diff options
| author | 2014-09-21 00:32:03 -0400 | |
|---|---|---|
| committer | 2014-09-21 00:32:03 -0400 | |
| commit | 8409dea980fa03c06b180969c5e0696f7cb5474b (patch) | |
| tree | eb0cdfad4bc2cee6df8a311e62fc2f60d0360970 /test/cuchaz/enigma/TestInnerClasses.java | |
| parent | removed workaround for procyon bug (diff) | |
| download | enigma-fork-8409dea980fa03c06b180969c5e0696f7cb5474b.tar.gz enigma-fork-8409dea980fa03c06b180969c5e0696f7cb5474b.tar.xz enigma-fork-8409dea980fa03c06b180969c5e0696f7cb5474b.zip | |
started unit testing for inner/anonymous class detection
Diffstat (limited to '')
| -rw-r--r-- | test/cuchaz/enigma/TestInnerClasses.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/cuchaz/enigma/TestInnerClasses.java b/test/cuchaz/enigma/TestInnerClasses.java new file mode 100644 index 0000000..c6b1b5f --- /dev/null +++ b/test/cuchaz/enigma/TestInnerClasses.java | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2014 Jeff Martin. | ||
| 3 | * | ||
| 4 | * All rights reserved. This program and the accompanying materials | ||
| 5 | * are made available under the terms of the GNU Public License v3.0 | ||
| 6 | * which accompanies this distribution, and is available at | ||
| 7 | * http://www.gnu.org/licenses/gpl.html | ||
| 8 | * | ||
| 9 | * Contributors: | ||
| 10 | * Jeff Martin - initial API and implementation | ||
| 11 | ******************************************************************************/ | ||
| 12 | package cuchaz.enigma; | ||
| 13 | |||
| 14 | import static org.hamcrest.MatcherAssert.*; | ||
| 15 | import static org.hamcrest.Matchers.*; | ||
| 16 | |||
| 17 | import java.util.jar.JarFile; | ||
| 18 | |||
| 19 | import org.junit.Test; | ||
| 20 | |||
| 21 | import cuchaz.enigma.analysis.JarIndex; | ||
| 22 | |||
| 23 | public class TestInnerClasses | ||
| 24 | { | ||
| 25 | private JarIndex m_index; | ||
| 26 | |||
| 27 | private static final String AnonymousOuter = "none/a"; | ||
| 28 | private static final String AnonymousInner = "none/b"; | ||
| 29 | private static final String SimpleOuter = "none/e"; | ||
| 30 | private static final String SimpleInner = "none/f"; | ||
| 31 | private static final String ConstructorArgsOuter = "none/c"; | ||
| 32 | private static final String ConstructorArgsInner = "none/d"; | ||
| 33 | |||
| 34 | public TestInnerClasses( ) | ||
| 35 | throws Exception | ||
| 36 | { | ||
| 37 | m_index = new JarIndex(); | ||
| 38 | m_index.indexJar( new JarFile( "build/libs/testInnerClasses.obf.jar" ), true ); | ||
| 39 | } | ||
| 40 | |||
| 41 | @Test | ||
| 42 | public void simple( ) | ||
| 43 | { | ||
| 44 | assertThat( m_index.getOuterClass( SimpleInner ), is( SimpleOuter ) ); | ||
| 45 | assertThat( m_index.getInnerClasses( SimpleOuter ), containsInAnyOrder( SimpleInner ) ); | ||
| 46 | assertThat( m_index.isAnonymousClass( SimpleInner ), is( false ) ); | ||
| 47 | } | ||
| 48 | |||
| 49 | @Test | ||
| 50 | public void anonymous( ) | ||
| 51 | { | ||
| 52 | assertThat( m_index.getOuterClass( AnonymousInner ), is( AnonymousOuter ) ); | ||
| 53 | assertThat( m_index.getInnerClasses( AnonymousOuter ), containsInAnyOrder( AnonymousInner ) ); | ||
| 54 | assertThat( m_index.isAnonymousClass( AnonymousInner ), is( true ) ); | ||
| 55 | } | ||
| 56 | |||
| 57 | @Test | ||
| 58 | public void constructorArgs( ) | ||
| 59 | { | ||
| 60 | assertThat( m_index.getOuterClass( ConstructorArgsInner ), is( ConstructorArgsOuter ) ); | ||
| 61 | assertThat( m_index.getInnerClasses( ConstructorArgsOuter ), containsInAnyOrder( ConstructorArgsInner ) ); | ||
| 62 | assertThat( m_index.isAnonymousClass( ConstructorArgsInner ), is( false ) ); | ||
| 63 | } | ||
| 64 | } | ||