using the ScalaTest/FlatSpec library I am testing the types of returned values from a random number generator using functional state:
it should "return (\"{someRandomNumber}\", rng2) on nonNegativeInt.map(_.toString)" in {
    val s = RNG.map(RNG.nonNegativeInt)(_.toString)(rng)
    assert(s.isInstanceOf[(Int, RNG)]) // WRONG but PASS!!
    assert(s._2 !== rng)
}
now if you notice the incorrect isInstanceOf[(Int, RNG)] you would think that this would produce a fail, however it succeeds.
the following code demonstrates that this passes as long as the tuple has the correct arity:
it should "not work" in {
    assert(("123", rng).isInstanceOf[(Int, RNG)]) // PASS
    assert(("123", rng).isInstanceOf[(String, Nothing)]) // PASS
    assert(("123", rng).isInstanceOf[(Exception, Array[_])]) // PASS
}
but if the tuple has one type parameter:
it should "also not work" in {
    assert(("123").isInstanceOf[Int]) // FAIL
}
What is going on here? how should I test the inner parameterized types?
 
     
    