Skip to content

Commit

Permalink
added test case for incomplete Superclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKlauke committed Sep 8, 2023
1 parent 1ec5b12 commit 32f856e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package sootup.tests.typehierarchy.viewtypehierarchytestcase;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static sootup.core.util.ImmutableUtils.immutableList;

import categories.Java8Test;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import sootup.core.typehierarchy.ViewTypeHierarchy;
import sootup.core.types.ClassType;
import sootup.tests.typehierarchy.JavaTypeHierarchyTestBase;

/** @author Jonas Klauke * */
@Category(Java8Test.class)
public class IncompleteSuperclassTest extends JavaTypeHierarchyTestBase {
@Test
public void method() {
ViewTypeHierarchy typeHierarchy =
(ViewTypeHierarchy) customTestWatcher.getView().getTypeHierarchy();
List<ClassType> superclasses =
typeHierarchy.incompleteSuperClassesOf(getClassType("SubClassB"));
ClassType object = getClassType("java.lang.Object");
ImmutableList<ClassType> expectedSuperClasses =
immutableList(getClassType("SubClassA"), object);
assertEquals(expectedSuperClasses, superclasses);
assertFalse(customTestWatcher.getView().getClass(object).isPresent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class SubClassA {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public class SubClassB extends SubClassA {

}

0 comments on commit 32f856e

Please sign in to comment.