public void test_CollectionLiteralExp_checkNoCollectionInstances() {
    CollectionLiteralExp cl = factory.createCollectionLiteralExp();
    cl.setKind(CollectionKind.COLLECTION_LITERAL);

    assertProblem(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__NO_COLLECTION_INSTANCES);

    cl.setKind(CollectionKind.BAG_LITERAL);

    assertOK(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__NO_COLLECTION_INSTANCES);
  }
  public void test_CollectionLiteralExp_checkElementType_emptySet() {
    CollectionLiteralExp cl = factory.createCollectionLiteralExp();
    cl.setKind(CollectionKind.SET_LITERAL);
    CollectionType ctype = factory.createSetType();
    ctype.setElementType(fruit);
    cl.setType(ctype);

    assertProblem(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__ELEMENT_TYPE);

    ctype.setElementType(getOCLStandardLibrary().getOclVoid());

    assertOK(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__ELEMENT_TYPE);
  }
  public void test_CollectionLiteralExp_checkBagKind() {
    CollectionLiteralExp cl = factory.createCollectionLiteralExp();
    cl.setKind(CollectionKind.COLLECTION_LITERAL);
    cl.setType(factory.createSetType());

    assertOK(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__BAG_KIND);

    cl.setKind(CollectionKind.BAG_LITERAL);

    assertProblem(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__BAG_KIND);

    cl.setType(factory.createBagType());

    assertOK(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__BAG_KIND);
  }
  public void test_CollectionItem_checkItemType() {
    CollectionItem i = factory.createCollectionItem();
    CollectionType ctype = factory.createCollectionType();
    ctype.setElementType(fruit);
    i.setType(ctype);

    CollectionLiteralExp item = factory.createCollectionLiteralExp();
    CollectionType itemType = factory.createCollectionType();
    itemType.setElementType(apple);
    item.setType(itemType);

    i.setItem(item);

    assertProblem(i, ExpressionsValidator.COLLECTION_ITEM__ITEM_TYPE);

    item.setType(ctype);

    assertOK(i, ExpressionsValidator.COLLECTION_ITEM__ITEM_TYPE);
  }
  public void test_CollectionLiteralExp_checkElementType() {
    CollectionLiteralExp cl = factory.createCollectionLiteralExp();
    cl.setKind(CollectionKind.SET_LITERAL);
    CollectionType ctype = factory.createSetType();
    ctype.setElementType(fruit);
    cl.setType(ctype);

    CollectionItem item1 = factory.createCollectionItem();
    item1.setType(apple);
    CollectionItem item2 = factory.createCollectionItem();
    item2.setType(color);

    cl.getPart().add(item1);
    cl.getPart().add(item2);

    assertProblem(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__ELEMENT_TYPE);

    item2.setType(fruit);

    assertOK(cl, ExpressionsValidator.COLLECTION_LITERAL_EXP__ELEMENT_TYPE);
  }