Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs =================================================================== diff -u -r15ba57d868f00dfd3d6b52ac2e03a202d47d0303 -r03fa491ac6713c77d10987a9ba1d0776dfdf82e9 --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs (.../IStochasticSoilModelTransformer.cs) (revision 15ba57d868f00dfd3d6b52ac2e03a202d47d0303) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/IStochasticSoilModelTransformer.cs (.../IStochasticSoilModelTransformer.cs) (revision 03fa491ac6713c77d10987a9ba1d0776dfdf82e9) @@ -35,9 +35,7 @@ /// stochastic soil model of type . /// /// The stochastic soil model to use in the transformation. - /// A new based on the given data, or null when - /// is not of a type that can be transformed to - /// the mechanism specific . + /// A new based on the given data. /// Thrown when transformation would not result /// in a valid transformed instance. T Transform(StochasticSoilModel stochasticSoilModel); Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs =================================================================== diff -u -r15ba57d868f00dfd3d6b52ac2e03a202d47d0303 -r03fa491ac6713c77d10987a9ba1d0776dfdf82e9 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision 15ba57d868f00dfd3d6b52ac2e03a202d47d0303) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingStochasticSoilModelTransformer.cs (.../PipingStochasticSoilModelTransformer.cs) (revision 03fa491ac6713c77d10987a9ba1d0776dfdf82e9) @@ -39,7 +39,8 @@ { if (stochasticSoilModel.FailureMechanismType != FailureMechanismType.Piping) { - return null; + throw new ImportedDataTransformException($"Stochastic soil model of failure mechanism type '{stochasticSoilModel.FailureMechanismType}' is not supported." + + $"Only '{FailureMechanismType.Piping}' is supported."); } IEnumerable pipingStochasticSoilProfiles = TransformStochasticSoilProfiles(stochasticSoilModel.StochasticSoilProfiles); Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs =================================================================== diff -u -r15ba57d868f00dfd3d6b52ac2e03a202d47d0303 -r03fa491ac6713c77d10987a9ba1d0776dfdf82e9 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision 15ba57d868f00dfd3d6b52ac2e03a202d47d0303) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision 03fa491ac6713c77d10987a9ba1d0776dfdf82e9) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; using Ringtoets.Piping.Data.SoilProfile; @@ -45,17 +46,19 @@ [Test] [TestCaseSource(nameof(InvalidFailureMechanismTypes))] - public void Transform_InvalidFailureMechanismType_ReturnsNull(FailureMechanismType failureMechanismType) + public void Transform_InvalidFailureMechanismType_ThrowsImportedDataTransformException(FailureMechanismType failureMechanismType) { // Setup var transformer = new PipingStochasticSoilModelTransformer(); var soilModel = new StochasticSoilModel("some name", failureMechanismType); // Call - PipingStochasticSoilModel transformed = transformer.Transform(soilModel); + TestDelegate test = () => transformer.Transform(soilModel); // Assert - Assert.IsNull(transformed); + var exception = Assert.Throws(test); + Assert.AreEqual($"Stochastic soil model of failure mechanism type '{failureMechanismType}' is not supported." + + $"Only '{FailureMechanismType.Piping}' is supported.", exception.Message); } private static IEnumerable InvalidFailureMechanismTypes()