Permalink
Browse files

license comments added

  • Loading branch information...
danseid committed Nov 21, 2012
1 parent b8cc333 commit 0e518042407f0cbc6a7c4d51b352a329daa76468
View
@@ -45,7 +45,7 @@ Match the result to any object in a list
4 should !be any of (1,2,4) //✘
###String
-Matchers to use on String objects
+Matchers to use on string objects
####have | !have length
"string" should have length 6 //✔
"" should !have length 1 //✔
@@ -69,7 +69,7 @@ Matchers to use on String objects
###Function
-Matchers to use on () : R -> Function
+Matchers to use on () : R -> function
####fail | !fail with
{throw NullPointerException()} should fail with NullPointerException() //✔
{1 should be equal 1} should !fail with AssertionError() //✔
@@ -28,12 +28,12 @@ trait Matcher {
open class AnyBeMatcher<T>(val target: T): Matcher {
inline fun equal(value: T) = if (value != target) fail(value, target)
- open inline fun any(values: List<T>) = if(!values.any { it == target }) fail("any of $values", target)
+ inline fun any(values: List<T>) = if(!values.any { it == target }) fail("any of $values", target)
}
open class AnyNotBeMatcher<T>(val target: T): Matcher {
inline fun equal(value: T) = if (value == target) fail(value, target)
- open inline fun any(values: List<T>) = if(values any { it == target }) fail("not any of $values", target)
+ inline fun any(values: List<T>) = if(values any { it == target }) fail("not any of $values", target)
}
View
@@ -1,12 +1,24 @@
-/**.
- * User: Daniel Seidler
- * Date: 15.11.12
- * Time: 15:57
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-
import org.junit.runners.Suite;
import org.junit.runner.RunWith;
-
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
RunWith(javaClass<Suite>())
Suite.SuiteClasses(
javaClass<VerbTest>(),
@@ -1,11 +1,24 @@
-/**.
- * User: Daniel Seidler
- * Date: 15.11.12
- * Time: 11:22
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-
import org.junit.Test as test
import org.katchers.*
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
public class AnyMatchersTest {
test fun integers() {
@@ -19,6 +32,7 @@ public class AnyMatchersTest {
{ 1 should be any of(1, 2, 3) } should !fail with AssertionError();
{ 4 should !be any of(1, 2, 3) } should !fail with AssertionError();
{ 1 should !be any of(1, 2, 3) } should fail with AssertionError()
+
}
test fun strings() {
@@ -1,12 +1,27 @@
-/**.
- * User: Daniel Seidler
- * Date: 16.11.12
- * Time: 11:31
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import org.junit.Test as test
import org.katchers.*
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
+
public class FunctionMatcherTest {
test fun functionNotThrowingAnException () {
@@ -37,4 +52,8 @@ public class FunctionMatcherTest {
if(!assertErrorThrown) fail("AssertionError", "none")
}
}
+
+ test fun tf() {
+ {(): Unit -> println({(x: Int, y: Int) : String -> "$x + $y" }(1, 2)) }
+ }
}
@@ -1,15 +1,32 @@
-/**.
- * User: Daniel Seidler
- * Date: 15.11.12
- * Time: 16:26
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
-
import kotlin.test.assertTrue
import org.junit.Test as test
import org.katchers.*
-
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
public class ShouldTest {
test fun shouldBeAnyMatcher() {
assertTrue(Any().should(be) is AnyBeMatcher<Any>)
+ assertTrue(Any().should(!be) is AnyNotBeMatcher<Any>)
+ }
+
+ test fun shouldBeStringMatcher() {
+
}
}
@@ -1,21 +1,35 @@
-/**.
- * User: Daniel Seidler
- * Date: 15.11.12
- * Time: 13:51
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import org.junit.Test as test
import org.katchers.*
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
public class StringMatcherTest {
test fun haveLength() {
"" should have length 0
"a" should have length 1
"a" should !have length 0
"" should !have length 1
- {"" should have length 1} should fail with AssertionError();
- {"" should !have length 0} should fail with AssertionError()
+ { "" should have length 1 } should fail with AssertionError();
+ { "" should !have length 0 } should fail with AssertionError()
}
@@ -28,19 +42,18 @@ public class StringMatcherTest {
"abc" should end with ""
"" should !end with "abc"
- {"abc" should start with "b"} should fail with AssertionError();
- {"abc" should !start with "a"} should fail with AssertionError();
- {"abc" should end with "b"} should fail with AssertionError();
- {"abc" should !end with "c"} should fail with AssertionError();
+ { "abc" should start with "b" } should fail with AssertionError();
+ { "abc" should !start with "a" } should fail with AssertionError();
+ { "abc" should end with "b" } should fail with AssertionError();
+ { "abc" should !end with "c" } should fail with AssertionError();
}
test fun containAny() {
"abc" should contain any of("a", "b", "c")
"abc" should !contain any of("d", "e", "f");
- {"abc" should contain any of("d", "e", "f")} should fail with AssertionError();
- {"abc" should !contain any of("a", "e", "f")} should fail with AssertionError();
-
+ { "abc" should contain any of("d", "e", "f") } should fail with AssertionError();
+ { "abc" should !contain any of("a", "e", "f") } should fail with AssertionError();
}
@@ -49,8 +62,8 @@ public class StringMatcherTest {
"abc" should contain all of("a", "b", "c")
"abc" should !contain all of("d", "e");
- {"abc" should contain all of("a", "b", "d")} should fail with AssertionError();
- {"abc" should !contain all of("a", "b")} should fail with AssertionError();
+ { "abc" should contain all of("a", "b", "d") } should fail with AssertionError();
+ { "abc" should !contain all of("a", "b") } should fail with AssertionError();
}
@@ -1,13 +1,28 @@
-/**.
- * User: Daniel Seidler
- * Date: 15.11.12
- * Time: 10:40
+/*
+ * Copyright 2012 Daniel Seidler
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import kotlin.test.assertEquals
import org.junit.Test as test
import org.katchers.*
+/**
+ * @author Daniel Seidler
+ * @since 2012/11/21
+ */
+
public class VerbTest {
test fun be() {
assertEquals(!be, notbe)

0 comments on commit 0e51804

Please sign in to comment.