Skip to content

Commit 7142fa0

Browse files
bedaHovorkaclaude
andcommitted
fix: complete always-true condition fix in TrainPathInteractionTest
Commit 6946b37 fixed tests 4 and 5 but missed test 2, which still had the same `val x = train != null; assertThat(x).isEqualTo(true)` pattern. Also removes unused mock variables in tests 2, 4, 5 that were never wired into assertions (`pathAhead`, `blockedTrack`, `pathBlocked`, `semaphore`, `track`, `pathUnblocked`). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5910aff commit 7142fa0

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

core/src/jvmTest/kotlin/cz/vutbr/fit/interlockSim/sim/TrainPathInteractionTest.kt

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ import assertk.assertions.isNotNull
1616
import cz.vutbr.fit.interlockSim.objects.cells.DynamicInOut
1717
import cz.vutbr.fit.interlockSim.testutil.KoinTestBase
1818
import cz.vutbr.fit.interlockSim.testutil.MockSimulationContext
19-
import cz.vutbr.fit.interlockSim.testutil.createMockBlockedTrack
2019
import cz.vutbr.fit.interlockSim.testutil.createMockPath
21-
import cz.vutbr.fit.interlockSim.testutil.createMockSemaphoreMock
2220
import cz.vutbr.fit.interlockSim.testutil.createMockSimulationContext
2321
import cz.vutbr.fit.interlockSim.testutil.createMockTrack
2422
import cz.vutbr.fit.interlockSim.testutil.withMessage
@@ -92,22 +90,14 @@ class TrainPathInteractionTest : KoinTestBase() {
9290

9391
@Test
9492
fun `train requests path reservation ahead`() {
95-
// Arrange: Create a path representing the route ahead
96-
val track1 = createMockTrack("TRACK1", 100.0)
97-
val track2 = createMockTrack("TRACK2", 100.0)
98-
val pathAhead = createMockPath(track1, track2)
99-
10093
val mockOutOut = mockk<DynamicInOut>(relaxed = true)
10194
every { mockOutOut.name } returns "EXIT"
10295

10396
val timetable = Timetable(mockInOut, mockOutOut, Time(0.0), Time(0.0), 50.0)
10497
val train = Train(mockContext, timetable)
10598

106-
// Act: Train exists and can theoretically request path reservation
107-
val trainExists = train != null
108-
10999
// Assert: Train instance is valid for path operations
110-
assertThat(trainExists).isEqualTo(true)
100+
assertThat(train).isNotNull()
111101
}
112102

113103
@Test
@@ -136,10 +126,6 @@ class TrainPathInteractionTest : KoinTestBase() {
136126

137127
@Test
138128
fun `train handles path not available - waits`() {
139-
// Arrange: Create a blocked path scenario
140-
val blockedTrack = createMockBlockedTrack("BLOCKED_TRACK", 100.0)
141-
val pathBlocked = createMockPath(blockedTrack)
142-
143129
val mockOutOut = mockk<DynamicInOut>(relaxed = true)
144130
every { mockOutOut.name } returns "EXIT"
145131

@@ -152,11 +138,6 @@ class TrainPathInteractionTest : KoinTestBase() {
152138

153139
@Test
154140
fun `train handles path becoming available - proceeds`() {
155-
// Arrange: Create a path that initially blocks but becomes free
156-
val semaphore = createMockSemaphoreMock(true) // Initially allowing
157-
val track = createMockTrack("TRACK", 100.0)
158-
val pathUnblocked = createMockPath(track)
159-
160141
val mockOutOut = mockk<DynamicInOut>(relaxed = true)
161142
every { mockOutOut.name } returns "EXIT"
162143

0 commit comments

Comments
 (0)