Skip to content

Commit b29e97a

Browse files
akurtakovHannesWell
authored andcommitted
Enhance ProjectSmartImportTest assertion
Have the actual file content in the failure message to analyze failures in I-build only like https://download.eclipse.org/eclipse/downloads/drops4/I20241019-1800/testresults/html/org.eclipse.pde.ui.tests_ep434I-unit-cen64-gtk3-java17_linux.gtk.x86_64_17.html
1 parent cc83723 commit b29e97a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ui/org.eclipse.pde.ui.tests/src/org/eclipse/ui/tests/smartimport/ProjectSmartImportTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2023 Red Hat, Inc. and others.
2+
* Copyright (c) 2018, 2024 Red Hat, Inc. and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -51,10 +51,10 @@ public class ProjectSmartImportTest {
5151
@Parameters(name = "{0}")
5252
public static Object[][] projects() {
5353
return new Object[][] { //
54-
{ "JavaEclipseProject", List.of("org.eclipse.jdt.core.javanature") }, //
55-
{ "FeatureProject", List.of("org.eclipse.pde.FeatureNature") }, //
56-
{ "PlainEclipseProject", List.of() }, //
57-
{ "PlainJavaProject", List.of("org.eclipse.jdt.core.javanature") }, //
54+
{ "JavaEclipseProject", List.of("org.eclipse.jdt.core.javanature") }, //
55+
{ "FeatureProject", List.of("org.eclipse.pde.FeatureNature") }, //
56+
{ "PlainEclipseProject", List.of() }, //
57+
{ "PlainJavaProject", List.of("org.eclipse.jdt.core.javanature") }, //
5858
};
5959
}
6060

@@ -86,15 +86,15 @@ private static Path getErrorLogFile() {
8686
}
8787

8888
@Test
89-
public void testImport() throws CoreException, InterruptedException {
89+
public void testImport() throws CoreException, InterruptedException, IOException {
9090
File projectPath = new File(workingDirectory.getRoot(), projectName);
9191

9292
var job = new org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob(projectPath, null, true, false);
9393
job.run(new NullProgressMonitor());
9494
job.join();
9595

9696
// check imported project
97-
assertThat(getErrorLogFile()).isEmptyFile();
97+
assertThat(getErrorLogFile()).as("Content: %s", Files.readString(getErrorLogFile())).isEmptyFile();
9898
IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
9999
assertThat(workspace.getProjects()).hasSize(1).allMatch(p -> p.getName().equals(projectName));
100100
IProject project = workspace.getProject(projectName);
@@ -116,7 +116,7 @@ private void checkProblemsView(IProject project) throws CoreException {
116116
}).toList();
117117
assertTrue(
118118
"There should be no errors in imported project: " + System.lineSeparator() + errorMarkers.stream()
119-
.map(String::valueOf).collect(Collectors.joining(System.lineSeparator())),
119+
.map(String::valueOf).collect(Collectors.joining(System.lineSeparator())),
120120
errorMarkers.isEmpty());
121121

122122
}

0 commit comments

Comments
 (0)