コード例 #1
0
ファイル: EntitlerTest.java プロジェクト: candlepin/candlepin
 @Test(expected = BadRequestException.class)
 public void nullPool() throws EntitlementRefusedException {
   String poolid = "foo";
   Consumer c = TestUtil.createConsumer(); // keeps me from casting null
   Map<String, Integer> pQs = new HashMap<String, Integer>();
   pQs.put(poolid, 1);
   when(cc.findByUuid(eq(c.getUuid()))).thenReturn(c);
   when(pm.entitleByPools(eq(c), eq(pQs))).thenThrow(new IllegalArgumentException());
   entitler.bindByPoolQuantities(c.getUuid(), pQs);
 }
コード例 #2
0
ファイル: EntitlerTest.java プロジェクト: candlepin/candlepin
  @Test
  public void bindByPoolString() throws EntitlementRefusedException {
    String poolid = "pool10";
    Entitlement ent = mock(Entitlement.class);
    List<Entitlement> eList = new ArrayList<Entitlement>();
    eList.add(ent);
    when(cc.findByUuid(eq("abcd1234"))).thenReturn(consumer);

    Map<String, Integer> pQs = new HashMap<String, Integer>();
    pQs.put(poolid, 1);

    when(pm.entitleByPools(eq(consumer), eq(pQs))).thenReturn(eList);

    List<Entitlement> ents = entitler.bindByPoolQuantities("abcd1234", pQs);
    assertNotNull(ents);
    assertEquals(ent, ents.get(0));
  }