package org.kohsuke.args4j;

public class LongUsageTest extends Args4JTestBase<LongUsage> {
    @Override
    public LongUsage getTestObject() {
        return new LongUsage();
    }

    public void testUsageMessage() {
        args = new String[]{"-wrong-usage"};
        try {
        	// set Widescreen otherwise a line wrapping must occur
        	parser.setUsageWidth(120);
        	// start parsing
            parser.parseArgument(args);
        } catch (CmdLineException e) {
            String expectedLine1 = " -LongNamedStringOption USE_A_NICE_STRING : set a string";
            String expectedLine2 = " -i N                                     : set an int";
            String[] usageLines = getUsageMessage();
            assertUsageLength(2);
            assertEquals("First line wrong", expectedLine1, usageLines[0]);
            assertEquals("Second line wrong", expectedLine2, usageLines[1]);
        }
    }
   
}

@@ -922,14 +922,848 @@
 %7D%0A    %7D%0A
+%0A
    
+ public void testUsageMessageWithNewWayToSet() %7B%0A        args = new String%5B%5D%7B%22-wrong-usage%22%7D;%0A        // set Widescreen otherwise a line wrapping must occur%0A        parser = new CmdLineParser(testObject,%0A                ParserProperties.defaults().withUsageWidth(120));%0A        try %7B%0A        %09// start parsing%0A            parser.parseArgument(args);%0A        %7D catch (CmdLineException e) %7B%0A            String expectedLine1 = %22 -LongNamedStringOption USE_A_NICE_STRING : set a string%22;%0A            String expectedLine2 = %22 -i N                                     : set an int%22;%0A            String%5B%5D usageLines = getUsageMessage();%0A            assertUsageLength(2);%0A            assertEquals(%22First line wrong%22, expectedLine1, usageLines%5B0%5D);%0A            assertEquals(%22Second line wrong%22, expectedLine2, usageLines%5B1%5D);%0A        %7D%0A    %7D%0A
 %0A%7D%0A

test new way of setting width