<commit_before>/*******************************************************************************
 * Copyright (c) 2007 Innoopract Informationssysteme GmbH
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Innoopract - initial API and implementation
 *******************************************************************************/
package org.eclipse.epp.packaging.core.configuration;

import junit.framework.Assert;
import junit.framework.TestCase;

/** Test class */
public class CommandLineParser_Test extends TestCase {

  public void testParsesConfigFile() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml"} ); //$NON-NLS-1$
    Assert.assertEquals( "eclipsepackager.xml", command.getConfigurationFile().getName() ); //$NON-NLS-1$
  }

  public void testDefaultTasks() {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml"} ); //$NON-NLS-1$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
    Assert.assertTrue( command.mustDo( Task.BUILD ) );
  }

  public void testParsesTasks() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml", "check", "install"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
  }

  public void testParsesAllTasks() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml", "check", "install", "build"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
    Assert.assertTrue( command.mustDo( Task.BUILD ) );
  }

  public void testBadArgumentType() throws Exception {
    try {
      ArgumentParser.parse( Boolean.TRUE );
      fail();
    } catch( IllegalArgumentException e ) {
      // expected exception
    }
  }
}<commit_msg>update due to new IApplication interface<commit_after>/*******************************************************************************
 * Copyright (c) 2007 Innoopract Informationssysteme GmbH
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Innoopract - initial API and implementation
 *******************************************************************************/
package org.eclipse.epp.packaging.core.configuration;

import junit.framework.Assert;
import junit.framework.TestCase;

/** Test class */
public class CommandLineParser_Test extends TestCase {

  public void testParsesConfigFile() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml"} ); //$NON-NLS-1$
    Assert.assertEquals( "eclipsepackager.xml", command.getConfigurationFile().getName() ); //$NON-NLS-1$
  }

  public void testDefaultTasks() {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml"} ); //$NON-NLS-1$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
    Assert.assertTrue( command.mustDo( Task.BUILD ) );
  }

  public void testParsesTasks() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml", "check", "install"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
  }

  public void testParsesAllTasks() throws Exception {
    ICommands command = ArgumentParser.parse( new String[]{
      "eclipsepackager.xml", "check", "install", "build"} ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    Assert.assertTrue( command.mustDo( Task.CHECK ) );
    Assert.assertTrue( command.mustDo( Task.INSTALL ) );
    Assert.assertTrue( command.mustDo( Task.BUILD ) );
  }

  public void testBadArgumentType() throws Exception {
    try {
      ArgumentParser.parse( null );
      fail();
    } catch( IllegalArgumentException e ) {
      // expected exception
    }
  }
}
{'fraction_non_alphanumeric': 0.19369665134602757, 'fraction_numerical': 0.007879185817465528, 'mean_word_length': 3.96199782844734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2022244', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1283, 'n_words': 313}