Skip to content

Commit

Permalink
Change access to expected resources in test
Browse files Browse the repository at this point in the history
The order of resources as provided to the TestProjectContext is not guaranteed anymore, now that parsed resources are taken from filesystem
  • Loading branch information
fabapp2 committed Aug 8, 2023
1 parent 51be3b8 commit 4e82fee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.springframework.sbm.project.resource.TestProjectContext;
import org.junit.jupiter.api.Test;

import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;

public class SuperTypeHierarchyTest {
Expand Down Expand Up @@ -55,7 +57,7 @@ void superTypeTest() {
.build()
.getProjectJavaSources();

JavaSource papaya = javaSourceSet.list().get(5);
JavaSource papaya = javaSourceSet.findJavaSourceDeclaringType("Papaya3").get();
SuperTypeHierarchy sut = new SuperTypeHierarchy(papaya.getTypes().get(0));

assertThat(sut.getRoot().getNode().getFullyQualifiedName()).isEqualTo("Papaya3");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,12 @@ public ProjectContext build() {
javaParser,
executionContext);
*/

// Writing to filesystem and parsing again changes th eresource order
writeResources(projectRoot, scannedResources);

ProjectContextInitializer projectContextInitializer = createProjectContextInitializer();



// create ProjectContext
ProjectContext projectContext = projectContextInitializer.initProjectContext(projectRoot, scannedResources);

Expand Down

0 comments on commit 4e82fee

Please sign in to comment.