1
저는 Scala 2.10, Specs2 13.1-SNAPSHOT 및 Play2 Framework 2.1에서 제공되는 FluentLenium API를 사용합니다.FluentLenium Api에서 Specs2 사용 중 오류가 발생했습니다.
나는 (FluentLenium 사양에 따라) 하위 요소를 찾아 내 IntegrationSpec
파일에 코드 줄이 있습니다
browser.find(".myClass").find("#mySubElement") must haveSize(1)
:
error: type mismatch;
found : org.fluentlenium.core.domain.FluentList[_ <: org.fluentlenium.core.domain.FluentWebElement]
required: org.fluentlenium.core.domain.FluentList[?0(in value $anonfun)] where type ?0(in value $anonfun) <: org.fluentlenium.core.domain.FluentWebElement
Note: org.fluentlenium.core.domain.FluentWebElement >: ?0, but Java-defined class FluentList is invariant in type E.
You may wish to investigate a wildcard type such as `_ >: ?0`. (SLS 3.2.10)
인가 그것은 일종의 ... incompatibilty 스칼라/자바 제네릭으로 인해 ?? 또는 내가 알아 내지 못했던 정상적인 행동?
단 (모든 정규 생략)이 줄 잘 컴파일 :
browser.find(".myClass").find("#mySubElement")
감사 Eric :) 해결 된 문제! 사실, 추측은 스칼라 컴파일러에 대해 명백하지 않았습니다. – Mik378
어떤 솔루션을 완성 했습니까? – Eric
3 개가 예쁘기 때문에 첫 번째 것을 선택했습니다 (맛의 문제? :). 문제를 이해 한 것 같습니다. 메소드를 체인으로 연결할 때 두 번째 매개 변수는 매개 변수 유형없이 FluentList를 반환합니다! 클래스 정의는 그럼에도 불구하고 : FluentList public class FluentList , 그래서 언급 한 바와 같이, javaCollectionIsSized는 가변적 인 TYPED 콜렉션을 기대한다. 당신은 무엇을 생각합니까? –
Mik378