From b29e97a8283bedb962ab944a92a0046cccbbe5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Sun, 20 Oct 2024 10:02:31 +0300 Subject: [PATCH] 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 --- .../smartimport/ProjectSmartImportTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/ui/tests/smartimport/ProjectSmartImportTest.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/ui/tests/smartimport/ProjectSmartImportTest.java index fa49fc3127..460bbcc8c7 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/ui/tests/smartimport/ProjectSmartImportTest.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/ui/tests/smartimport/ProjectSmartImportTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2023 Red Hat, Inc. and others. + * Copyright (c) 2018, 2024 Red Hat, Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -51,10 +51,10 @@ public class ProjectSmartImportTest { @Parameters(name = "{0}") public static Object[][] projects() { return new Object[][] { // - { "JavaEclipseProject", List.of("org.eclipse.jdt.core.javanature") }, // - { "FeatureProject", List.of("org.eclipse.pde.FeatureNature") }, // - { "PlainEclipseProject", List.of() }, // - { "PlainJavaProject", List.of("org.eclipse.jdt.core.javanature") }, // + { "JavaEclipseProject", List.of("org.eclipse.jdt.core.javanature") }, // + { "FeatureProject", List.of("org.eclipse.pde.FeatureNature") }, // + { "PlainEclipseProject", List.of() }, // + { "PlainJavaProject", List.of("org.eclipse.jdt.core.javanature") }, // }; } @@ -86,7 +86,7 @@ private static Path getErrorLogFile() { } @Test - public void testImport() throws CoreException, InterruptedException { + public void testImport() throws CoreException, InterruptedException, IOException { File projectPath = new File(workingDirectory.getRoot(), projectName); var job = new org.eclipse.ui.internal.wizards.datatransfer.SmartImportJob(projectPath, null, true, false); @@ -94,7 +94,7 @@ public void testImport() throws CoreException, InterruptedException { job.join(); // check imported project - assertThat(getErrorLogFile()).isEmptyFile(); + assertThat(getErrorLogFile()).as("Content: %s", Files.readString(getErrorLogFile())).isEmptyFile(); IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot(); assertThat(workspace.getProjects()).hasSize(1).allMatch(p -> p.getName().equals(projectName)); IProject project = workspace.getProject(projectName); @@ -116,7 +116,7 @@ private void checkProblemsView(IProject project) throws CoreException { }).toList(); assertTrue( "There should be no errors in imported project: " + System.lineSeparator() + errorMarkers.stream() - .map(String::valueOf).collect(Collectors.joining(System.lineSeparator())), + .map(String::valueOf).collect(Collectors.joining(System.lineSeparator())), errorMarkers.isEmpty()); }