<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to mock environment properties for unit testing ? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322179#M9180</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;You can create your own Feature class by extending SimpleFeature (https://github.com/nuxeo/nuxeo/blob/master/nuxeo-runtime/nuxeo-runtime-test/src/main/java/org/nuxeo/runtime/test/runner/SimpleFeature.java)&lt;/P&gt;
&lt;P&gt;In this class you have several hooks in which you can set your own properties.&lt;/P&gt;
&lt;P&gt;After that, juste reference your feature class in the @Features() annotations.&lt;/P&gt;
&lt;P&gt;To do some factorizations, you can also annotate your Feature class by @Features and @Deploy annotations, allowing you to define a ready to user Feature for your app. This will prevent you from using for instance @Features({CoreFeature.class, MyFeature.class}). Then all your test classes will just use @Features(MyFeature.class), minimizing the rework in case your setup changes.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Sep 2015 15:19:42 GMT</pubDate>
    <dc:creator>Damien_Metzler</dc:creator>
    <dc:date>2015-09-18T15:19:42Z</dc:date>
    <item>
      <title>How to mock environment properties for unit testing ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322178#M9179</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to unit test a class where properties are accessed via the Framework.getProperties("key") method.&lt;/P&gt;
&lt;P&gt;I don't know how to make this properties available in my class under test without having a running server.&lt;/P&gt;
&lt;P&gt;I gess the answer is related to what is called features in the documentation but a dummy example of what has to be done would really help.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2015 14:53:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322178#M9179</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-09-18T14:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to mock environment properties for unit testing ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322179#M9180</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;You can create your own Feature class by extending SimpleFeature (https://github.com/nuxeo/nuxeo/blob/master/nuxeo-runtime/nuxeo-runtime-test/src/main/java/org/nuxeo/runtime/test/runner/SimpleFeature.java)&lt;/P&gt;
&lt;P&gt;In this class you have several hooks in which you can set your own properties.&lt;/P&gt;
&lt;P&gt;After that, juste reference your feature class in the @Features() annotations.&lt;/P&gt;
&lt;P&gt;To do some factorizations, you can also annotate your Feature class by @Features and @Deploy annotations, allowing you to define a ready to user Feature for your app. This will prevent you from using for instance @Features({CoreFeature.class, MyFeature.class}). Then all your test classes will just use @Features(MyFeature.class), minimizing the rework in case your setup changes.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2015 15:19:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322179#M9180</guid>
      <dc:creator>Damien_Metzler</dc:creator>
      <dc:date>2015-09-18T15:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to mock environment properties for unit testing ?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322180#M9181</link>
      <description>&lt;P&gt;It works, thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 13:50:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-mock-environment-properties-for-unit-testing/m-p/322180#M9181</guid>
      <dc:creator>Antoine_Cordier</dc:creator>
      <dc:date>2015-09-23T13:50:13Z</dc:date>
    </item>
  </channel>
</rss>

