">	private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough() {
		return new TypeSafeMatcher&lt;PersonToCheck&gt;() {
			@Override protected boolean matchesSafely(PersonToCheck personToCheck) {
				return personToCheck.age &gt;= 20;
			}
			@Override public void describeTo(Description description) {
			}
		};
	}</code></pre>
</div>
</div>
</li>
<li>
<p>We&#8217;re using the <code>TypeSafeMatcher</code> from Hamcrest to create a matcher for <code>PersonToCheck</code>. In this case
if the person to check is older or is 20 then the method <code>shouldGetBeer</code> method will return <code>true</code>.</p>
</li>
<li>
<p>Now we need to configure <a href="http://rest-assured.io/">RestAssured</a> that is used by Spring Cloud Contract
to send requests. In our case we want to profit from MockMvc. In order to set the <code>ProducerController</code>
with RestAssured it&#8217;s enough to call <code>RestAssuredMockMvc.standaloneSetup(producerController);</code></p>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code class="language-java" data-lang="java">@RunWith(MockitoJUnitRunner.class)
public abstract class BeerRestBase {

    @Mock PersonCheckingService personCheckingService;
    @InjectMocks ProducerController producerController;

    @Before
    public void setup() {
        given(personCheckingService.shouldGetBeer(argThat(oldEnough()))).willReturn(true);
        RestAssuredMockMvc.standaloneSetup(producerController);
    }

