Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 496134

Summary: [format] Formating of JUnit test suites
Product: [Eclipse Project] JDT Reporter: Lars Vogel <Lars.Vogel>
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Lars.Vogel, mateusz.matela, stephan.herrmann
Version: 4.6   
Target Milestone: 4.7 M1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Lars Vogel CLA 2016-06-14 15:12:25 EDT
I think a common way of formatting JUnit tests suites is how we do it in the Eclipse project:

@RunWith(Suite.class)
@Suite.SuiteClasses({
	StartupTest.class,
	StatusHandlingTestSuite.class,
	MenusTestSuite.class
})
public class UiTestSuite {
}

If I format this with Eclipse I get:

@RunWith(Suite.class)
@Suite.SuiteClasses({ StartupTest.class, StatusHandlingTestSuite.class, MenusTestSuite.class })

public class UiTestSuite {
}

I think the first formatting option should to preferred by the Eclipse IDE as:
1.) We use it for the Eclipse project
2.) It keeps the test suite readable
Comment 1 Stephan Herrmann CLA 2016-06-14 15:23:59 EDT
Mh, I wouldn't say the formatter "formats JUnit test suites", it formats Java annotations on classes etc.

You are not saying the formatter should implement special handling specifically for org.junit.runners.Suite.SuiteClasses, are you?

BTW, the formatter lives in JDT/Core.
Comment 2 Lars Vogel CLA 2016-06-14 15:26:29 EDT
(In reply to Stephan Herrmann from comment #1)
> Mh, I wouldn't say the formatter "formats JUnit test suites", it formats
> Java annotations on classes etc.
> 
> You are not saying the formatter should implement special handling
> specifically for org.junit.runners.Suite.SuiteClasses, are you?

Maybe close this one as wontfix?
Comment 3 Stephan Herrmann CLA 2016-06-14 15:32:27 EDT
(In reply to Lars Vogel from comment #2)
> (In reply to Stephan Herrmann from comment #1)
> > Mh, I wouldn't say the formatter "formats JUnit test suites", it formats
> > Java annotations on classes etc.
> > 
> > You are not saying the formatter should implement special handling
> > specifically for org.junit.runners.Suite.SuiteClasses, are you?
> 
> Maybe close this one as wontfix?

That's what I'd recommend, but I let Mateusz have a final word on this :)
Comment 4 Mateusz Matela CLA 2016-06-15 10:11:13 EDT
(In reply to Stephan Herrmann from comment #3)
> (In reply to Lars Vogel from comment #2)
> > Maybe close this one as wontfix?
> 
> That's what I'd recommend, but I let Mateusz have a final word on this :)

I agree!