### Question:
ShoppingCartServiceImpl extends AbstractDataUtilsServiceImpl implements ShoppingCartService { @Override public String serializeShoppingCartAsLoggedInUser(final FileShoppingCart fileShoppingCart, final String key) throws EmptyCartException, JargonException { log.info("serializeShoppingCartAsLoggedInUser()"); if (fileShoppingCart == null) { throw new IllegalArgumentException("null fileShoppingCart"); } if (key == null || key.isEmpty()) { throw new IllegalArgumentException("null or empty key"); } if (fileShoppingCart.getShoppingCartFileList().isEmpty()) { log.error("empty shopping cart"); throw new EmptyCartException("no cart to serialize"); } checkContracts(); log.info("fileShoppingCart:${}", fileShoppingCart); log.info("key:${}", key); CacheServiceConfiguration config = new CacheServiceConfiguration(); config.setDoCleanupDuringRequests(true); config.setCacheInHomeDir(true); log.info("create data cache service from factory"); DataCacheService dataCacheService = dataCacheServiceFactory.instanceNoEncryptDataCacheService(irodsAccount); dataCacheService.setCacheServiceConfiguration(config); log.info("putting data into cache"); return dataCacheService .putStringValueIntoCache(fileShoppingCart.serializeShoppingCartContentsToStringOneItemPerLine(), key); } ShoppingCartServiceImpl();  ShoppingCartServiceImpl(final IRODSAccessObjectFactory irodsAccessObjectFactory,
			final IRODSAccount irodsAccount, final DataCacheServiceFactory dataCacheServiceFactory); @Override String serializeShoppingCartAsLoggedInUser(final FileShoppingCart fileShoppingCart, final String key); @Override FileShoppingCart retreiveShoppingCartAsLoggedInUser(final String key); @Override String serializeShoppingCartAsSpecifiedUser(final FileShoppingCart fileShoppingCart, final String key,
			final String userName); @Override DataCacheServiceFactory getDataCacheServiceFactory(); @Override void setDataCacheServiceFactory(final DataCacheServiceFactory dataCacheServiceFactory); static final Logger log; }### Answer:
@Test public final void testSerializeShoppingCartAsLoggedInUser() throws Exception { String key = "key"; String expectedPath = "/a/path"; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); DataCacheServiceFactory dataCacheServiceFactory = new DataCacheServiceFactoryImpl( irodsFileSystem.getIRODSAccessObjectFactory()); ShoppingCartService shoppingCartService = new ShoppingCartServiceImpl( irodsFileSystem.getIRODSAccessObjectFactory(), irodsAccount, dataCacheServiceFactory); FileShoppingCart fileShoppingCart = FileShoppingCart.instance(); fileShoppingCart.addAnItem(ShoppingCartEntry.instance(expectedPath)); String actual = shoppingCartService.serializeShoppingCartAsLoggedInUser(fileShoppingCart, key); Assert.assertNotNull("null path returned, no serializing of cart", actual); }
@Test(expected = EmptyCartException.class) public final void testSerializeEmptyShoppingCartAsLoggedInUser() throws Exception { String key = "key"; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); DataCacheServiceFactory dataCacheServiceFactory = new DataCacheServiceFactoryImpl( irodsFileSystem.getIRODSAccessObjectFactory()); ShoppingCartService shoppingCartService = new ShoppingCartServiceImpl( irodsFileSystem.getIRODSAccessObjectFactory(), irodsAccount, dataCacheServiceFactory); FileShoppingCart fileShoppingCart = FileShoppingCart.instance(); shoppingCartService.serializeShoppingCartAsLoggedInUser(fileShoppingCart, key); }