private void bindByProductErrorTest(String msg) throws Exception { try { String[] pids = {"prod1", "prod2", "prod3"}; Map<String, ValidationResult> fakeResult = new HashMap<String, ValidationResult>(); fakeResult.put("blah", fakeOutResult(msg)); EntitlementRefusedException ere = new EntitlementRefusedException(fakeResult); AutobindData data = AutobindData.create(consumer).forProducts(pids); when(pm.entitleByProducts(data)).thenThrow(ere); entitler.bindByProducts(data); } catch (EntitlementRefusedException e) { fail(msg + ": threw unexpected error"); } }