Skip to content

Instantly share code, notes, and snippets.

@RafaRuiz
Created January 12, 2018 18:49
Show Gist options
  • Save RafaRuiz/da9407e67f26ca33e1637b2132f9c316 to your computer and use it in GitHub Desktop.
Save RafaRuiz/da9407e67f26ca33e1637b2132f9c316 to your computer and use it in GitHub Desktop.
RectangleModel Tests Constructor Based
@RunWith(Parameterized::class)
class RectangleModelTestConstructorBased constructor(
private val o1: Point,
private val o2: Point,
private val expected: Boolean) {
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