????6????????????HTable??????????????????Mock Get???????get??????????????????????????????Result???????????????PowerMockito??when????shop_info.get(gtShopInfo)???HTable???????????????thenReturn????????????shop_info_result????


Get gtShopInfo = PowerMockito.mock(Get.class);
       PowerMockito.whenNew(Get.class)
              .withArguments("126:38934426".getBytes())
              .thenReturn(gtShopInfo);
       List<KeyValue> kv_shop_info = new ArrayList<KeyValue>();
       kv_shop_info.add(new KeyValue("126:38934426".getBytes()?? "sp_shop_info"
              .getBytes()?? "feature".getBytes()));
       Result shop_info_result = new Result(kv_shop_info);
       PowerMockito.when(shop_info.get(gtShopInfo)).thenReturn(shop_info_result);


????????????е?mock???ShopScanMap???????????Щ???????????????????????????

?????????????????????mock????main_process?????????????????


int r = map.mainProcess(mapOutPut?? fBmwShops?? shop_id?? timeBill_shop??
              timeBill_user);
       /**
       * ?????????????????????????mapOutPut??????
       */
       System.out.println(r);
       System.out.println(mapOutPut.toString());


????????????

???????????????????????????????????????????????????????????????????????к?????????

?????????????????????????????????????????????????????????????????????????????????????????????????ShopScanMap??do_seller?? do_prepay???????á?

?????????????????????????Σ???????????mock??????????????????????????????????????????????????????hadoop????????mock??????????й?mrunit????????ITest-hadoop??????????????????????map/reduce???棬??????????????????????????????????????????hadoop?????????MiniDFSCluster?? MiniMRCluster?? MiniHBaseCluster??????????????????????????????????????????壬????????????????????????????????????????????ITest-hadoop?????????????????????????????????????????????????????????÷?????

??????????????????ЩUT???·???????????????????????????????????

????????POM??????


<dependency>
           <groupId>org.mockito</groupId>
           <artifactId>mockito-all</artifactId>
           <version>1.8.5</version>
       </dependency>
       <dependency>
           <groupId>org.powermock</groupId>
           <artifactId>powermock-module-junit4</artifactId>
           <version>1.4.10</version>
       </dependency>
       <dependency>
           <groupId>org.powermock</groupId>
           <artifactId>powermock-api-mockito</artifactId>
           <version>1.4.10</version>
       </dependency>