简体   繁体   中英

IntelliJ strange behavior of static import completion for org.junit.Assert.assertEquals

In IntelliJ, when I press Alt Enter , it correctly offers to add static import for assertNotEquals :

在此处输入图片说明

But not for assertEquals :

在此处输入图片说明

Furthermore, when I press Control Alt Space , it doesn't offer assertEquals , only assertNotEquals and assertArrayEquals :

在此处输入图片说明

I have to add the static import by typing manually. Even then, it doesn't help auto-completing, it only offers assertNotEquals and assertArrayEquals while typing.

Oddly, this only happens on my work PC in Windows. I had this problem since version 11, 12, 13, now I'm using version 14.3, community edition.

Why is this happening and how can I make it offer assertEquals ?

Side note: I don't know if this is relevant, but it used to offer assertEquals from junit.framework instead of org.junit . That was error prone and annoying, so I disabled all imports from junit.framework .

This can happen if you have excluded org.junit.Assert.assertEquals in the settings. Open your settings and search for "imports". In Editor / General / Auto Import you can configure a list of classes and pacakges to Exclude from Import and Completion .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM