运行JUnit时,RestController不接受JSON

时间:2018-08-17 14:19:45

标签: spring junit mocking

我使用的是Spring 4.0.7,并且我试图在muApp中使用MockMVC进行测试,但是当运行时,总是会出现以下异常:

attr_accessor

我看到测试正在运行时,控制器不接受(Accept)json(当我将应用程序放入容器中时,一切正常):

<?php
{

 global $woocommerce;   
 $targeted_id = 523;


 foreach ( WC()-&gt;cart-&gt;get_cart() as $cart_item ) 
 { 
  if($cart_item['product_id'] == $targeted_id )
  {
    $qty =  $cart_item['quantity'];
    break;
    }         

   }

  if ( $qty &gt; 0 )
  {  

    ?> <button 
    onclick="location.href='http://noespecadotiendagourmet.com/paso-3/'" 
    type="button">
    PASO SIGUIENTE</button> <?php


    }
   else
   {

    ?> <button 
    onclick="location.href='http://noespecadotiendagourmet.com/paso-3/'" 
    type="button" disabled> PASO SIGUIENTE</button> <?php         

    }




   ?> 

0 个答案:

没有答案