2013-01-21 123 views
4

在Eclipse中,是否可以避免换行以获得更好的jmockit可读性而不关闭代码格式化程序?Eclipse避免为jmockit换行

通缉:

@Test 
public void testRegisterNodeModelFactory() { 
    new Expectations() {{ 
    RepositoryManager.getInstance(); times = CALLED; 
    }}; 

    invoke(_measureModuleInstall, "registerNodeModeFactory"); 
} 

目前:

@Test 
public void testRegisterNodeModelFactory() { 
    new Expectations() {{ 
    RepositoryManager.getInstance(); 
    times = CALLED; 
    }}; 

    invoke(_measureModuleInstall, "registerNodeModeFactory"); 
} 
+2

有你看着身边的那些代码区关闭格式化? http://stackoverflow.com/questions/1820908/how-to-turn-off-the-eclipse-code-formatter-for-certain-sections-of-java-code –

+0

是的,但我想要一些'更清洁'。 – sansp00

+0

我在IntelliJ IDEA中遇到了同样的问题,我也无法解决。 –

回答

0

禁用代码格式化了的代码的某些部分:

// @formatter:off 
RepositoryManager.getInstance(); times = CALLED; 
// @formatter:on 
+1

这将禁用整个格式化程序。是否有可能只禁用换行符? – T3rm1