![JAR search and dependency download from the Maven repository](/logo.png)
jvmTest.plot.builder.data.RingAssertion.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plot-builder-portable Show documentation
Show all versions of plot-builder-portable Show documentation
The Let-Plot Kotlin API depends on this artifact.
The newest version!
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.plot.builder.data
import jetbrains.datalore.base.algorithms.calculateArea
import jetbrains.datalore.base.geometry.DoubleVector
import org.assertj.core.api.AbstractAssert
import org.assertj.core.api.Assertions
class RingAssertion internal constructor(ring: List) : AbstractAssert>(ring, RingAssertion::class.java) {
val isClosed: RingAssertion
get() {
Assertions.assertThat(actual[0]).isEqualTo(actual[actual.size - 1])
return this
}
fun hasSize(expected: Int): RingAssertion {
Assertions.assertThat(actual).hasSize(expected)
return this
}
fun hasArea(expected: Double): RingAssertion {
return hasArea(expected, 0.001)
}
private fun hasArea(expected: Double, epsilon: Double): RingAssertion {
Assertions.assertThat(calculateArea(actual)).isEqualTo(expected, Assertions.offset(epsilon))
return this
}
companion object {
fun assertThatRing(ring: List): RingAssertion {
return RingAssertion(ring)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy