【发布时间】:2021-04-26 20:54:40
【问题描述】:
Kotlin/JUnit 宣传使用反引号函数名称进行测试。我发现你也可以使用反引号的类名......
但我找不到任何参考。事物是 Kotlin 规范中的内容,还是只是“可能很快就会消失”的意外功能?
代码示例:
@Nested
inner class `when the entity path only specifies one location` {
@BeforeEach
fun setup() {
entity = Entity(
id = "entityid1",
name = "entity1",
type = "type",
team = TeamColor.BLUE,
currentLocation = Location(0.0, 10.0, 0.0),
path = EntityPath(
startTime = "00:00:00",
timeLocation = listOf(
TimeLocation("00:00:00", Location(0.0, 10.0, 0.0)),
)
),
)
}
@Test
fun `it returns the first (only) location`() {
val actualLocation = entityLocator.getEntityLocation(entity, calculation);
val expectedLocation = Location(0.0, 10.0, 0.0)
assertEquals(actualLocation, expectedLocation);
}
}
【问题讨论】:
-
那只包括方法名而不是类名@JoachimIsaksson?