From 0c2e467927d48c5e7cf2081ecfef7b6faaf68213 Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Tue, 21 May 2024 10:54:45 +0200 Subject: [PATCH] last -> lastOrNull --- .../doc/websitegen/generator/AbstractWebsite.xtend | 2 +- .../dsl/tests/EmfParsleyDslPluginXmlLoaderTest.xtend | 8 ++++---- .../parsley/tests/AbstractEditingMenuBuilderTest.xtend | 2 +- .../emf/parsley/tests/DatabindingValidationUtilTest.xtend | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/org.eclipse.emf.parsley.doc.websitegen/src/org/eclipse/emf/parsley/doc/websitegen/generator/AbstractWebsite.xtend b/doc/org.eclipse.emf.parsley.doc.websitegen/src/org/eclipse/emf/parsley/doc/websitegen/generator/AbstractWebsite.xtend index 0c36d0f7a..2a1d43f99 100644 --- a/doc/org.eclipse.emf.parsley.doc.websitegen/src/org/eclipse/emf/parsley/doc/websitegen/generator/AbstractWebsite.xtend +++ b/doc/org.eclipse.emf.parsley.doc.websitegen/src/org/eclipse/emf/parsley/doc/websitegen/generator/AbstractWebsite.xtend @@ -231,7 +231,7 @@ abstract class AbstractWebsite implements Resource { diff --git a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslPluginXmlLoaderTest.xtend b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslPluginXmlLoaderTest.xtend index d10d2ee70..9774b3c84 100644 --- a/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslPluginXmlLoaderTest.xtend +++ b/dsl/org.eclipse.emf.parsley.dsl.tests/src/org/eclipse/emf/parsley/dsl/tests/EmfParsleyDslPluginXmlLoaderTest.xtend @@ -220,7 +220,7 @@ contentTypeId=org.eclipse.emf.ecore.xmi val loader = load(s1) val elements = loader.extensionElements VIEW_POINT.assertEquals(loader.getElementExtension(elements.head)) - EDITOR_POINT.assertEquals(loader.getElementExtension(elements.last)) + EDITOR_POINT.assertEquals(loader.getElementExtension(elements.lastOrNull)) } @Test @@ -262,7 +262,7 @@ contentTypeId=org.eclipse.emf.ecore.xmi '''.toString. - assertEquals(loader.extensionNodes.last.toString) + assertEquals(loader.extensionNodes.lastOrNull.toString) } @Test @@ -434,7 +434,7 @@ contentTypeId=org.eclipse.emf.ecore.xmi val loader = load(singleView) loader.insertExtensionElement(VIEW_POINT, "view") ''''''.toString. - assertEquals(loader.extensionElements.last.toString) + assertEquals(loader.extensionElements.lastOrNull.toString) } @Test @@ -442,7 +442,7 @@ contentTypeId=org.eclipse.emf.ecore.xmi val loader = load(emptyPlugin) loader.insertExtensionElement(VIEW_POINT, "view") ''''''.toString. - assertEquals(loader.extensionElements.last.toString) + assertEquals(loader.extensionElements.lastOrNull.toString) } @Test diff --git a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/AbstractEditingMenuBuilderTest.xtend b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/AbstractEditingMenuBuilderTest.xtend index 1eef185a5..974606b49 100644 --- a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/AbstractEditingMenuBuilderTest.xtend +++ b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/AbstractEditingMenuBuilderTest.xtend @@ -741,7 +741,7 @@ abstract class AbstractEditingMenuBuilderTest extends AbstractEmfParsleyTest { executeAction("New Book for Writer") // the book's library is not the original one - val addedLibrary = resource.contents.last as Library + val addedLibrary = resource.contents.lastOrNull as Library val addedBook = addedLibrary.getAddedNewBook addedBook.author.assertSame(writerForMenu) diff --git a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/DatabindingValidationUtilTest.xtend b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/DatabindingValidationUtilTest.xtend index cc0f0d864..f2eab5feb 100644 --- a/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/DatabindingValidationUtilTest.xtend +++ b/tests/org.eclipse.emf.parsley.tests/src/org/eclipse/emf/parsley/tests/DatabindingValidationUtilTest.xtend @@ -62,7 +62,7 @@ class DatabindingValidationUtilTest extends AbstractEmfParsleyTest { notEmpty = "foo" ] ] - fixture.getDiagnostic(container.objectsForDefaultValidation.last, + fixture.getDiagnostic(container.objectsForDefaultValidation.lastOrNull, testPackage.classForDefaultValidation_NotEmpty).assertDiagnostic("") fixture.getDiagnostic(container.objectsForDefaultValidation.head, testPackage.classForDefaultValidation_NotEmpty).