{"id":254936,"date":"2015-04-10T11:02:03","date_gmt":"2015-04-10T07:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=254936"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=254936","title":{"rendered":"PODAM Java \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f Unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f"},"content":{"rendered":"<p>     \t<img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/623\/4f8\/e63\/6234f8e633954d29bfbd53c7e9c4487f.jpg\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c!<br \/>  \u041f\u0440\u0438 unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0445 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u0433\u043b\u0443\u0448\u0435\u043a \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u2014 \u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 \u0442\u0435\u0441\u0442\u0430\u043c. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442 get-set \u043a\u043e\u043d\u0432\u0435\u043d\u0446\u0438\u0438 Java, \u0430 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0435\u0441\u0442\u044c, \u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0440\u043e\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0447\u0435\u043c \u0441\u0430\u043c \u0442\u0435\u0441\u0442. \u042d\u0442\u043e \u0430\u043d\u0442\u0438-\u043f\u0430\u0442\u0442\u0435\u0440\u043d <b><a href=\"http:\/\/qabok.com\/tdd-patterns-and-anti-patterns\/\">Excessive Setup<\/a><\/b>, \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 PODAM \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0438\u0434\u0435\u0438 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0439 \u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043a \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430\u043c\u0438 \u2014 \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043f\u043e\u0440\u043e\u044e\u0441\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445.<br \/>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u043b\u0433\u043e \u043d\u0435 \u0434\u0443\u043c\u0430\u0442\u044c, \u043d\u043e \u0438 \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043c\u0438\u0440\u043e\u043c \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0445, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0443. <a name=\"habracut\"><\/a>\u041f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u0443\u044e, \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>1. \u041c\u043e\u0434\u0435\u043b\u044c<\/h4>\n<p>  \u0421\u0442\u0440\u0430\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b \u0438 \u0433\u043e\u0440\u043e\u0434\u043e\u0432.<\/p>\n<pre><code class=\"java\">public class Country { \tprivate String name; \tprivate Currency currency; \tprivate List&lt;City&gt; cities;\t \t \tpublic Country() {\t\t \t\tsetCities(new ArrayList&lt;City&gt;()); \t} \t\/\/... \u0442\u0443\u0442 getters \u0438 setters } <\/code><\/pre>\n<p>  \u0413\u043e\u0440\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u043b\u0438\u0446:<\/p>\n<pre><code class=\"java\">public class City { \tprivate String name; \tprivate int population; \tprivate List&lt;Street&gt; streets;\t  \tpublic City(String name) { \t\tthis.name = name; \t} \t\/\/... \u0442\u0443\u0442 getters \u0438 setters } <\/code><\/pre>\n<p>  \u0423\u043b\u0438\u0446\u044b \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438<\/p>\n<pre><code class=\"java\">public class Street { \tprivate String name; \t \tpublic Street(String name) { \t\tthis.name = name; \t} \t\/\/... \u0442\u0443\u0442 getters \u0438 setters } <\/code><\/pre>\n<p>  \u0438 \u0432\u0430\u043b\u044e\u0442\u0430 (\u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 enum-\u0430\u043c\u0438 \u2014 \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0442\u0430\u043a \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0432\u0430\u043b\u044e\u0442\u0430\u043c\u0438 \ud83d\ude42 )<\/p>\n<pre><code class=\"java\">public enum Currency { \tRUB, \tEUR, \tUSD; } <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u043e\u0442\u043e\u0432\u0430. <\/p>\n<h4>2. \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 <\/h4>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0443 \u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044e \u0441\u0435\u0431\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u043c \u0441\u0432\u043e\u0439 RecursiveToStringStyle \u0432\u0437\u0430\u043c\u0435\u043d \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0443 Apache (commons-lang3-3.4.jar), \u0447\u0442\u043e\u0431\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ReflectionToStringBuilder \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PODAM \u0434\u0430\u043d\u043d\u044b\u0435.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 RecursiveToStringStyle<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">public class RecursiveToStringStyle extends ToStringStyle { \tprivate static final long serialVersionUID = 1L; \tprivate int offset;  \tpublic RecursiveToStringStyle() { \t\tthis(0); \t}  \tprivate RecursiveToStringStyle(int offset) { \t\tsetUseShortClassName(true); \t\tsetUseFieldNames(true); \t\tsetUseIdentityHashCode(false); \t\tthis.offset = offset; \t\tString off = &quot;&quot;; \t\tfor (int i = 0; i &lt; offset; i++) \t\t\toff += &quot;\\t&quot;; \t\tthis.setContentStart(&quot;[&quot;); \t\tthis.setFieldSeparator(SystemUtils.LINE_SEPARATOR + off + &quot;  &quot;); \t\tthis.setFieldSeparatorAtStart(true); \t\tthis.setContentEnd(SystemUtils.LINE_SEPARATOR + off + &quot;]&quot;); \t}  \tprotected void appendDetail(StringBuffer buffer, String fieldName, \t\t\tCollection&lt;?&gt; col) { \t\tbuffer.append('['); \t\tfor (Object obj : col) { \t\t\tbuffer.append(ReflectionToStringBuilder.toString(obj, \t\t\t\t\tnew RecursiveToStringStyle(offset + 1))); \t\t\tbuffer.append(','); \t\t} \t\tif (buffer.charAt(buffer.length() - 1) == ',') \t\t\tbuffer.setCharAt(buffer.length() - 1, ']'); \t}  \tprotected void appendDetail(StringBuffer buffer, String fieldName, \t\t\tObject value) { \t\tif (value instanceof String) { \t\t\tbuffer.append(&quot;\\&quot;&quot; + value.toString() + &quot;\\&quot;&quot;); \t\t} else if (value instanceof BigDecimal) { \t\t\tbuffer.append(value.getClass().getSimpleName() + &quot;[&quot; \t\t\t\t\t+ value.toString() + &quot;]&quot;); \t\t} else if (value instanceof BigInteger) { \t\t\tbuffer.append(value.getClass().getSimpleName() + &quot;[&quot; \t\t\t\t\t+ value.toString() + &quot;]&quot;); \t\t} else if (!value.getClass().getName().startsWith(&quot;java.lang.&quot;)) { \t\t\ttry { \t\t\t\tbuffer.append(ReflectionToStringBuilder.toString(value, \t\t\t\t\t\tnew RecursiveToStringStyle(offset + 1))); \t\t\t} catch (Throwable t) { \t\t\t} \t\t} else { \t\t\tsuper.appendDetail(buffer, fieldName, value); \t\t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>3. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f<\/h4>\n<p>  <\/p>\n<pre><code class=\"java\">public class CountryCreatorSimple { \tpublic static void main(String[] args) { \t\t\/** \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 *\/ \t\tPodamFactory factory = new PodamFactoryImpl(); \t\t\/** \u0413\u0435\u043d\u0435\u0440\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0443 *\/ \t\tCountry myPojo = factory.manufacturePojo(Country.class); \t\t\/** &quot;\u041f\u0435\u0447\u0430\u0442\u0430\u0435\u043c&quot; \u0441\u0442\u0440\u0430\u043d\u0443 *\/ \t\tSystem.out.println(ReflectionToStringBuilder.toString(myPojo,new RecursiveToStringStyle())); \t} } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432\u0441\u0451. \u0412 myPojo \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0430 \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0431\u0443\u043a\u043e\u0432, \u2014 \u0442\u0430\u043a \u0447\u0442\u043e \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u043e\u0433\u0443\u0442  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">Country[   name=&quot;2n_BNdJOpE&quot;   currency=Currency[ \t  name=&quot;USD&quot; \t  ordinal=2 \t]   cities=[City[ \t  name=&quot;7_BmoRTDab&quot; \t  population=-1863637717 \t  streets=[Street[ \t\t  name=&quot;XV_q7SPbvk&quot; \t\t],Street[ \t\t  name=&quot;GkNGKj6B9J&quot; \t\t],Street[ \t\t  name=&quot;y9GNakRAsW&quot; \t\t],Street[ \t\t  name=&quot;Mwo09nQx0R&quot; \t\t],Street[ \t\t  name=&quot;n4_EDMGNUR&quot; \t\t]] \t],City[ \t  name=&quot;1sifHwujvo&quot; \t  population=1832262487 \t  streets=[Street[ \t\t  name=&quot;xpZiJH2sce&quot; \t\t],Street[ \t\t  name=&quot;ns8DRJDi4e&quot; \t\t],Street[ \t\t  name=&quot;7Ijv_UVZrF&quot; \t\t],Street[ \t\t  name=&quot;CYruDEhe2M&quot; \t\t],Street[ \t\t  name=&quot;4HFzN0v5mc&quot; \t\t]] \t],City[ \t  name=&quot;qJlUWEPoxp&quot; \t  population=1979728140 \t  streets=[Street[ \t\t  name=&quot;_LbqmCPgWC&quot; \t\t],Street[ \t\t  name=&quot;yS6jX8vRqI&quot; \t\t],Street[ \t\t  name=&quot;yFysWkntdh&quot; \t\t],Street[ \t\t  name=&quot;RvP93uJphY&quot; \t\t],Street[ \t\t  name=&quot;WjARSGWfxB&quot; \t\t]] \t],City[ \t  name=&quot;W1J9mWpEFH&quot; \t  population=493149274 \t  streets=[Street[ \t\t  name=&quot;8bFRRbPmqO&quot; \t\t],Street[ \t\t  name=&quot;ORJ4rP1i41&quot; \t\t],Street[ \t\t  name=&quot;qD9XU0I0K2&quot; \t\t],Street[ \t\t  name=&quot;I75Wt5cK9v&quot; \t\t],Street[ \t\t  name=&quot;viT8t5FkPq&quot; \t\t]] \t],City[ \t  name=&quot;33cPIh6go9&quot; \t  population=693664641 \t  streets=[Street[ \t\t  name=&quot;kvPtj1GIL4&quot; \t\t],Street[ \t\t  name=&quot;aVv1taDA0j&quot; \t\t],Street[ \t\t  name=&quot;iQ6ZriwuZK&quot; \t\t],Street[ \t\t  name=&quot;fcf6JICEQ9&quot; \t\t],Street[ \t\t  name=&quot;1Pbdnc_7R6&quot; \t\t]] \t]] ] <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0435 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <i>\u00ab2n_BNdJOpE\u00bb<\/i> \u0438 \u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u043e\u0439 USD \u0435\u0441\u0442\u044c \u0433\u043e\u0440\u043e\u0434\u0430 \u0441 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438, \u043f\u043e\u0440\u043e\u0439 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0441 \u0443\u043b\u0438\u0446\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u0441\u043b\u0443\u0445. \u042d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0430 \u043a\u0440\u043e\u043b\u0438\u0447\u044c\u044f \u043d\u043e\u0440\u0430.<\/p>\n<h4>4. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h4>\n<p>  \u041d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 DataProviderStrategy, \u043d\u043e \u0442\u0430\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f 23 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f, \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438 \u0442.\u0434. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u0442\u044c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u0434\u0430\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442, \u043d\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0449\u0435 \u2014 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u0435 \u2014 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c RandomDataProviderStrategy, \u043d\u043e \u043e\u043d\u0430 public final class. \u0417\u0430\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 AbstractRandomDataProviderStrategy \u2014 BINGO. <br \/>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438.<\/p>\n<p>  \u0425\u043e\u0442\u0438\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<br \/>  1. \u041e\u0434\u0438\u043d \u0438\u043b\u0438 \u0434\u0432\u0430 \u0433\u043e\u0440\u043e\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0435 \u2014 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435. \u0410 \u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0441\u044f \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e \ud83d\ude42 <br \/>  \u041f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0435\u043c  <\/p>\n<pre><code class=\"java\">@Override public int getNumberOfCollectionElements(Class&lt;?&gt; type) <\/code><\/pre>\n<p>  2. \u0425\u043e\u0442\u0438\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0438 \u0443\u043b\u0438\u0446 \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0430 enum-\u0430 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u043c\u0438 \u043d\u0430\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<br \/>  \u041f\u043b\u044e\u0441 \u043f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0435\u043c  <\/p>\n<pre><code class=\"java\">@Override public String getStringValue(AttributeMetadata attributeMetadata) <\/code><\/pre>\n<p>  3. \u0425\u043e\u0442\u0438\u043c \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 \u2014 \u043d\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0434\u043e 10 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432.<br \/>  \u041f\u0435\u0440\u0435\u043a\u0440\u044b\u0432\u0430\u0435\u043c  <\/p>\n<pre><code class=\"java\">@Override public Integer getInteger(AttributeMetadata attributeMetadata) <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e AttributeMetadata \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0434\u0432\u0430 \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">attributeMetadata.getAttributeName() \/** \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f *\/ attributeMetadata.getPojoClass() \/** \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044d\u0442\u043e \u043f\u043e\u043b\u0435 *\/ <\/code><\/pre>\n<p>  \u041f\u043e\u043d\u0435\u0441\u043b\u0430\u0441\u044c (\u0432\u044b\u0431\u043e\u0440 \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0441\u043b\u0443\u0447\u0430\u0435\u043d, \u0432\u044b\u0431\u043e\u0440 \u0443\u043b\u0438\u0446 \u2014 \u043d\u0430\u0433\u0443\u0433\u043b\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0443\u043b\u0438\u0446 \u0432 \u041f\u0430\u0440\u0438\u0436\u0435 \u2014 \u0441\u043e\u0440\u0440\u0438 \u0437\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 enum \u2014 \u043d\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e):<\/p>\n<pre><code class=\"java\">public class CountryDataProviderStrategy extends \t\tAbstractRandomDataProviderStrategy { \tprivate static final Random random = new Random(System.currentTimeMillis());  \tpublic CountryDataProviderStrategy() { \t\tsuper(); \t}  \t@Override \tpublic String getStringValue(AttributeMetadata attributeMetadata) { \t\t\/** \t\t * \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 name, \u0442\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u043b\u0438\u0431\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0443\u043b\u0438\u0446\u0443, \u043b\u0438\u0431\u043e \t\t * \u0433\u043e\u0440\u043e\u0434, \u043b\u0438\u0431\u043e \u0441\u0442\u0440\u0430\u043d\u0443 \t\t *\/ \t\tif (&quot;name&quot;.equals(attributeMetadata.getAttributeName())) { \t\t\tif (Street.class.equals(attributeMetadata.getPojoClass())) { \t\t\t\treturn Streets.randomStreet(); \t\t\t} else if (City.class.equals(attributeMetadata.getPojoClass())) { \t\t\t\treturn Cities.randomCity(); \t\t\t} else if (Country.class.equals(attributeMetadata.getPojoClass())) { \t\t\t\treturn &quot;Podam States of Mockitia&quot;; \t\t\t} \t\t} \t\treturn super.getStringValue(attributeMetadata); \t};  \t@Override \tpublic int getNumberOfCollectionElements(Class&lt;?&gt; type) { \t\t\/** \t\t * \u0415\u0441\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u043e\u0440\u043e\u0434\u043e\u0432, \u0442\u043e \u0432\u0435\u0440\u043d\u0451\u043c \u0438\u043b\u0438 1 \u0438\u043b\u0438 2. \u0415\u0441\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u043b\u0438\u0446, \u0442\u043e \t\t * \u0432\u0435\u0440\u043d\u0451\u043c \u043e\u0442 1 \u0434\u043e 10 \t\t *\/ \t\tif (City.class.getName().equals(type.getName())) { \t\t\treturn 1 + random.nextInt(2); \t\t} else if (Street.class.getName().equals(type.getName())) { \t\t\treturn 1 + random.nextInt(10); \t\t} \t\treturn super.getNumberOfCollectionElements(type);  \t};  \t@Override \tpublic Integer getInteger(AttributeMetadata attributeMetadata) { \t\t\/** \u041d\u0443 \u0438 \u0432\u0435\u0440\u043d\u0451\u043c \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0435 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u0435 *\/ \t\tif (City.class.equals(attributeMetadata.getPojoClass())) { \t\t\tif (&quot;population&quot;.equals(attributeMetadata.getAttributeName())) { \t\t\t\treturn 1_000_000 + random.nextInt(9_000_000); \t\t\t} \t\t} \t\treturn super.getInteger(attributeMetadata); \t}  \tprivate enum Cities { \t\tMOSCOW, SAINT_PETERSBURG, LONDON, NEW_YORK, SHANGHAI, KARACHI, BEIJING, DELHI, PARIS, NAIROBI;  \t\tprivate static final List&lt;Cities&gt; values = Collections.unmodifiableList(Arrays.asList(values())); \t\tprivate static final int size = values.size(); \t\tprivate static final Random random = new Random();  \t\tpublic static String randomCity() { \t\t\treturn values.get(random.nextInt(size)).toString(); \t\t} \t}  \tprivate enum Streets { \t\tRUE_ABEL, RUE_AMPERE, AVENUE_PAUL_APPELL, BOULEVARD_ARAGO, JARDINS_ARAGO, SQUARE_ARAGO, RUE_ANTOINE_ARNAULD, SQUARE_ANTOINE_ARNAULD, RUE_BERNOULLI, RUE_BEZOUT, RUE_BIOT, RUE_BORDA, SQUARE_BOREL, RUE_CHARLES_BOSSUT, RUE_DE_BROGLIE, RUE_BUFFON, AVENUE_CARNOT, BOULEVARD_CARNOT, VILLA_SADI_CARNOT, RUE_CASSINI, RUE_CAUCHY, RUE_MICHEL_CHASLES, RUE_NICOLAS_CHUQUET, RUE_CLAIRAUT, RUE_CLAPEYRON, RUE_CONDORCET, RUE_CORIOLIS, RUE_COURNOT, RUE_GASTON_DARBOUX, RUE_DELAMBRE, SQUARE_DELAMBRE, RUE_DEPARCIEUX, RUE_DE_PRONY, RUE_DESARGUES, RUE_DESCARTES, RUE_ESCLANGON, RUE_EULER;  \t\tprivate static final List&lt;Streets&gt; values = Collections.unmodifiableList(Arrays.asList(values())); \t\tprivate static final int size = values.size(); \t\tprivate static final Random random = new Random();  \t\tpublic static String randomStreet() { \t\t\treturn values.get(random.nextInt(size)).toString(); \t\t} \t} } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0451 \u0432\u043e\u0435\u0434\u0438\u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"java\">public class CountryCreatotWithStrategy { \tpublic static void main(String[] args) { \t\t\/** \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u0430\u0448\u0443 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 *\/ \t\tDataProviderStrategy strategy = new CountryDataProviderStrategy(); \t\t\/** \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 *\/ \t\tPodamFactory factory = new PodamFactoryImpl(strategy); \t\t\/** \u0413\u0435\u043d\u0435\u0440\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0443 *\/ \t\tCountry myPojo = factory.manufacturePojo(Country.class); \t\t\/** \u041f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0443 *\/ \t\tSystem.out.println(ReflectionToStringBuilder.toString(myPojo,new RecursiveToStringStyle()));\t \t} } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435, \u0447\u0435\u043c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u0430:<\/p>\n<pre><code class=\"java\">Country[   name=&quot;Podam States of Mockitia&quot;   currency=Currency[ \t  name=&quot;RUB&quot; \t  ordinal=0 \t]   cities=[City[ \t  name=&quot;NAIROBI&quot; \t  population=9563403 \t  streets=[Street[ \t\t  name=&quot;RUE_BORDA&quot; \t\t],Street[ \t\t  name=&quot;RUE_DE_PRONY&quot; \t\t],Street[ \t\t  name=&quot;SQUARE_ANTOINE_ARNAULD&quot; \t\t],Street[ \t\t  name=&quot;RUE_CASSINI&quot; \t\t],Street[ \t\t  name=&quot;RUE_DE_PRONY&quot; \t\t]] \t],City[ \t  name=&quot;PARIS&quot; \t  population=7602177 \t  streets=[Street[ \t\t  name=&quot;RUE_DESCARTES&quot; \t\t],Street[ \t\t  name=&quot;RUE_CHARLES_BOSSUT&quot; \t\t]] \t]] ] <\/code><\/pre>\n<h4>5. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  1. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438  @PodamStrategyValue \u0441\u043d\u0430\u0431\u0436\u0430\u0442\u044c \u0441\u0430\u043c\u0438 \u043f\u043e\u043b\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 AttributeStrategy, \u0441\u043e\u0437\u0434\u0430\u0432 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0434\u043b\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u0433\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0447\u0443\u0434\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u043e \u2014 \u043d\u0430 <a href=\"http:\/\/home.btconnect.com\/jemosagile\/\/projects\/podam\/index.html\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a> \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432.<\/p>\n<p>  2. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0437\u0430\u0441\u0435\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u0430\u043a \u0431\u044b \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0438 \u0431\u044b\u043b\u043e \u2014 \u044f \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0443\u0441\u044c \u0438 \u0441\u043f\u043e\u0440\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e \u043e\u0431 \u043e\u0442\u043a\u0430\u0437\u0435 \u043e\u0442 \u0434\u0430\u0447\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u2014 PODAM \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 reflection, \u0430 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u043b\u044f\u043c \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0438 \u0434\u0430\u0436\u0435 \u043a \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430\u043c (\u0447\u0435\u0440\u0435\u0437 PODAM \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u043d\u043e reflection \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0431\u0435\u0440\u0451\u0442), \u0430 \u044d\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c, \u043d\u043e \u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0435\u0437\u0430\u043c\u0435\u043d\u0438\u043c\u043e \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  3. \u0426\u0435\u043b\u044c \u0431\u044b\u043b\u0430 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c <b><a href=\"http:\/\/qabok.com\/tdd-patterns-and-anti-patterns\/\">Excessive Setup<\/a><\/b> \u0430\u043d\u0442\u0438-\u043f\u0430\u0442\u0442\u0435\u0440\u043d. \u0414\u0443\u043c\u0430\u044e, \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u0410 \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 Mockito, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e, unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (\u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u043a\u0430\u043a \u0438 \u0437\u0430\u0433\u043b\u0443\u0448\u0435\u0447\u043d\u044b\u0435 \u043a\u0443\u0441\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e) \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u043c \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c.<\/p>\n<p>  4. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <a href=\"https:\/\/bitbucket.org\/franciscosuarez\/podamexample\/downloads\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 git-\u043e\u0432\u0443\u044e \u0440\u0435\u043f\u0443<\/a> \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/255425\/\"> http:\/\/habrahabr.ru\/post\/255425\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/623\/4f8\/e63\/6234f8e633954d29bfbd53c7e9c4487f.jpg\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c!<br \/>  \u041f\u0440\u0438 unit-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0445 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u0433\u043b\u0443\u0448\u0435\u043a \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u2014 \u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 \u0442\u0435\u0441\u0442\u0430\u043c. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442 get-set \u043a\u043e\u043d\u0432\u0435\u043d\u0446\u0438\u0438 Java, \u0430 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0435\u0441\u0442\u044c, \u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0440\u043e\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u0447\u0435\u043c \u0441\u0430\u043c \u0442\u0435\u0441\u0442. \u042d\u0442\u043e \u0430\u043d\u0442\u0438-\u043f\u0430\u0442\u0442\u0435\u0440\u043d <b><a href=\"http:\/\/qabok.com\/tdd-patterns-and-anti-patterns\/\">Excessive Setup<\/a><\/b>, \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 PODAM \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0438\u0434\u0435\u0438 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0439 \u0440\u0430\u043d\u0434\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0430\u043a \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430\u043c\u0438 \u2014 \u043f\u043e\u043a\u0430\u0436\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043f\u043e\u0440\u043e\u044e\u0441\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445.<br \/>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u043b\u0433\u043e \u043d\u0435 \u0434\u0443\u043c\u0430\u0442\u044c, \u043d\u043e \u0438 \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043c\u0438\u0440\u043e\u043c \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0445, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0443. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-254936","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254936"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254936\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}