<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Can a unit test access model MDFs? - Developer Network Q&amp;A				            </title>
            <link>https://community.onenetwork.com/sdk-forum/can-a-unit-test-access-model-mdfs/</link>
            <description>BY Network Community Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Sat, 14 Mar 2026 16:40:05 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Can a unit test access model MDFs?</title>
                        <link>https://community.onenetwork.com/sdk-forum/can-a-unit-test-access-model-mdfs/#post-11669</link>
                        <pubDate>Tue, 05 Aug 2025 16:20:39 +0000</pubDate>
                        <description><![CDATA[I have a unit test (AbstractUnitTest) that is using a model object to get and set values to a field of type Float. The purpose of the test is to validate that certain values can be set on th...]]></description>
                        <content:encoded><![CDATA[<p>I have a unit test (AbstractUnitTest) that is using a model object to get and set values to a field of type Float. The purpose of the test is to validate that certain values can be set on that field without losing precision.</p>
<p>The model field is defined as a MDFs and when calling getMDFs(), we get the following RuntimeException:</p>
<pre contenteditable="false"> Testcase: testFloatField took 1.468 sec
     Caused an ERROR
 java.lang.reflect.InvocationTargetException
 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
     at com.onenetwork.platform.common.Model.getMDFs(Model.java:552)
     at com.onenetwork.platform.common.Model.getMDFs(Model.java:561)
     at com.onenetwork.test.unit.ItemUnitTest.testFloatField(ItemUnitTest.java:13)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 Caused by: java.lang.reflect.InvocationTargetException
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at com.onenetwork.platform.common.Model.getMDFs(Model.java:549)
 Caused by: java.lang.NullPointerException: Cannot invoke "com.transcendsys.platform.base.bo.helper.LevelMappingHelper.getMapping()" because "lvlHelper" is null
     at com.transcendsys.platform.base.bo.helper.ModelHelper.getMDFs(ModelHelper.java:74)</pre>
<p>Example of the getMDFs() call:</p>
<pre contenteditable="false">Item actual = new Item();
ItemMDFs actualTestMdfs = actual.getMDFs(com.onenetwork.test.model.ItemMDFs.class);</pre>
<p>The test is not expected to write data to the database and we are just using the model object field to store data. The same test works when implemented as a server test (AbstractServerTest).</p>
<p>Is it possible to use the model class and get its MDFs in a unit test or is the server required for getting the MDFs class?</p>]]></content:encoded>
						                            <category domain="https://community.onenetwork.com/sdk-forum/">Developer Network Q&amp;A</category>                        <dc:creator>Matthew Le</dc:creator>
                        <guid isPermaLink="true">https://community.onenetwork.com/sdk-forum/can-a-unit-test-access-model-mdfs/#post-11669</guid>
                    </item>
							        </channel>
        </rss>
		