Commit 373740b7 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

adapted tests -- could also remove reflection again

parent 5233957e
Pipeline #146863 failed with stages
in 16 minutes and 32 seconds
......@@ -54,19 +54,12 @@ public class PedestrianListBuilder {
public PedestrianListBuilder add(int id, VTrajectory trajectory){
Pedestrian p = new Pedestrian(new AttributesAgent(id), new Random());
Class<?> pclass = p.getClass();
// Use reflection to set the trajectory forcefully (this bypasses a
// "public setTrajectory" method in Pedestrian.class)
// Fails if the trajectory attribute is renamed:
Field trajectoryField = pclass.getDeclaredField("trajectory");
trajectoryField.setAccessible(true); // trajectory is private --> we set it to accessible here
trajectoryField.set(p, trajectory);
}catch (NoSuchFieldException | IllegalAccessException ex){
for(FootStep fs : trajectory){
return this;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment