Package org.osmorc.frameworkintegration

Source Code of org.osmorc.frameworkintegration.LibraryBundlificationRuleTest

package org.osmorc.frameworkintegration;

import org.jetbrains.osgi.jps.model.LibraryBundlificationRule;
import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class LibraryBundlificationRuleTest {
  @Test
  public void testEqual() throws Exception {
    LibraryBundlificationRule rule1 = new LibraryBundlificationRule();
    LibraryBundlificationRule rule2 = new LibraryBundlificationRule();
    assertTrue(rule1.equals(rule2));

    rule1.setRuleRegex(".+\\.jar");
    rule2.setRuleRegex(".+\\.zip");
    assertFalse(rule1.equals(rule2));
  }

  @Test
  public void testValidation() throws Exception {
    LibraryBundlificationRule rule = new LibraryBundlificationRule();
    rule.validate();

    rule.setRuleRegex("lib[Jj");
    try {
      rule.validate();
      fail();
    }
    catch (IllegalArgumentException e) { }

    rule.setRuleRegex(".*");
    rule.setAdditionalProperties("\\u1wtf");
    try {
      rule.validate();
      fail();
    }
    catch (IllegalArgumentException e) { }
  }
}
TOP

Related Classes of org.osmorc.frameworkintegration.LibraryBundlificationRuleTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.