Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 841159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:44:49+00:00 2026-05-15T05:44:49+00:00

main method: public static void main(String[] args) throws Exception { if (args.length != EXPECTED_NUMBER_OF_ARGUMENTS)

  • 0

main method:

 public static void main(String[] args) throws Exception
{
    if (args.length != EXPECTED_NUMBER_OF_ARGUMENTS)
    {
        System.err.println("Usage - java XFRCompiler ConfigXML PackageXML XFR");
    }

    String configXML = args[0];
    String packageXML = args[1];
    String xfr = args[2];

    AutoConfigCompiler compiler = new AutoConfigCompiler();
    compiler.setConfigDocument(loadDocument(configXML));
    compiler.setPackageInfoDoc(loadDocument(packageXML));
    // compiler.setVisiblityDoc(loadDocument("VisibilityFilter.xml"));
    compiler.compileModel(xfr);     

}

private static Document loadDocument(String fileName) throws Exception
{
    TXDOMParser parser = (TXDOMParser) ParserFactory.makeParser(TXDOMParser.class.getName());
    InputSource source = new InputSource(new FileInputStream(fileName));
    parser.parse(source);
    return parser.getDocument();  

}

testcase:

@Test
public void testCompileModel() throws Exception
{
  // construct parameters
  URL configFile =   Thread.currentThread().getContextClassLoader().getResource("Ford_2008_Mustang_Config.xml");
  URL packageFile = Thread.currentThread().getContextClassLoader().getResource("Ford_2008_Mustang_Package.xml");
  File tmpFile = new File("Ford_2008_Mustang_tmp.xfr");
  if(!tmpFile.exists()) {
     tmpFile.createNewFile();
  }

  String[] args = new     String[]{configFile.getPath(),packageFile.getPath(),tmpFile.getPath()};

  try {
    // test main method
    XFRCompiler.main(args);
  } catch (Exception e) {
    assertTrue(true);
  }
  try {
    // test args length is less than 3
    XFRCompiler.main(new String[]{"",""});
  } catch (Exception e) {  
    //ignore
  }
  tmpFile.delete(); 
}

Coverage outputs displayed as the lines from String configXML = args[0]; in main method
are not covered.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:44:50+00:00Added an answer on May 15, 2026 at 5:44 am
    • assertTrue(true); is a pointless no-op
    • Remove the try/catch around the call to XFRCompiler.main(args);, since all it does is swallow excpetions and make debugging harder; most likely you will then see an exception that tells you where the problem is.
    • There should be a call to fail() after the call to XFRCompiler.main(new String[]{"",""}); since you expect it to throw an exception
    • Put the two calls in separate test methods.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 529k
  • Answers 529k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As Joachim said, drop the protocol. If you read the… May 16, 2026 at 11:13 pm
  • Editorial Team
    Editorial Team added an answer Did you declare @property (retain) for wallText, did you do… May 16, 2026 at 11:13 pm
  • Editorial Team
    Editorial Team added an answer Based on your EDIT above, I think you might be… May 16, 2026 at 11:13 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Consider an object declared in a method: public void foo() { final Object obj
An error occurred at line: 9 in the jsp file: /Test1.jsp The method addURL(String,
I have the following code class sample { public void update(List l) { l
I'm writing a compiler that generates Jasmin code and want to invoke a method
This is a continuation of the post How does one access a method from
I have main thread which calls another thread. timeout period of second one is
I'm trying to write a method to take a multiline tab-delimited file and return
public class Tester implements Runnable { public Tester() { // Init WebDriver FirefoxProfile firefoxProfile
I'm trying to send an iCal to an outlook, using Java Mail Library, I've
I am indexing the documents with Lucene and am trying to apply the SnowballAnalyzer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.