Skip to content

Instantly share code, notes, and snippets.

@RafaRuiz
Created January 12, 2018 18:53
Show Gist options
  • Save RafaRuiz/86673226f30605bf2ed1ced979355bb9 to your computer and use it in GitHub Desktop.
Save RafaRuiz/86673226f30605bf2ed1ced979355bb9 to your computer and use it in GitHub Desktop.
RectangleModel Tests Weak Accesses
@RunWith(Parameterized::class)
class RectangleModelTestWeakAccesses {
@JvmField
@Parameterized.Parameter(0)
var o1: Point? = null
@JvmField
@Parameterized.Parameter(1)
var o2: Point? = null
@JvmField
@Parameterized.Parameter(2)
var expected: Boolean = false
companion object {
@JvmStatic
@Parameterized.Parameters
fun data(): MutableList<Array<out Any?>>? {
return Arrays.asList(
arrayOf(
Point(0, 0),
Point(0, 0),
false),
arrayOf(
Point(0, 0),
Point(1, 1),
true),
arrayOf(
Point(0, 0),
Point(0, 1),
false),
arrayOf(
Point(0, 0),
Point(1, 0),
false),
arrayOf(
Point(0, 1),
Point(2, 2),
true)
)
}
}
@Test
fun isRectangleWellFormulated() {
val isWellFormulated = o2!!.x > o1!!.x && o2!!.y > o1!!.y
Assert.assertEquals(isWellFormulated, expected)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment