Skip to content

Commit

Permalink
last -> lastOrNull
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed May 21, 2024
1 parent 2cec37d commit 0c2e467
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ abstract class AbstractWebsite implements Resource {
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-4">
<ul class="nav navbar-nav miolifooter">
«FOR it : topLevelMenu»
<li«IF equals(topLevelMenu.last)» style="border-right: 0 none;"«ENDIF»><a href="«key»">«value»</a></li>
<li«IF equals(topLevelMenu.lastOrNull)» style="border-right: 0 none;"«ENDIF»><a href="«key»">«value»</a></li>
«ENDFOR»
</ul>
</div><!-- /.navbar-collapse -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -262,7 +262,7 @@ contentTypeId=org.eclipse.emf.ecore.xmi
<extension
point="org.eclipse.ui.editors">
</extension>'''.toString.
assertEquals(loader.extensionNodes.last.toString)
assertEquals(loader.extensionNodes.lastOrNull.toString)
}

@Test
Expand Down Expand Up @@ -434,15 +434,15 @@ contentTypeId=org.eclipse.emf.ecore.xmi
val loader = load(singleView)
loader.insertExtensionElement(VIEW_POINT, "view")
'''<view></view>'''.toString.
assertEquals(loader.extensionElements.last.toString)
assertEquals(loader.extensionElements.lastOrNull.toString)
}

@Test
def void testInsertExtensionElementInEmptyPlugin() {
val loader = load(emptyPlugin)
loader.insertExtensionElement(VIEW_POINT, "view")
'''<view></view>'''.toString.
assertEquals(loader.extensionElements.last.toString)
assertEquals(loader.extensionElements.lastOrNull.toString)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 0c2e467

Please sign in to comment.