/** Tests DTO population method. */
  @Test
  public void testPopulateDto() {
    final RuleElement mockRuleElement = context.mock(RuleElement.class);

    context.checking(
        new Expectations() {
          {
            oneOf(mockRuleElement).getType();
            will(returnValue(RuleElementType.CART_N_FREE_SKUS_ACTION.getPropertyKey()));
            oneOf(mockRuleElement).getParameters();
            oneOf(mockRuleElement).getExceptions();
          }
        });

    ActionDTO target = new ActionDTO();
    actionAdapter.populateDTO(mockRuleElement, target);

    assertEquals(RuleElementType.CART_N_FREE_SKUS_ACTION.getPropertyKey(), target.getType());
  }
  /** Tests domain population method. */
  @Test
  public void testPopulateDomain() {
    final RuleElement mockRuleElement = context.mock(RuleElement.class);
    ActionDTO source = new ActionDTO();
    source.setType(RuleElementType.CART_ANY_SKU_AMOUNT_DISCOUNT_ACTION.getPropertyKey());
    source.setParameters(null);
    source.setExceptions(null);

    context.checking(
        new Expectations() {
          {
            oneOf(mockRuleElement)
                .setType(
                    with(
                        same(
                            RuleElementType.CART_ANY_SKU_AMOUNT_DISCOUNT_ACTION.getPropertyKey())));
            oneOf(mockRuleElement).setParameters(null);
            oneOf(mockRuleElement).setExceptions(null);
          }
        });

    actionAdapter.populateDomain(source, mockRuleElement);
  }