Skip to content

Commit 49e4b69

Browse files
committed
Refactored tests scope
1 parent 2136051 commit 49e4b69

10 files changed

+53
-49
lines changed

src/main/kotlin/in/rcard/assertj/arrowcore/errors/OptionShouldBePresent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.assertj.core.error.BasicErrorMessageFactory
88
*
99
* @author Riccardo Cardin
1010
*/
11-
class OptionShouldBePresent :
11+
internal class OptionShouldBePresent :
1212
BasicErrorMessageFactory("%nExpecting Option to contain a value but it didn't.".format()) {
1313
companion object {
1414

@@ -17,6 +17,6 @@ class OptionShouldBePresent :
1717
*
1818
* @return a error message factory.
1919
*/
20-
fun shouldBePresent(): OptionShouldBePresent = OptionShouldBePresent()
20+
internal fun shouldBePresent(): OptionShouldBePresent = OptionShouldBePresent()
2121
}
2222
}

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_assertThat_Test.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import arrow.core.right
55
import org.assertj.core.api.BDDAssertions.then
66
import org.junit.jupiter.api.Test
77

8-
class EitherAssert_assertThat_Test {
8+
internal class EitherAssert_assertThat_Test {
99
@Test
10-
fun `should create an assertion instance when given object is not null`() {
10+
internal fun `should create an assertion instance when given object is not null`() {
1111
// GIVEN
1212
val rightValue = 42.right()
1313
// WHEN
@@ -17,7 +17,7 @@ class EitherAssert_assertThat_Test {
1717
}
1818

1919
@Test
20-
fun `should create an assertion instance when given object is null`() {
20+
internal fun `should create an assertion instance when given object is null`() {
2121
// GIVEN
2222
val rightValue: Either<Nothing, Nothing>? = null
2323
// WHEN

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_containsOnLeftInstanceOf_Test.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import org.assertj.core.api.Assertions
1010
import org.assertj.core.util.FailureMessages
1111
import org.junit.jupiter.api.Test
1212

13-
class EitherAssert_containsOnLeftInstanceOf_Test {
13+
internal class EitherAssert_containsOnLeftInstanceOf_Test {
1414
@Test
15-
fun `should fail if either is null`() {
15+
internal fun `should fail if either is null`() {
1616
val actual: Either<Any, Any>? = null
1717
Assertions.assertThatThrownBy {
1818
assertThat(actual).containsLeftInstanceOf(
@@ -24,7 +24,7 @@ class EitherAssert_containsOnLeftInstanceOf_Test {
2424
}
2525

2626
@Test
27-
fun `should fail if either is right`() {
27+
internal fun `should fail if either is right`() {
2828
val actual: Either<Any, String> = "some".right()
2929
Assertions.assertThatThrownBy {
3030
assertThat(actual).containsLeftInstanceOf(
@@ -36,20 +36,20 @@ class EitherAssert_containsOnLeftInstanceOf_Test {
3636
}
3737

3838
@Test
39-
fun `should pass if either contains required type on left`() {
39+
internal fun `should pass if either contains required type on left`() {
4040
val actual: Either<String, Nothing> = "something".left()
4141
assertThat(actual)
4242
.containsLeftInstanceOf(String::class.java)
4343
}
4444

4545
@Test
46-
fun `should pass if either contains required type subclass on left`() {
46+
internal fun `should pass if either contains required type subclass on left`() {
4747
val actual = Child().left()
4848
assertThat(actual).containsLeftInstanceOf(Parent::class.java)
4949
}
5050

5151
@Test
52-
fun `should fail if either contains other type on left than required`() {
52+
internal fun `should fail if either contains other type on left than required`() {
5353
val actual: Either<String, Nothing> = "something".left()
5454
Assertions.assertThatThrownBy {
5555
assertThat(actual).containsLeftInstanceOf(Int::class.java)

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_containsOnLeft_Test.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,48 @@ import arrow.core.right
66
import `in`.rcard.assertj.arrowcore.errors.EitherShouldBeLeft.Companion.shouldBeLeft
77
import `in`.rcard.assertj.arrowcore.errors.EitherShouldContain.Companion.shouldContainOnLeft
88
import org.assertj.core.api.Assertions
9-
import org.assertj.core.util.FailureMessages.*
9+
import org.assertj.core.util.FailureMessages.actualIsNull
1010
import org.junit.jupiter.api.Test
1111

12-
class EitherAssert_containsOnLeft_Test {
12+
internal class EitherAssert_containsOnLeft_Test {
1313
@Test
14-
fun `should fail when either is null`() {
14+
internal fun `should fail when either is null`() {
1515
val leftValue: Either<String, Nothing>? = null
1616
Assertions.assertThatThrownBy {
1717
EitherAssert.assertThat(leftValue).containsOnLeft(
18-
"something"
18+
"something",
1919
)
2020
}
2121
.isInstanceOf(AssertionError::class.java)
2222
.hasMessage(actualIsNull())
2323
}
2424

2525
@Test
26-
fun `should pass if either contains expected value on left side`() {
26+
internal fun `should pass if either contains expected value on left side`() {
2727
val leftValue = "something".left()
2828
EitherAssert.assertThat(leftValue).containsOnLeft("something")
2929
}
3030

3131
@Test
32-
fun `should fail if either does not contain expected value on left side`() {
32+
internal fun `should fail if either does not contain expected value on left side`() {
3333
val actual: Either<String, Nothing> = "something".left()
3434
val expectedValue = "nothing"
3535
Assertions.assertThatThrownBy {
3636
EitherAssert.assertThat(actual).containsOnLeft(
37-
expectedValue
37+
expectedValue,
3838
)
3939
}
4040
.isInstanceOf(AssertionError::class.java)
4141
.hasMessage(shouldContainOnLeft(actual, expectedValue).create())
4242
}
4343

4444
@Test
45-
fun `should fail if either is right`() {
45+
internal fun `should fail if either is right`() {
4646
val actual: Either<String, String> = "nothing".right()
4747
val expectedValue = "something"
4848
Assertions.assertThatThrownBy {
4949
EitherAssert.assertThat(actual).containsOnLeft(
50-
expectedValue
50+
expectedValue,
5151
)
5252
}
5353
.isInstanceOf(AssertionError::class.java)

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_containsOnRightInstanceOf_Test.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import org.assertj.core.api.Assertions
1010
import org.assertj.core.util.FailureMessages
1111
import org.junit.jupiter.api.Test
1212

13-
class EitherAssert_containsOnRightInstanceOf_Test {
13+
internal class EitherAssert_containsOnRightInstanceOf_Test {
1414

1515
@Test
16-
fun `should fail if either is null`() {
16+
internal fun `should fail if either is null`() {
1717
val actual: Either<Nothing, Nothing>? = null
1818
Assertions.assertThatThrownBy {
1919
assertThat(actual).containsRightInstanceOf(Any::class.java)
@@ -23,7 +23,7 @@ class EitherAssert_containsOnRightInstanceOf_Test {
2323
}
2424

2525
@Test
26-
fun `should fail if either is left`() {
26+
internal fun `should fail if either is left`() {
2727
val actual: Either<String, Nothing> = "some".left()
2828
Assertions.assertThatThrownBy {
2929
assertThat(actual).containsRightInstanceOf(Any::class.java)
@@ -33,7 +33,7 @@ class EitherAssert_containsOnRightInstanceOf_Test {
3333
}
3434

3535
@Test
36-
fun should_fail_if_either_contains_other_type_on_right_than_required() {
36+
internal fun should_fail_if_either_contains_other_type_on_right_than_required() {
3737
val actual: Either<Any, Int> = 42.right()
3838
Assertions.assertThatThrownBy {
3939
assertThat(actual).containsRightInstanceOf(String::class.java)
@@ -49,13 +49,13 @@ class EitherAssert_containsOnRightInstanceOf_Test {
4949
}
5050

5151
@Test
52-
fun `should pass if either contains required type subclass on right`() {
52+
internal fun `should pass if either contains required type subclass on right`() {
5353
val actual = Child().right()
5454
assertThat(actual).containsRightInstanceOf(Parent::class.java)
5555
}
5656

5757
@Test
58-
fun `should pass if either contains required type on right`() {
58+
internal fun `should pass if either contains required type on right`() {
5959
val actual: Either<Nothing, String> = "something".right()
6060
assertThat(actual).containsRightInstanceOf(String::class.java)
6161
}

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_containsOnRight_Test.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,43 @@ import org.assertj.core.api.Assertions
99
import org.assertj.core.util.FailureMessages.actualIsNull
1010
import org.junit.jupiter.api.Test
1111

12-
class EitherAssert_containsOnRight_Test {
12+
internal class EitherAssert_containsOnRight_Test {
1313
@Test
14-
fun `should fail when either is null`() {
14+
internal fun `should fail when either is null`() {
1515
val rightValue: Either<Nothing, String>? = null
1616
Assertions.assertThatThrownBy {
1717
EitherAssert.assertThat(rightValue).containsOnRight(
18-
"something"
18+
"something",
1919
)
2020
}
2121
.isInstanceOf(AssertionError::class.java)
2222
.hasMessage(actualIsNull())
2323
}
2424

2525
@Test
26-
fun `should pass if either contains expected value on right side`() {
26+
internal fun `should pass if either contains expected value on right side`() {
2727
val rightValue = "something".right()
2828
EitherAssert.assertThat(rightValue).containsOnRight("something")
2929
}
3030

3131
@Test
32-
fun should_fail_if_either_is_left() {
32+
internal fun should_fail_if_either_is_left() {
3333
val actual: Either<String, String> = "nothing".left()
3434
val expectedValue = "something"
35-
Assertions.assertThatThrownBy { EitherAssert.assertThat(actual).containsOnRight(expectedValue) }
35+
Assertions.assertThatThrownBy {
36+
EitherAssert.assertThat(actual).containsOnRight(expectedValue)
37+
}
3638
.isInstanceOf(AssertionError::class.java)
3739
.hasMessage(shouldBeRight(actual).create())
3840
}
3941

4042
@Test
41-
fun `should fail if either does not contain expected value on right side`() {
43+
internal fun `should fail if either does not contain expected value on right side`() {
4244
val actual: Either<Nothing, String> = "something".right()
4345
val expectedValue = "nothing"
44-
Assertions.assertThatThrownBy { EitherAssert.assertThat(actual).containsOnRight(expectedValue) }
46+
Assertions.assertThatThrownBy {
47+
EitherAssert.assertThat(actual).containsOnRight(expectedValue)
48+
}
4549
.isInstanceOf(AssertionError::class.java)
4650
.hasMessage(shouldContainOnRight(actual, expectedValue).create())
4751
}

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_isLeft_Test.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import org.assertj.core.api.Assertions
88
import org.assertj.core.util.FailureMessages
99
import org.junit.jupiter.api.Test
1010

11-
class EitherAssert_isLeft_Test {
11+
internal class EitherAssert_isLeft_Test {
1212

1313
@Test
14-
fun `should fail if either is null`() {
14+
internal fun `should fail if either is null`() {
1515
// GIVEN
1616
val leftValue: Either<Nothing, Nothing>? = null
1717
// WHEN/THEN
@@ -21,15 +21,15 @@ class EitherAssert_isLeft_Test {
2121
}
2222

2323
@Test
24-
fun `should pass if either is left`() {
24+
internal fun `should pass if either is left`() {
2525
// GIVEN
2626
val leftValue = "Error".left()
2727
// WHEN/THEN
2828
EitherAssert.assertThat(leftValue).isLeft()
2929
}
3030

3131
@Test
32-
fun `should fail if either is right`() {
32+
internal fun `should fail if either is right`() {
3333
// GIVEN
3434
val rightValue = 42.right()
3535
// WHEN/THEN

src/test/kotlin/in/rcard/assertj/arrowcore/EitherAssert_isRight_Test.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import org.assertj.core.api.Assertions
88
import org.assertj.core.util.FailureMessages.actualIsNull
99
import org.junit.jupiter.api.Test
1010

11-
class EitherAssert_isRight_Test {
11+
internal class EitherAssert_isRight_Test {
1212

1313
@Test
14-
fun `should fail if either is null`() {
14+
internal fun `should fail if either is null`() {
1515
// GIVEN
1616
val rightValue: Either<Nothing, Nothing>? = null
1717
// WHEN/THEN
@@ -21,15 +21,15 @@ class EitherAssert_isRight_Test {
2121
}
2222

2323
@Test
24-
fun `should pass if either is right`() {
24+
internal fun `should pass if either is right`() {
2525
// GIVEN
2626
val rightValue = 42.right()
2727
// WHEN/THEN
2828
EitherAssert.assertThat(rightValue).isRight()
2929
}
3030

3131
@Test
32-
fun `should fail if either is left`() {
32+
internal fun `should fail if either is left`() {
3333
// GIVEN
3434
val leftValue = "42".left()
3535
// WHEN/THEN

src/test/kotlin/in/rcard/assertj/arrowcore/OptionAssert_assertThat_Test.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import arrow.core.some
55
import org.assertj.core.api.BDDAssertions.then
66
import org.junit.jupiter.api.Test
77

8-
class OptionAssert_assertThat_Test {
8+
internal class OptionAssert_assertThat_Test {
99

1010
@Test
11-
fun `should create an assertion instance when given object is not null`() {
11+
internal fun `should create an assertion instance when given object is not null`() {
1212
// GIVEN
1313
val someValue = 42.some()
1414
// WHEN
@@ -18,7 +18,7 @@ class OptionAssert_assertThat_Test {
1818
}
1919

2020
@Test
21-
fun `should create an assertion instance when given object is null`() {
21+
internal fun `should create an assertion instance when given object is null`() {
2222
// GIVEN
2323
val someNullValue: Option<Nothing>? = null
2424
// WHEN

src/test/kotlin/in/rcard/assertj/arrowcore/OptionAssert_isDefined_Test.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ import org.assertj.core.api.Assertions
99
import org.assertj.core.util.FailureMessages.actualIsNull
1010
import org.junit.jupiter.api.Test
1111

12-
class OptionAssert_isDefined_Test {
12+
internal class OptionAssert_isDefined_Test {
1313
@Test
14-
fun `should pass when Option is present`() {
14+
internal fun `should pass when Option is present`() {
1515
assertThat("present".some()).isDefined()
1616
}
1717

1818
@Test
19-
fun `should fail when Option is empty`() {
19+
internal fun `should fail when Option is empty`() {
2020
Assertions.assertThatThrownBy { assertThat(None).isDefined() }
2121
.isInstanceOf(AssertionError::class.java)
2222
.hasMessage(shouldBePresent().create())
2323
}
2424

2525
@Test
26-
fun `should fail when Option is null`() {
26+
internal fun `should fail when Option is null`() {
2727
val nullOption: Option<Nothing>? = null
2828
Assertions.assertThatThrownBy { assertThat(nullOption).isDefined() }
2929
.isInstanceOf(AssertionError::class.java)

0 commit comments

Comments
 (0)