### Question:
FixedLossPlusRollingBallTrajectory extends ABallTrajectory { public static FixedLossPlusRollingBallTrajectory fromState(final IVector3 posNow, final IVector3 velNow, final double spin, final FixedLossPlusRollingParameters params) { double pz1 = posNow.z(); double vz1 = velNow.z(); double g = G; IVector3 a = Vector3.fromXYZ(0, 0, -g); double tInAir = -(SumatraMath.sqrt((vz1 * vz1) + (2.0 * g * pz1)) - vz1) / g; double vKickZ = SumatraMath.sqrt((vz1 * vz1) + (2.0 * g * pz1)); IVector3 kickPos = posNow.addNew(velNow.multiplyNew(tInAir)).addNew(a.multiplyNew(0.5 * tInAir * tInAir)); IVector3 kickVel = Vector3.from2d(velNow.getXYVector(), vKickZ); return new FixedLossPlusRollingBallTrajectory(kickPos, kickVel, -tInAir, spin, params); } protected  FixedLossPlusRollingBallTrajectory(final IVector3 kickPos, final IVector3 kickVel, final double tKickToNow,
			final double initialSpin, final FixedLossPlusRollingParameters params); static FixedLossPlusRollingBallTrajectory fromKick(final IVector2 kickPos, final IVector3 kickVel,
			final double spin, final FixedLossPlusRollingParameters params); static FixedLossPlusRollingBallTrajectory fromState(final IVector3 posNow, final IVector3 velNow,
			final double spin, final FixedLossPlusRollingParameters params); @Override BallTrajectoryState getMilliStateAtTime(final double time); @Override PlanarCurve getPlanarCurve(); @Override double getTimeAtRest(); @Override ABallTrajectory mirrored(); @Override List<IVector2> getTouchdownLocations(); @Override ILineSegment getTravelLineRolling(); @Override List<ILineSegment> getTravelLinesInterceptable();  }### Answer:
@Test public void testGetPosByVel() { IVector finalPos = trajectory.getPosByVel(0); double tTotal = trajectory.getTimeByVel(0); double tStep = tTotal / 10; IBallTrajectory traj = trajectory; for (double t = 0; t <= tTotal; t += tStep) { IVector3 posNow = traj.getPosByTime(tStep).getXYZVector(); IVector3 velNow = traj.getVelByTime(tStep).multiplyNew(1000.0).getXYZVector(); double spin = traj.getSpinByTime(tStep); traj = FixedLossPlusRollingBallTrajectory.fromState(posNow, velNow, spin, params); IVector finalPosNew = traj.getPosByVel(0); assertTrue(finalPos.isCloseTo(finalPosNew, 1e-3)); } }