Skip to content

Commit

Permalink
test(refactor): move resources to testclasses in fieldaccesses (#2168)
Browse files Browse the repository at this point in the history
* Move resources to testclasses in fieldaccesses

* Fix imports: replace '*' with single imports

* Place MyClass in testclasses
  • Loading branch information
zielint0 authored and surli committed Jul 5, 2018
1 parent 29c5047 commit 57a17a5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import spoon.reflect.visitor.filter.TypeFilter;
import spoon.test.fieldaccesses.testclasses.B;
import spoon.test.fieldaccesses.testclasses.Kuu;
import spoon.test.fieldaccesses.testclasses.Mouse;
import spoon.test.fieldaccesses.testclasses.Panini;
import spoon.test.fieldaccesses.testclasses.Pozole;
import spoon.test.fieldaccesses.testclasses.Tacos;
import spoon.test.fieldaccesses.testclasses.MyClass;
import spoon.testing.utils.ModelUtils;

import java.util.List;
Expand All @@ -50,7 +52,7 @@ public class FieldAccessTest {

@Test
public void testModelBuildingFieldAccesses() throws Exception {
CtType<?> type = build("spoon.test.fieldaccesses", "Mouse");
CtType<?> type = build("spoon.test.fieldaccesses.testclasses", "Mouse");
assertEquals("Mouse", type.getSimpleName());

CtMethod<?> meth1 = type.getElements(
Expand Down Expand Up @@ -98,7 +100,7 @@ public void testModelBuildingFieldAccesses() throws Exception {

@Test
public void testBCUBug20140402() throws Exception {
CtType<?> type = build("spoon.test.fieldaccesses",
CtType<?> type = build("spoon.test.fieldaccesses.testclasses",
"BCUBug20140402");
assertEquals("BCUBug20140402", type.getSimpleName());

Expand Down Expand Up @@ -140,7 +142,7 @@ public void testBCUBug20140402() throws Exception {

@Test
public void testBUG20160112() throws Exception {
CtType<?> type = build("spoon.test.fieldaccesses", "BUG20160112");
CtType<?> type = build("spoon.test.fieldaccesses.testclasses", "BUG20160112");
assertEquals("BUG20160112", type.getSimpleName());
CtOperatorAssignment<?, ?> ass = type.getElements(
new TypeFilter<CtOperatorAssignment<?, ?>>(CtOperatorAssignment.class)).get(0);
Expand All @@ -151,7 +153,7 @@ public void testBUG20160112() throws Exception {

@Test
public void testTargetedAccessPosition() throws Exception {
CtType<?> type = build("spoon.test.fieldaccesses", "TargetedAccessPosition");
CtType<?> type = build("spoon.test.fieldaccesses.testclasses", "TargetedAccessPosition");
List<CtFieldAccess<?>> vars = type.getElements(
new TypeFilter<CtFieldAccess<?>>(CtFieldAccess.class));
//vars is [t.ta.ta, t.ta]
Expand Down Expand Up @@ -185,7 +187,7 @@ public void testFieldAccessInLambda() throws Exception {
assertEquals("LOG", logFieldAccess.getVariable().getSimpleName());
assertEquals(MyClass.class, logFieldAccess.getVariable().getDeclaringType().getActualClass());

String expectedLambda = "() -> {" + System.lineSeparator() + " spoon.test.fieldaccesses.MyClass.LOG.info(\"bla\");" + System.lineSeparator() + "}";
String expectedLambda = "() -> {" + System.lineSeparator() + " spoon.test.fieldaccesses.testclasses.MyClass.LOG.info(\"bla\");" + System.lineSeparator() + "}";
assertEquals(expectedLambda, logFieldAccess.getParent(CtLambda.class).toString());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.fieldaccesses;
package spoon.test.fieldaccesses.testclasses;

public class BCUBug20140402 {
Object[] data = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.fieldaccesses;
package spoon.test.fieldaccesses.testclasses;

public class BUG20160112 {
BUG20160112 a;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.fieldaccesses;
package spoon.test.fieldaccesses.testclasses;

public class Mouse {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.fieldaccesses;
package spoon.test.fieldaccesses.testclasses;

import java.util.logging.Logger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spoon.test.fieldaccesses;
package spoon.test.fieldaccesses.testclasses;

public class TargetedAccessPosition {
public TargetedAccessPosition ta;
Expand Down

0 comments on commit 57a17a5

Please sign in to comment.