Skip to content

Commit

Permalink
test(refactor): delete unused testclasses in limits (#2247)
Browse files Browse the repository at this point in the history
* delete unused testclasses

* refactor: move ContainInternalClass.java to testclasses

* fix formatting

* fix formatting
  • Loading branch information
zielint0 authored and surli committed Jul 19, 2018
1 parent 2b23448 commit f4187d7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 75 deletions.
8 changes: 0 additions & 8 deletions src/test/java/spoon/test/limits/MultipleInternalClass.java

This file was deleted.

18 changes: 0 additions & 18 deletions src/test/java/spoon/test/limits/StaticClassAnon.java

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions src/test/java/spoon/test/limits/StaticFieldAccesOnInstance.java

This file was deleted.

31 changes: 10 additions & 21 deletions src/test/java/spoon/test/limits/utils/InternalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import spoon.reflect.declaration.CtNamedElement;
import spoon.reflect.visitor.filter.NamedElementFilter;
import spoon.reflect.visitor.filter.TypeFilter;
import spoon.test.limits.utils.testclasses.ContainInternalClass;

import java.util.List;

Expand All @@ -15,45 +16,33 @@ public class InternalTest {

@Test
public void testInternalClasses() throws Exception {
CtClass<?> type = build("spoon.test.limits.utils",
"ContainInternalClass");
CtClass<?> type = build("spoon.test.limits.utils.testclasses", "ContainInternalClass");
assertEquals("ContainInternalClass", type.getSimpleName());
List<CtClass<?>> classes = type.getElements(new TypeFilter<CtClass<?>>(
CtClass.class));
List<CtClass<?>> classes = type.getElements(new TypeFilter<CtClass<?>>(CtClass.class));
assertEquals(4, classes.size());
CtClass<?> c1 = classes.get(1);
assertEquals("InternalClass", c1.getSimpleName());
assertEquals(
"spoon.test.limits.utils.ContainInternalClass$InternalClass",
"spoon.test.limits.utils.testclasses.ContainInternalClass$InternalClass",
c1.getQualifiedName());
assertEquals("spoon.test.limits.utils", c1.getPackage()
.getQualifiedName());
assertEquals(
spoon.test.limits.utils.ContainInternalClass.InternalClass.class,
c1.getActualClass());
assertEquals("spoon.test.limits.utils.testclasses", c1.getPackage().getQualifiedName());
assertEquals(ContainInternalClass.InternalClass.class, c1.getActualClass());

CtClass<?> c2 = classes.get(2);
assertEquals("InsideInternalClass", c2.getSimpleName());
assertEquals(
"spoon.test.limits.utils.ContainInternalClass$InternalClass$InsideInternalClass",
"spoon.test.limits.utils.testclasses.ContainInternalClass$InternalClass$InsideInternalClass",
c2.getQualifiedName());
assertEquals(
spoon.test.limits.utils.ContainInternalClass.InternalClass.InsideInternalClass.class,
c2.getActualClass());

assertEquals(ContainInternalClass.InternalClass.InsideInternalClass.class, c2.getActualClass());
}

@Test
public void testStaticFinalFieldInAnonymousClass() throws Exception {
CtClass<?> type = build("spoon.test.limits.utils",
"ContainInternalClass");
List<CtClass<?>> classes = type.getElements(new TypeFilter<CtClass<?>>(
CtClass.class));
CtClass<?> type = build("spoon.test.limits.utils.testclasses", "ContainInternalClass");
List<CtClass<?>> classes = type.getElements(new TypeFilter<CtClass<?>>(CtClass.class));
CtClass<?> c3 = classes.get(3);
List<CtNamedElement> fields = c3
.getElements(new NamedElementFilter<>(CtNamedElement.class,"serialVersionUID"));
assertEquals(1, fields.size());

}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.limits.utils;
package spoon.test.limits.utils.testclasses;

public class ContainInternalClass {

Expand Down

0 comments on commit f4187d7

Please sign in to comment.