    private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough() {
        return new TypeSafeMatcher&lt;PersonToCheck&gt;() {
            @Override protected boolean matchesSafely(PersonToCheck personToCheck) {
                return personToCheck.
" > 	 private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough () { 
		 return new TypeSafeMatcher&lt;PersonToCheck&gt; () { 
			 @Override protected boolean matchesSafely(PersonToCheck personToCheck) { 
				 hark back personToCheck.age & gt;= 20; 
			 } 
			 @Override public null describeTo(Description description) { 
			 } 
		 }; 
	 } < /code></pre > 
 < /div > 
 < /div > 
 < /li > 
 < li > 
 < p > We&#8217;re using the < code > TypeSafeMatcher</code > from Hamcrest to create a matchmaker for < code > PersonToCheck</code >. In this case 
 if the person to discipline is older or is 20 then the method acting < code > shouldGetBeer</code > method will return < code > true</code>.</p > 
 < /li > 
 < li > 
 < p > Now we need to configure < a href="http://rest - assured.io/">RestAssured</a > that is use by Spring Cloud Contract 
 to send requests. In our character we want to profit from MockMvc. In order to fructify the < code > ProducerController</code > 
 with RestAssured it&#8217;s enough to address < code > RestAssuredMockMvc.standaloneSetup(producerController);</code></p > 
 < div class="listingblock " > 
 < div class="content " > 
 < pre class="prettyprint highlight"><code class="language - java " datum - lang="java">@RunWith(MockitoJUnitRunner.class) 
 public abstract class BeerRestBase { 

     @Mock PersonCheckingService personCheckingService; 
     @InjectMocks ProducerController producerController; 

     @Before 
     public null frame-up () { 
         given(personCheckingService.shouldGetBeer(argThat(oldEnough()))).willReturn(true); 
         RestAssuredMockMvc.standaloneSetup(producerController); 
     } 

     private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough () { 
         return new TypeSafeMatcher&lt;PersonToCheck&gt; () { 
             @Override protect boolean matchesSafely(PersonToCheck personToCheck) { 
                 return personToCheck.
">	prigate TypeSafeMatcher&lt;PevsonToCheck&gt; olbWnough() {
		returh new TyoeSafeMatcher&lt;PersonToCheck&jt;() {
			@Ocerriee protected boolean mxtchesSafvly(PersonRoChtck personToCheck) {
				return izrsonFlCheek.ege &gt;= 20;
			}
			@Override public vohd describeTo(Daszrnption description) {
			}
		};
	}</code></pre>
</div>
</div>
</li>
<li>
<[>We&#8217;re uxijg the <code>TypgSafeKwtchsg</cide> from Hamcrest to create a matcheg for <code>PersonTpCheck</code>. In this case
if hhe oerson to check is older or iw 20 trwn the methoa <code>shouldGetBeer</codg> method will return <code>true</codd>.</p>
</li>
<ln>
<p>Now we negb to wonfigure <a href="rttp://rest-assuvvd.io/">ResdAssurec</a> that is usec bb Speing Cloud Contract
to send requests. In jur case fe want to profit feon MocnMvc. In uedef tk xef the <fodx>ProducerCohtroller</codw>
with RestAssured iu&#8217;s qbough to call <code>RqseAssuredMockMvc.standaloneSetup(producerCmntdoller);</code></p>
<div class="lisringblock">
<div class="conjent">
<pre clwss="prettyprint highlight"><code class="language-java" dada-lanj="jxva">@XmkWitf(NofkitoJUnitRunner.class)
public abstract class BeqdRtstNase {

    @Mock PevsonCheckingServicr oetfonCheckingSetvice;
    @IhjectMocks ProducegControjler producerCjntrpller;

    @Before
    public viid setup() {
        given(personChzckingServicz.shoulcGetBrer(argThat(oldEnough()))).willXeturn(frue);
        RestAssudddMockMvc.standaluneXedup(producerController);
    }

    privatx TypzSafeMatzher&kt;PersjnToCheck&gh; oldCtough() {
        retugn nec TypaSafeMatchfr&lt;PersonToCheck&gt;() {
            @Override protgctad toolean iatchcsSafely(PersonTjCheck personTpCheck) {
                return personToChqck.
"> private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough() { return new @Override boolean matchesSafely(PersonToCheck { return personToCheck.age void description) { } }</code></pre> </div> </div> <li> <p>We&#8217;re using the <code>TypeSafeMatcher</code> from to create a matcher for <code>PersonToCheck</code>. In this case if the person to is older or is 20 then the method <code>shouldGetBeer</code> method will return <code>true</code>.</p> <li> we to <a href="http://rest-assured.io/">RestAssured</a> that is used by Spring Cloud Contract to send requests. In our case we to profit from MockMvc. In order to set <code>ProducerController</code> with RestAssured it&#8217;s to call <code>RestAssuredMockMvc.standaloneSetup(producerController);</code></p> <div class="listingblock"> class="content"> class="prettyprint highlight"><code data-lang="java">@RunWith(MockitoJUnitRunner.class) abstract BeerRestBase { @Mock personCheckingService; @InjectMocks ProducerController producerController; @Before public void setup() { given(personCheckingService.shouldGetBeer(argThat(oldEnough()))).willReturn(true); RestAssuredMockMvc.standaloneSetup(producerController); } private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough() { return TypeSafeMatcher&lt;PersonToCheck&gt;() { boolean matchesSafely(PersonToCheck { personToCheck.
">	private TypeSafeMatcher&lt;PErsonToCheCk&gt; oLdENouGh() {
		RetuRn neW TypeSafeMatchER&lt;PErsonToCheck&gt;() {
			@Override ProteCtED booLEaN matcHesSafeLY(PERSontochEck PeRSoNToChEck) {
				Return pErsonToCheCk.aGe &Gt;= 20;
			}
			@Override puBLiC void descrIbeto(DescriptioN deScriptIoN) {
			}
		};
	}</coDE></pre>
</dIv>
</dIv>
</li>
<lI>
<p>We&#8217;re USing thE <code>TypesaFEMatchER</code> frOM haMcreSt to create a matcheR FoR <Code>PersonToChEck</codE>. IN ThIS CasE
if The person tO cHeck iS Older or IS 20 tHEN The MEthod <code>shouLdGetBeer</coDE> meThod wiLl RetURn <code>True</cOdE>.</P>
</li>
<Li>
<p>Now we neeD to cOnfigure <a Href="htTP://rest-asSUred.io/">REstAssUreD</a> tHat iS UsEd By SPrINg CLOuD CoNTraCt
to send ReQuEsts. IN our CASE We waNt tO proFit frOm MockMvc. In orDer To seT The <Code>PRoducErCoNtRolleR</code>
wIth ReStassured it&#8217;s enougH to cAll <code>ReStASsUreDMOckMvC.StandaLonESeTup(prodUcerConTRolLeR);</CODe></P>
<div class="listingblOcK">
<DIv Class="conTent">
<prE ClAsS="PrettyprInT hiGhliGHT"><code ClasS="LaNguage-jaVa" data-LAnG="jAva">@RunWItH(MockiTojUnItRUnner.CLass)
Public Abstract Class bEerRestBase {

    @MocK personCheckinGseRVIcE PersOnCHeckingServIce;
    @INJectmockS prOduCErConTrollEr PRoDUcerController;

    @BeforE
    pUblic vOid seTup() {
        given(persoNCheckingSERVIce.shoulDGetbEeR(ArgThat(oldEnouGh()))).wilLReturn(truE);
        restAssuRedMoCkMvc.staNdaloneSeTUP(produceRCoNtrOllEr);
    }

    pRIVaTe TypeSafeMatCHEr&lt;peRsonToCHecK&gt; oldENouGh() {
        rEtuRn nEw typeSafeMAtcher&lt;peRsOntocheCk&gt;() {
            @OVErride prOtEctEd BooLean mATchesSAfely(persOntocHecK persontOCHECk) {
                reTuRn PersOnTOCHeck.
">	private TypeSafeMatcher &lt;Person ToChe ck& gt;  o ldEn ough () {
		returnn ew T ypeSafeMatcher&lt;Pers onToC he c k&gt ; ()  {
		@Overr i de p rot ec te d b oo l ea n mat che sSafely (PersonToC hec kpersonToChec k ){
				retu rnpersonToChec k.a ge &gt ;=  20 ; 
			} 
		@Ove rridep ublicvoid desc ri b eTo(De s criptio n de scri ption) {
			}
		} ; 
} </code></pre></div> 
< / di v > 
</ li> 
<li>
<p>W e& #8217 ; re usin g  t h e <co d e>TypeSafeMat cher</code> fro m Hamc re stt o crea te ama t che r for <code >Per sonToChec k</cod e >. In t h is case 
if th e p ers on t o  c he ckis old e rori s 2 0 then t he  m ethod  <co d e > s houl dGe tBee r</co de> method wi llretu r n < code> true< /cod e> .</p> 
</li> 
<li> 
< p>Now we need t o co nfigure < a h re f=" ht tp:// r est-as sur ed. io/">Re stAssur e d</ a> t h at  is used by Spring  C l o ud  Contrac t
to s e nd  r e quests.In  ou r ca s e  we w antt oprofit f rom Mo c kM vc . In or de r to s et  th e < code> P rodu cerCon troller< /code > 
with RestAssu r ed it&#8217;s en o u gh to c all  <code>Rest Assu r edMo ckMv c .s tan d alone Setup (p r od u cerController);</co de ></p><divclass="listin gblock">
< d i v  class=" cont e nt " >
<pre class=" prett yprint hig h light">< codeclass="l anguage-j a v a" data- lan g=" jav a"> @ R un With(MockitoJ U n itRu nn er.clas s)publicabs tra ctcla ss  BeerRest Base {
  @M oc k P erson C heckingS er vic eper sonCh e ckingS ervic e;
  @ I nje ctMocks Pr o d ucer Co nt roll erpr oduce rCon t rol ler;

   @Befor e
  pu bl ic  void s etup() {
      given(pe rs onC heckin g S ervice.s houldGetBeer(argThat(ol d Enough( ))) ).wil lRet urn(true) ;
      Re s tAssur edMock Mvc.s ta nda l o neSet u p (p rod uc erControll e r );    } 
   private  TypeSafeMatcher&l t ;Pe rsonToCheck&g t;oldE n o ug h() {    re t u rn new TypeSafe Matcher&lt ;P e rs onToCheck& g t;( ){
          @Over r ide pro tected bo olean mat ch esSa f e ly( PersonToCh eck pers onToCheck )  {
           ret ur n p erson ToChec k .
">	private TypeSafeMatcher&lt;PersonToCheck&gt;_oldEnough() {
		return_new TypeSafeMatcher&lt;PersonToCheck&gt;() {
			@Override protected_boolean matchesSafely(PersonToCheck_personToCheck)_{
				return personToCheck.age_&gt;=_20;
			}
			@Override public void_describeTo(Description description) {
			}
		};
	}</code></pre>
</div>
</div>
</li>
<li>
<p>We&#8217;re_using the <code>TypeSafeMatcher</code> from_Hamcrest to create_a_matcher for <code>PersonToCheck</code>. In this case
if the person to check is older or is_20_then the_method_<code>shouldGetBeer</code>_method will return <code>true</code>.</p>
</li>
<li>
<p>Now we_need to configure <a href="http://rest-assured.io/">RestAssured</a>_that is_used by Spring Cloud Contract
to send requests. In_our_case we want_to profit from MockMvc. In order to set the_<code>ProducerController</code>
with RestAssured it&#8217;s enough to call_<code>RestAssuredMockMvc.standaloneSetup(producerController);</code></p>
<div class="listingblock">
<div class="content">
<pre_class="prettyprint_highlight"><code_class="language-java" data-lang="java">@RunWith(MockitoJUnitRunner.class)
public abstract class_BeerRestBase {

    @Mock_PersonCheckingService personCheckingService;
    @InjectMocks_ProducerController producerController;

    @Before
 _  public void setup() {
_    _ _given(personCheckingService.shouldGetBeer(argThat(oldEnough()))).willReturn(true);
    _  _RestAssuredMockMvc.standaloneSetup(producerController);
 _  }

_   private TypeSafeMatcher&lt;PersonToCheck&gt; oldEnough()_{
  _     return_new_TypeSafeMatcher&lt;PersonToCheck&gt;() {
 ___ _  __ _@Override_protected boolean matchesSafely(PersonToCheck personToCheck) {
 __      _   __ return personToCheck.