diff --git a/tests/modules/testUrQMD.cpp b/tests/modules/testUrQMD.cpp
index da788b797ffc8785b2fdf0275075d33d28b1abc8..0f9f4a86243ec0f7f5b0c16e989b9459a5e0a293 100644
--- a/tests/modules/testUrQMD.cpp
+++ b/tests/modules/testUrQMD.cpp
@@ -164,29 +164,42 @@ TEST_CASE("UrQMD") {
   }
 
   SECTION("\"special\" projectile and target") {
-    auto [env, csPtr, nodePtr] = setup::testing::setup_environment(Code::Proton);
-    [[maybe_unused]] auto const& env_dummy = env;      // against warnings
-    [[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
+    {
+      auto [env, csPtr, nodePtr] = setup::testing::setup_environment(Code::Proton);
+      [[maybe_unused]] auto const& env_dummy = env;      // against warnings
+      [[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
+
+      auto [stackPtr, secViewPtr] = setup::testing::setup_stack(
+          Code::PiPlus, 0, 0, 40_GeV, (setup::Environment::BaseNodeType* const)nodePtr,
+          *csPtr);
+      CHECK_THROWS(urqmd.doInteraction(*secViewPtr)); // Code::Proton not a valid target
+    }
 
-    auto [stackPtr, secViewPtr] = setup::testing::setup_stack(
-        Code::PiPlus, 0, 0, 40_GeV, (setup::Environment::BaseNodeType* const)nodePtr,
-        *csPtr);
-    CHECK(stackPtr->getEntries() == 1);
-    CHECK(secViewPtr->getEntries() == 0);
+    {
+      auto [env, csPtr, nodePtr] = setup::testing::setup_environment(Code::Oxygen);
+      [[maybe_unused]] auto const& env_dummy = env;      // against warnings
+      [[maybe_unused]] auto const& node_dummy = nodePtr; // against warnings
 
-    // must be assigned to variable, cannot be used as rvalue?!
-    auto projectile = secViewPtr->getProjectile();
-    auto const projectileMomentum = projectile.getMomentum();
+      auto [stackPtr, secViewPtr] = setup::testing::setup_stack(
+          Code::PiPlus, 0, 0, 40_GeV, (setup::Environment::BaseNodeType* const)nodePtr,
+          *csPtr);
+      CHECK(stackPtr->getEntries() == 1);
+      CHECK(secViewPtr->getEntries() == 0);
 
-    urqmd.doInteraction(*secViewPtr);
+      // must be assigned to variable, cannot be used as rvalue?!
+      auto projectile = secViewPtr->getProjectile();
+      auto const projectileMomentum = projectile.getMomentum();
 
-    CHECK(sumCharge(*secViewPtr) ==
-          get_charge_number(Code::PiPlus) + get_charge_number(Code::Oxygen));
+      urqmd.doInteraction(*secViewPtr);
 
-    auto const secMomSum =
-        sumMomentum(*secViewPtr, projectileMomentum.getCoordinateSystem());
-    CHECK((secMomSum - projectileMomentum).getNorm() / projectileMomentum.getNorm() ==
-          Approx(0).margin(1e-2));
+      CHECK(sumCharge(*secViewPtr) ==
+            get_charge_number(Code::PiPlus) + get_charge_number(Code::Oxygen));
+
+      auto const secMomSum =
+          sumMomentum(*secViewPtr, projectileMomentum.getCoordinateSystem());
+      CHECK((secMomSum - projectileMomentum).getNorm() / projectileMomentum.getNorm() ==
+            Approx(0).margin(1e-2));
+    }
   }
 
   SECTION("K0Long projectile") {