Adding corrent end-of-trajectory behavior with unit tests