Skip to content
This repository was archived by the owner on Aug 17, 2019. It is now read-only.

Commit 655bf1e

Browse files
committed
Add one more test for castTo
1 parent f907f03 commit 655bf1e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/scala/com/ckkloverdos/maybe/Maybe.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.ckkloverdos.maybe
1818

1919
import collection.Iterator
20-
import collection.generic.CanBuildFrom
2120

2221
/**
2322
* Inspired by Lift's Box, Haskell's Maybe and Scala's Option.
@@ -46,7 +45,7 @@ sealed abstract class Maybe[+A] {
4645
def defMap[B](default: => B)(f: A => B): B = map(f) getOr default
4746

4847
@inline
49-
final def >>[B](f: A => Maybe[B]): Maybe[B] = this.flatMap(f)
48+
final def >>[B](f: A => Maybe[B]): Maybe[B] = this flatMap f
5049

5150
def filter(f: A => Boolean): Maybe[A]
5251

src/test/scala/com/ckkloverdos/maybe/MaybeTest.scala

+7
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,11 @@ class MaybeTest {
104104
val aJust: Maybe[_] = Just(help)
105105
Assert.assertTrue(aJust.castTo[CharSequence].isJust)
106106
}
107+
108+
@Test
109+
def testCastTo2 {
110+
val help = "Help"
111+
val aJust: Maybe[_] = Just(help)
112+
Assert.assertFalse(aJust.castTo[Int].isJust)
113+
}
107114
}

0 commit comments

Comments
 (0)