我當前正在嘗試模擬DateTime對象,以便可以攔截它並使其每次在測試中創建一個新的DateTime對象時創建一個常量(預定的)DateTime對象。眼下 DateTime start = new LocalDateTime().toDateTime().minusHours(1) DateTime end = new LocalDateTime().toDateTime() ,我嘲諷LocalD
我試圖測試服務類(負責調用庫層,如果需要做一些操作),基本上,這是我想要測試 class CarServiceImpl{
public Car findById(String id){
//call repository layer to find a car
}
public void deleteById(String id){
Car
我試圖捕獲在輸入傳遞到與PowerMockito模擬對象的參數,這是代碼: //I create a mock object
ClassMocked mock = PowerMockito.mock(ClassMocked.class);
//Create the captor that will capture the String passed in input to the mock