groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Wagenleitner (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (GROOVY-7961) ObjectRange iterator returns null instead of NoSuchElementException
Date Fri, 07 Oct 2016 04:08:20 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

John Wagenleitner resolved GROOVY-7961.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.5.0-beta-1

Merged PR from [~jt1796].

> ObjectRange iterator returns null instead of NoSuchElementException
> -------------------------------------------------------------------
>
>                 Key: GROOVY-7961
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7961
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: John Wagenleitner
>            Assignee: John Wagenleitner
>            Priority: Minor
>             Fix For: 2.5.0-beta-1
>
>
> Calling {{next()}} on an {{ObjectRange}} iterator returns {{null}} when {{hasNext{}}}
returns false.  It should throw {{NoSuchElementException}} to adhere to the Iterator contract.
> {code}
> class ObjectRangeItrTest extends GroovyTestCase {
>     void testItr() {
>         def itr = ('a'..'b').iterator()        
>         assert itr.next() == 'a'
>         assert itr.next() == 'b'
>         assert !itr.hasNext() 
>         shouldFail(NoSuchElementException) {
>             println itr.next()
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message