public void testAddRequestArgs_syncStops() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_SYNC_STOPS, proxy);
   requestItem.params = new Vector();
   Address address = new Address();
   Stop stop = new Stop();
   stop.setCity("EAST BOSTON");
   stop.setCity("US");
   stop.setProvince("MA");
   address.setStop(stop);
   Vector addresses = new Vector();
   addresses.add(address);
   FavoriteCatalog favoriteCatalog = new FavoriteCatalog();
   favoriteCatalog.setName("sports");
   Vector categories = new Vector();
   Vector receivedAddresses = new Vector();
   categories.add(favoriteCatalog);
   requestItem.params.add(0, 131712312L);
   requestItem.params.add(1, addresses);
   requestItem.params.add(2, addresses);
   requestItem.params.add(3, categories);
   requestItem.params.add(4, receivedAddresses);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (Exception e) {
     fail(e.toString());
   }
   ProtocolBuffer pb = (ProtocolBuffer) requestVector.get(0);
   assertEquals(1, requestVector.size());
   //        Assert.assertArrayEquals(synStops_data, pb.getBufferData());
   assertEquals(IServerProxyConstants.ACT_SYNC_STOPS, pb.getObjType());
 }
 public void testAddRequestArgs_fetchAllStops() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_FETCH_ALL_STOPS, proxy);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (Exception e) {
     fail(e.toString());
   }
   ProtocolBuffer pb = (ProtocolBuffer) requestVector.get(0);
   assertEquals(1, requestVector.size());
   assertEquals(IServerProxyConstants.ACT_FETCH_ALL_STOPS, pb.getObjType());
 }
 public void testParseRequestSpecificData_syncStops() {
   ProtoBufAddressProxy mockProxy =
       PowerMock.createPartialMock(ProtoBufAddressProxy.class, "parseSyncStops");
   ProtocolBuffer protocolBuffer = new ProtocolBuffer();
   protocolBuffer.setBufferData(synStops_resp);
   protocolBuffer.setObjType(IServerProxyConstants.ACT_SYNC_STOPS);
   try {
     PowerMock.expectPrivate(
         mockProxy, "parseSyncStops", EasyMock.anyObject(ProtoCacheCitiesResp.class));
   } catch (Exception e1) {
     fail(e1.toString());
   }
   EasyMock.expectLastCall().once();
   PowerMock.replay(mockProxy);
   try {
     mockProxy.parseRequestSpecificData(protocolBuffer);
   } catch (IOException e) {
     fail(e.toString());
   }
   PowerMock.verify(mockProxy);
 }
 public void testAddRequestArgs_syncStops_exception_nullParames() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_SYNC_STOPS, proxy);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (IllegalArgumentException e) {
     illegalArgumentException = e;
   } catch (Exception e) {
     fail(e.toString());
   } finally {
     assertNotNull(illegalArgumentException);
   }
 }
 public void testParseRequestSpecificData_fetchAllStops() {
   ProtoBufAddressProxy mockProxy =
       PowerMock.createPartialMock(ProtoBufAddressProxy.class, "parseFetchAllInThread");
   ProtocolBuffer protocolBuffer = new ProtocolBuffer();
   protocolBuffer.setBufferData(fetchAllStops_resp);
   protocolBuffer.setObjType(IServerProxyConstants.ACT_FETCH_ALL_STOPS);
   Whitebox.setInternalState(mockProxy, "isParseFetchAllInThread", true);
   try {
     PowerMock.expectPrivate(
         mockProxy, "parseFetchAllInThread", EasyMock.anyObject(ProtoCacheCitiesResp.class));
   } catch (Exception e1) {
     fail(e1.toString());
   }
   EasyMock.expectLastCall().once();
   PowerMock.replay(mockProxy);
   try {
     mockProxy.parseRequestSpecificData(protocolBuffer);
   } catch (IOException e) {
     fail(e.toString());
   }
   PowerMock.verify(mockProxy);
 }
 public void testAddRequestArgs_cacheCities() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_CACHE_CITIES, proxy);
   requestItem.params = new Vector();
   requestItem.params.add(0, 34.05348);
   requestItem.params.add(1, -118.24532);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (Exception e) {
     fail(e.toString());
   }
   ProtocolBuffer pb = (ProtocolBuffer) requestVector.get(0);
   assertEquals(1, requestVector.size());
   Assert.assertArrayEquals(cacheCities_data, pb.getBufferData());
   assertEquals(IServerProxyConstants.ACT_CACHE_CITIES, pb.getObjType());
 }
 public void testAddRequestArgs_syncStops_exception_lessParames() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_SYNC_STOPS, proxy);
   requestItem.params = new Vector();
   Address address = new Address();
   Stop stop = new Stop();
   stop.setCity("EAST BOSTON");
   stop.setCity("US");
   stop.setProvince("MA");
   address.setStop(stop);
   Vector addresses = new Vector();
   addresses.add(address);
   requestItem.params.add(0, 131712312L);
   requestItem.params.add(1, addresses);
   requestItem.params.add(2, addresses);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (IllegalArgumentException e) {
     illegalArgumentException = e;
   } catch (Exception e) {
     fail(e.toString());
   } finally {
     assertNotNull(illegalArgumentException);
   }
 }