Skip to content

Instantly share code, notes, and snippets.

@attacco
Last active October 22, 2024 10:15
Show Gist options
  • Select an option

  • Save attacco/52d9e18b8ce845917c073b635d234342 to your computer and use it in GitHub Desktop.

Select an option

Save attacco/52d9e18b8ce845917c073b635d234342 to your computer and use it in GitHub Desktop.
class Example extends Specification {
def "test"() {
given:
Cls cls = Spy(new Cls())
when:
cls.m()
then:
1 * cls.onChanges({ List<String> lst ->
check(lst)
})
}
def check(List<String> lst) {
assert lst.size() == 4
assert lst.every { it instanceof String } // не работает
}
class Cls {
def m() {
onChanges(List.of("a", "a", "a", "b"))
}
def onChanges(List<String> list) {
list.forEach { println it }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment