ThirdPartyTMSSmartling implements ThirdPartyTMS { long batchesFor(long totalUnits) { return totalUnits / batchSize + ((totalUnits % batchSize == 0) ? 0 : 1); } @Autowired  ThirdPartyTMSSmartling(SmartlingClient smartlingClient,
                                  TextUnitSearcher textUnitSearcher,
                                  AssetPathAndTextUnitNameKeys assetPathAndTextUnitNameKeys,
                                  TextUnitBatchImporterService textUnitBatchImporterService,
                                  SmartlingResultProcessor resultProcessor);  ThirdPartyTMSSmartling(SmartlingClient smartlingClient,
                                  TextUnitSearcher textUnitSearcher,
                                  AssetPathAndTextUnitNameKeys assetPathAndTextUnitNameKeys,
                                  TextUnitBatchImporterService textUnitBatchImporterService,
                                  SmartlingResultProcessor resultProcessor,
                                  int batchSize); @Override ThirdPartyTMSImage uploadImage(String projectId, String name, byte[] content); @Override List<ThirdPartyTextUnit> getThirdPartyTextUnits(Repository repository, String projectId); @Override void createImageToTextUnitMappings(String projectId, List<ThirdPartyImageToTextUnit> thirdPartyImageToTextUnits); @Override void push(Repository repository,
                     String projectId,
                     String pluralSeparator,
                     String skipTextUnitsWithPattern,
                     String skipAssetsWithPathPattern,
                     List<String> optionList); @Override void pull(Repository repository,
                     String projectId,
                     String pluralSeparator,
                     Map<String, String> localeMapping,
                     String skipTextUnitsWithPattern,
                     String skipAssetsWithPathPattern,
                     List<String> optionList); @Override void pushTranslations(Repository repository,
                                 String projectId,
                                 String pluralSeparator,
                                 Map<String, String> localeMapping,
                                 String skipTextUnitsWithPattern,
                                 String skipAssetsWithPathPattern,
                                 List<String> optionList);  }
@Test public void testBatchesFor(){ tmsSmartling = new ThirdPartyTMSSmartling(smartlingClient, textUnitSearcher, assetPathAndTextUnitNameKeys, mockTextUnitBatchImporterService, resultProcessor, 3); assertThat(tmsSmartling.batchesFor(0)).isEqualTo(0); assertThat(tmsSmartling.batchesFor(1)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(2)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(3)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(5)).isEqualTo(2); assertThat(tmsSmartling.batchesFor(6)).isEqualTo(2); assertThat(tmsSmartling.batchesFor(13)).isEqualTo(5); assertThat(tmsSmartling.batchesFor(32)).isEqualTo(11); tmsSmartling = new ThirdPartyTMSSmartling(smartlingClient, textUnitSearcher, assetPathAndTextUnitNameKeys, mockTextUnitBatchImporterService, resultProcessor, 35); assertThat(tmsSmartling.batchesFor(0)).isEqualTo(0); assertThat(tmsSmartling.batchesFor(1)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(2)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(34)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(72)).isEqualTo(3); assertThat(tmsSmartling.batchesFor(290)).isEqualTo(9); tmsSmartling = new ThirdPartyTMSSmartling(smartlingClient, textUnitSearcher, assetPathAndTextUnitNameKeys, mockTextUnitBatchImporterService, resultProcessor, 4231); assertThat(tmsSmartling.batchesFor(0)).isEqualTo(0); assertThat(tmsSmartling.batchesFor(1)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(2)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(2900)).isEqualTo(1); assertThat(tmsSmartling.batchesFor(21156)).isEqualTo(6); }