diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 521d4b38a09da92cf8f701969ad4bc1a64cf7ee1..a8d149bbb9a254d426da46bccbf37e857666187b 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -894,7 +894,11 @@ namespace MCTesting {
     ASSERT_TRUE( testLink1d < testLink2d );
 
     // Make links to another GenParticle from the first GenEvent
+#ifdef HEPMC3
     HepMC::ConstGenParticlePtr particle3 = ge1.particles().at(3);
+ #else
+    HepMC::ConstGenParticlePtr particle3 = HepMC::barcode_to_particle(&ge1, 4);
+#endif
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
     HepMcParticleLink testLink3a(particle3,dummyIndex1,