@Override public FareRules getFareRules(final int fareId, final String languageCode) { FareRules f= this.fareRulesDataProvider.getFareRules(fareId, languageCode);//fareRulesDataProvider被mock dataProvider.getFFMarketList("CX", "REV");//dataProvider没有被mock List<Fare> fares = fareDateProvider.getFareListByPromotionCode("aaa");//被mock fareRulesDataProvider.hashCode(); return f; }
也就是说该方法里面所有被mock的外部调用,它都访回thenReturn中设置的值。
PowerMockito.doReturn().when()与Mockito.when().thenReturn()的区别
原文地址:http://blog.csdn.net/fireofjava/article/details/42025353