Compare commits
	
		
			12 Commits
		
	
	
		
			myplacedk/
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a71253142b | |||
| 855dc41a7f | |||
| 06b17d32ac | |||
| f3bc2c1a0b | |||
| 1ee532b577 | |||
| d5a81bf84a | |||
| 355ee1d29d | |||
| a3185e3277 | |||
| a657d2bfaa | |||
| bb7497b494 | |||
| 1ba1363dd2 | |||
| c29d644f56 | 
@ -1,4 +1,4 @@
 | 
				
			|||||||
Copyright 2019 Chris Hodges <chrisly@platon42.de>
 | 
					Copyright 2019-2024 Chris Hodges <chrisly@platon42.de>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
					Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
you may not use this file except in compliance with the License.
 | 
					you may not use this file except in compliance with the License.
 | 
				
			||||||
@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
 | 
				
			|||||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
					distributed under the License is distributed on an "AS IS" BASIS,
 | 
				
			||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
				
			||||||
See the License for the specific language governing permissions and
 | 
					See the License for the specific language governing permissions and
 | 
				
			||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										166
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										166
									
								
								README.md
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
# Cajon - Concise AssertJ Optimizing Nitpicker [](https://travis-ci.com/chrisly42/cajon-plugin) [](https://coveralls.io/github/chrisly42/cajon-plugin?branch=master)
 | 
					# Cajon - Concise AssertJ Optimizing Nitpicker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cajon is an IntelliJ IDEA Plugin for shortening and optimizing [AssertJ](https://assertj.github.io/doc/) assertions.
 | 
					Cajon is an IntelliJ IDEA Plugin for shortening and optimizing [AssertJ](https://assertj.github.io/doc/) assertions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -40,14 +40,15 @@ Cajon also warns about bogus or incorrect uses of AssertJ.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Lookup and refactoring of string-based extracting()
 | 
					## Lookup and refactoring of string-based extracting()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AssertJ allows [extracting POJO fields/properties on iterables/arrays](http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html#extracted-properties-assertion).
 | 
					AssertJ
 | 
				
			||||||
 | 
					allows [extracting POJO fields/properties on iterables/arrays](http://joel-costigliola.github.io/assertj/assertj-core-features-highlight.html#extracted-properties-assertion).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Using strings is not safe for refactoring (and before Java 8 Lambdas were available,
 | 
					Using strings is not safe for refactoring (and before Java 8 Lambdas were available,
 | 
				
			||||||
creating extractor functions just for testing purpose was a bit too tedious).
 | 
					creating extractor functions just for testing purpose was a bit too tedious).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This plugin adds support for referencing these fields (so you can ctrl(/cmd)-click on the 
 | 
					This plugin adds support for referencing these fields (so you can ctrl(/cmd)-click on the
 | 
				
			||||||
string to go to the definition) and allows safe refactoring on the 
 | 
					string to go to the definition) and allows safe refactoring on the
 | 
				
			||||||
fields (refactoring a getter method without a corresponding field will not work 
 | 
					fields (refactoring a getter method without a corresponding field will not work
 | 
				
			||||||
correctly right now) too.
 | 
					correctly right now) too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Usage
 | 
					## Usage
 | 
				
			||||||
@ -62,10 +63,11 @@ The plugin will report inspections in your opened editor file as warnings.
 | 
				
			|||||||
You can then quick-fix these with your quick-fix hotkey (usually Alt-Return or Opt-Return).
 | 
					You can then quick-fix these with your quick-fix hotkey (usually Alt-Return or Opt-Return).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Or, you can use the "Run Inspection by Name..." action to run one inspection on a bigger scope (e.g. the whole project).
 | 
					Or, you can use the "Run Inspection by Name..." action to run one inspection on a bigger scope (e.g. the whole project).
 | 
				
			||||||
Applying a quick fix might result in further optimization possibilities, so 
 | 
					Applying a quick fix might result in further optimization possibilities, so
 | 
				
			||||||
you might need to perform a couple of fixes before you get to the final result.
 | 
					you might need to perform a couple of fixes before you get to the final result.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Check out this example where every line represents the result after a Cajon quickfix:
 | 
					Check out this example where every line represents the result after a Cajon quickfix:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
assertFalse(!(array.length == collection.size()));
 | 
					assertFalse(!(array.length == collection.size()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -83,7 +85,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
## Implemented inspections and quickfixes
 | 
					## Implemented inspections and quickfixes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- JoinAssertThatStatements
 | 
					- JoinAssertThatStatements
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Joins multiple ```assertThat()``` statements with same actual expression together.
 | 
					  Joins multiple ```assertThat()``` statements with same actual expression together.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
@ -98,16 +100,16 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  The comments of the statements will be preserved. When using ```extracting()``` or similar,
 | 
					  The comments of the statements will be preserved. When using ```extracting()``` or similar,
 | 
				
			||||||
  the statements will not be merged.
 | 
					  the statements will not be merged.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  The behavior regarding the insertion of line breaks between the expressions can be configured in the
 | 
					  The behavior regarding the insertion of line breaks between the expressions can be configured in the
 | 
				
			||||||
  inspection settings.
 | 
					  inspection settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- JoinVarArgsContains
 | 
					- JoinVarArgsContains
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Looks for ```.contains()```, ```.doesNotContain()```, and .```containsOnlyOnce()``` calls for iterables 
 | 
					  Looks for ```.contains()```, ```.doesNotContain()```, and .```containsOnlyOnce()``` calls for iterables
 | 
				
			||||||
  within the same statement. The available quickfix can join the arguments to variadic version of the call
 | 
					  within the same statement. The available quickfix can join the arguments to variadic version of the call
 | 
				
			||||||
  and remove the surplus one.
 | 
					  and remove the surplus one.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(expected).contains("foo").doesNotContain("bar").contains("etc").doesNotContain("huh");
 | 
					  from: assertThat(expected).contains("foo").doesNotContain("bar").contains("etc").doesNotContain("huh");
 | 
				
			||||||
    to: assertThat(expected).contains("foo", "etc").doesNotContain("bar", "huh");
 | 
					    to: assertThat(expected).contains("foo", "etc").doesNotContain("bar", "huh");
 | 
				
			||||||
@ -116,7 +118,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
  changing semantics or losing descriptions.
 | 
					  changing semantics or losing descriptions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Note that the quickfix does not handle comments very well and might remove them during the operation.
 | 
					  Note that the quickfix does not handle comments very well and might remove them during the operation.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  You may need to perform some manual reformatting, if the line gets too long after applying the fix.
 | 
					  You may need to perform some manual reformatting, if the line gets too long after applying the fix.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- AssertThatObjectIsNullOrNotNull
 | 
					- AssertThatObjectIsNullOrNotNull
 | 
				
			||||||
@ -144,7 +146,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  Inverts the boolean condition in either ```assertThat()``` or ```isEqualTo()```/```isNotEqualTo()```
 | 
					  Inverts the boolean condition in either ```assertThat()``` or ```isEqualTo()```/```isNotEqualTo()```
 | 
				
			||||||
  to make it more readable.
 | 
					  to make it more readable.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(!booleanValue).isEqualTo(true/false/Boolean.TRUE/Boolean.FALSE);  
 | 
					  from: assertThat(!booleanValue).isEqualTo(true/false/Boolean.TRUE/Boolean.FALSE);  
 | 
				
			||||||
  from: assertThat(!booleanValue).isTrue()/isFalse();  
 | 
					  from: assertThat(!booleanValue).isTrue()/isFalse();  
 | 
				
			||||||
@ -160,7 +162,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssertThatInstanceOf
 | 
					- AssertThatInstanceOf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Moves ```instanceof``` expressions out of ```assertThat()```.
 | 
					  Moves ```instanceof``` expressions out of ```assertThat()```.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(object instanceof classname).isEqualTo(true);
 | 
					  from: assertThat(object instanceof classname).isEqualTo(true);
 | 
				
			||||||
  from: assertThat(object instanceof classname).isTrue();
 | 
					  from: assertThat(object instanceof classname).isTrue();
 | 
				
			||||||
@ -171,6 +173,23 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
    to: assertThat(object).isNotInstanceOf(classname.class);
 | 
					    to: assertThat(object).isNotInstanceOf(classname.class);
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- AssertThatIsZeroOne
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Uses ```isZero()```, ```isNotZero()``` and ```isOne()``` instead.
 | 
				
			||||||
 | 
					  Works with shorts, integers, longs, floats and doubles, and tries to evaluate
 | 
				
			||||||
 | 
					  constant expressions, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ```
 | 
				
			||||||
 | 
					  from: assertThat(numeric).isEqualTo(0);
 | 
				
			||||||
 | 
					    to: assertThat(numeric).isZero();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  from: assertThat(numeric).isNotEqualTo(0);
 | 
				
			||||||
 | 
					    to: assertThat(numeric).isNotZero();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  from: assertThat(numeric).isEqualTo(1);
 | 
				
			||||||
 | 
					    to: assertThat(numeric).isOne();
 | 
				
			||||||
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- AssertThatStringIsEmpty
 | 
					- AssertThatStringIsEmpty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Uses ```isEmpty()``` for empty string assertions.
 | 
					  Uses ```isEmpty()``` for empty string assertions.
 | 
				
			||||||
@ -184,9 +203,9 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
  The ```assertThat(string.length()).isEqualTo(0);``` case is handled in the AssertThatSize inspection.
 | 
					  The ```assertThat(string.length()).isEqualTo(0);``` case is handled in the AssertThatSize inspection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- AssertThatStringExpression
 | 
					- AssertThatStringExpression
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Moves string operations inside ```assertThat()``` out.
 | 
					  Moves string operations inside ```assertThat()``` out.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(stringActual.isEmpty()).isTrue();
 | 
					  from: assertThat(stringActual.isEmpty()).isTrue();
 | 
				
			||||||
    to: assertThat(stringActual).isEmpty();
 | 
					    to: assertThat(stringActual).isEmpty();
 | 
				
			||||||
@ -211,7 +230,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
    to: assertThat(stringActual).matches(stringExpected);
 | 
					    to: assertThat(stringActual).matches(stringExpected);
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  Analogously with ```isFalse()```.
 | 
					  Analogously with ```isFalse()```.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  More funny stuff (excerpt):
 | 
					  More funny stuff (excerpt):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
@ -239,7 +258,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssertThatObjectExpression
 | 
					- AssertThatObjectExpression
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Handles ```equals()```, ```toString()``` and ```hashCode()``` inside an expected expression.
 | 
					  Handles ```equals()```, ```toString()``` and ```hashCode()``` inside an expected expression.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(objActual.equals(objExpected)).isTrue();
 | 
					  from: assertThat(objActual.equals(objExpected)).isTrue();
 | 
				
			||||||
    to: assertThat(objActual).isEqualTo(objExpected);
 | 
					    to: assertThat(objActual).isEqualTo(objExpected);
 | 
				
			||||||
@ -254,7 +273,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssertThatComparableExpression
 | 
					- AssertThatComparableExpression
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Handles ```compareTo()``` inside an expected expression.
 | 
					  Handles ```compareTo()``` inside an expected expression.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(obj1.compareTo(obj2)).isEqualTo(0);
 | 
					  from: assertThat(obj1.compareTo(obj2)).isEqualTo(0);
 | 
				
			||||||
    to: assertThat(obj1).isEqualByComparingTo(obj2);
 | 
					    to: assertThat(obj1).isEqualByComparingTo(obj2);
 | 
				
			||||||
@ -320,7 +339,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
  from: assertThat(map.get(key)).isNull();
 | 
					  from: assertThat(map.get(key)).isNull();
 | 
				
			||||||
    to: assertThat(map).doesNotContainKey(key);
 | 
					    to: assertThat(map).doesNotContainKey(key);
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  The last transformation is the default, but may not be 100% equivalent depending upon the map
 | 
					  The last transformation is the default, but may not be 100% equivalent depending upon the map
 | 
				
			||||||
  being a degenerated case with ```null``` values, where ```map.get(key)``` returns ```null```,
 | 
					  being a degenerated case with ```null``` values, where ```map.get(key)``` returns ```null```,
 | 
				
			||||||
  but ```containsKey(key)``` is ```true```.
 | 
					  but ```containsKey(key)``` is ```true```.
 | 
				
			||||||
@ -424,10 +443,10 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  Uses ```isEmpty()``` for ```hasSize(0)```, ```hasSizeLessThanOrEqualTo(0)```, and
 | 
					  Uses ```isEmpty()``` for ```hasSize(0)```, ```hasSizeLessThanOrEqualTo(0)```, and
 | 
				
			||||||
  ```hasSizeLessThan(1)``` iterable (enumerable) assertions instead.
 | 
					  ```hasSizeLessThan(1)``` iterable (enumerable) assertions instead.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Also suggests ```isNotEmpty()``` for ```hasSizeGreaterThan(0)``` and 
 | 
					  Also suggests ```isNotEmpty()``` for ```hasSizeGreaterThan(0)``` and
 | 
				
			||||||
  ```hasSizeGreaterThanOrEqualTo(1)```.
 | 
					  ```hasSizeGreaterThanOrEqualTo(1)```.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(enumerable).hasSize(0);
 | 
					  from: assertThat(enumerable).hasSize(0);
 | 
				
			||||||
  from: assertThat(enumerable).hasSizeLessThanOrEqualTo(0);
 | 
					  from: assertThat(enumerable).hasSizeLessThanOrEqualTo(0);
 | 
				
			||||||
@ -515,7 +534,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  Examines the actual expression for common mistakes such as mixing expected and actual expression.
 | 
					  Examines the actual expression for common mistakes such as mixing expected and actual expression.
 | 
				
			||||||
  For simple cases, a quick fix is offered to swap them. Otherwise, only a warning is issued.
 | 
					  For simple cases, a quick fix is offered to swap them. Otherwise, only a warning is issued.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(5).isEqualTo(variable);
 | 
					  from: assertThat(5).isEqualTo(variable);
 | 
				
			||||||
    to: assertThat(variable).isEqualTo(5);
 | 
					    to: assertThat(variable).isEqualTo(5);
 | 
				
			||||||
@ -525,13 +544,13 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  There are, of course, more variations of the theme.
 | 
					  There are, of course, more variations of the theme.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  If both sides of an assertion are constant expressions, the problem will only appear as
 | 
					  If both sides of an assertion are constant expressions, the problem will only appear as
 | 
				
			||||||
  a weak warning without a quick fix.
 | 
					  a weak warning without a quick fix.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Constants used on the actual side of ```.matches()``` and ```doesNotMatch()``` will not be
 | 
					  Constants used on the actual side of ```.matches()``` and ```doesNotMatch()``` will not be
 | 
				
			||||||
  reported for regular expression testing.
 | 
					  reported for regular expression testing.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Neither will a ```Class``` type be considered a constant in the classic sense, so
 | 
					  Neither will a ```Class``` type be considered a constant in the classic sense, so
 | 
				
			||||||
  ```assertThat(SomeClass.class).isAssignableFrom(SomeOtherClass.class)``` will not be reported.
 | 
					  ```assertThat(SomeClass.class).isAssignableFrom(SomeOtherClass.class)``` will not be reported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -610,9 +629,9 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssertThatJava8Optional
 | 
					- AssertThatJava8Optional
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Examines the statement for Java 8 ```Optional``` type and whether the statement
 | 
					  Examines the statement for Java 8 ```Optional``` type and whether the statement
 | 
				
			||||||
  effectively tries to assert the presence, absence or content and then 
 | 
					  effectively tries to assert the presence, absence or content and then
 | 
				
			||||||
  replaces the statement by better assertions.
 | 
					  replaces the statement by better assertions.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  from: assertThat(opt.isPresent()).isEqualTo(true);
 | 
					  from: assertThat(opt.isPresent()).isEqualTo(true);
 | 
				
			||||||
  from: assertThat(opt.isPresent()).isNotEqualTo(false);
 | 
					  from: assertThat(opt.isPresent()).isNotEqualTo(false);
 | 
				
			||||||
@ -650,7 +669,7 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssertThatGuavaOptional
 | 
					- AssertThatGuavaOptional
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Examines the statement for Google Guava ```Optional``` type and whether the statement
 | 
					  Examines the statement for Google Guava ```Optional``` type and whether the statement
 | 
				
			||||||
  effectively tries to assert the presence, absence or content and then 
 | 
					  effectively tries to assert the presence, absence or content and then
 | 
				
			||||||
  replaces the statement by better assertions.
 | 
					  replaces the statement by better assertions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
@ -689,26 +708,26 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- AssumeThatInsteadOfReturn
 | 
					- AssumeThatInsteadOfReturn
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Tries to detect bogus uses of return statements in test methods and replaces them by ```assumeThat()``` calls.
 | 
					  Tries to detect bogus uses of return statements in test methods and replaces them by ```assumeThat()``` calls.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Novices will use these to skip test execution by bailing out early on some preconditions not met.
 | 
					  Novices will use these to skip test execution by bailing out early on some preconditions not met.
 | 
				
			||||||
  However, this suggests that the test has actually been run and passed instead of showing the test
 | 
					  However, this suggests that the test has actually been run and passed instead of showing the test
 | 
				
			||||||
  as being skipped.
 | 
					  as being skipped.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Return statements in ```if``` statements in main test methods (must be annotated with JUnit 4 or 
 | 
					  Return statements in ```if``` statements in main test methods (must be annotated with JUnit 4 or
 | 
				
			||||||
  Jupiter ```@Test``` annotations) will be verified to have at least one ```assertThat()``` statement in the code flow.
 | 
					  Jupiter ```@Test``` annotations) will be verified to have at least one ```assertThat()``` statement in the code flow.
 | 
				
			||||||
  Method calls within the same class will be examined for ```assertThat()``` statements, too.
 | 
					  Method calls within the same class will be examined for ```assertThat()``` statements, too.
 | 
				
			||||||
  However, at most 50 statements and down to five recursions will be tolerated before giving up.
 | 
					  However, at most 50 statements and down to five recursions will be tolerated before giving up.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  Currently, the quickfix may lose some comments during operation. The other branch of the ```if``` statement
 | 
					  Currently, the quickfix may lose some comments during operation. The other branch of the ```if``` statement
 | 
				
			||||||
  will be inlined (blocks with declarations will remain a code block due to variable scope).
 | 
					  will be inlined (blocks with declarations will remain a code block due to variable scope).
 | 
				
			||||||
  The quickfix will only work with AssertJ >= 2.9.0 (for 2.x releases) or >= 3.9.0 (for 3.x releases).
 | 
					  The quickfix will only work with AssertJ >= 2.9.0 (for 2.x releases) or >= 3.9.0 (for 3.x releases).
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  The generated ```assumeThat()``` statement could be optimized further (similar to ```assertThat()```), but
 | 
					  The generated ```assumeThat()``` statement could be optimized further (similar to ```assertThat()```), but
 | 
				
			||||||
  there is currently no support in Cajon for this (you could rename the method to ```assertThat()``` optimize it
 | 
					  there is currently no support in Cajon for this (you could rename the method to ```assertThat()``` optimize it
 | 
				
			||||||
  and turn it back into ```assumeThat()``` in the end).
 | 
					  and turn it back into ```assumeThat()``` in the end).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Example:
 | 
					  Example:
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
      @Test
 | 
					      @Test
 | 
				
			||||||
      public void check_fuel_emission() {
 | 
					      public void check_fuel_emission() {
 | 
				
			||||||
@ -732,14 +751,14 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
- JUnitAssertToAssertJ
 | 
					- JUnitAssertToAssertJ
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Tries to convert most of the JUnit 4 assertions and assumptions to AssertJ format.
 | 
					  Tries to convert most of the JUnit 4 assertions and assumptions to AssertJ format.
 | 
				
			||||||
  Sometimes the expected and actual expressions are specified in wrong order -- 
 | 
					  Sometimes the expected and actual expressions are specified in wrong order --
 | 
				
			||||||
  Cajon tries to swap these when it detects the supposed actual expression to be a
 | 
					  Cajon tries to swap these when it detects the supposed actual expression to be a
 | 
				
			||||||
  constant while the expected one is not.
 | 
					  constant while the expected one is not.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Does not support Hamcrest-Matchers.
 | 
					  Does not support Hamcrest-Matchers.
 | 
				
			||||||
  If you need that kind of conversion, you might want to check out the
 | 
					  If you need that kind of conversion, you might want to check out the
 | 
				
			||||||
  [Assertions2AssertJ plugin](https://plugins.jetbrains.com/plugin/10345-assertions2assertj) by Ric Emery.
 | 
					  [Assertions2AssertJ plugin](https://plugins.jetbrains.com/plugin/10345-assertions2assertj) by Ric Emery.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  assertTrue(condition);
 | 
					  assertTrue(condition);
 | 
				
			||||||
  assertTrue(message, condition);
 | 
					  assertTrue(message, condition);
 | 
				
			||||||
@ -777,8 +796,9 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Implemented referencing
 | 
					### Implemented referencing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  You can ctrl-click on references inside .extracting() method parameters to go the
 | 
					You can ctrl-click on references inside .extracting() method parameters to go the
 | 
				
			||||||
  referencing method definition.
 | 
					referencing method definition.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  .extracting("field")
 | 
					  .extracting("field")
 | 
				
			||||||
  .extracting("outerField.fieldInsideObjectTypeOfOuterField.andSoOn")
 | 
					  .extracting("outerField.fieldInsideObjectTypeOfOuterField.andSoOn")
 | 
				
			||||||
@ -792,19 +812,21 @@ You can toggle the various inspections in the Settings/Editor/Inspections in the
 | 
				
			|||||||
  .flatExtracting(Extractors.byName("fieldOrPropertyOrBareMethod.orAPathLikeAbove")
 | 
					  .flatExtracting(Extractors.byName("fieldOrPropertyOrBareMethod.orAPathLikeAbove")
 | 
				
			||||||
  .flatExtracting(Extractors.resultOf("bareMethod")
 | 
					  .flatExtracting(Extractors.resultOf("bareMethod")
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
  This works on both POJOs and ```Iterable```s/```Array```s. 
 | 
					
 | 
				
			||||||
  Implementation is very basic though and does not work with fancy cascaded ```.extracting()``` sequences.
 | 
					This works on both POJOs and ```Iterable```s/```Array```s.
 | 
				
			||||||
  If there's demand, I could add it.
 | 
					Implementation is very basic though and does not work with fancy cascaded ```.extracting()``` sequences.
 | 
				
			||||||
 | 
					If there's demand, I could add it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Development notice
 | 
					## Development notice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cajon is written in Kotlin 1.4.
 | 
					Cajon is written in Kotlin 1.7.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cajon is probably the only plugin that uses JUnit 5 Jupiter for unit testing so far (or at least the only one I'm aware of ;) ).
 | 
					Cajon is probably the only plugin that uses JUnit 5 Jupiter for unit testing so far (or at least the only one I'm aware of ;) ).
 | 
				
			||||||
The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to make it work with JUnit 5.
 | 
					The IntelliJ framework actually uses the JUnit 3 TestCase for plugin testing, and it took me quite a while to make it work with JUnit 5.
 | 
				
			||||||
Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for your projects (with attribution).
 | 
					Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for your projects (with attribution).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Planned features
 | 
					## Planned features
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- More Optional fixes such as ```opt1.get() == opt2.get()``` etc.
 | 
					- More Optional fixes such as ```opt1.get() == opt2.get()``` etc.
 | 
				
			||||||
- More moving out of methods for LocalDate/Time etc.
 | 
					- More moving out of methods for LocalDate/Time etc.
 | 
				
			||||||
- assertThat(foo.toLowerCase()/toUpperCase()).isEqualTo("foo") -> assertThat(foo).isEqualToIgnoringCase()
 | 
					- assertThat(foo.toLowerCase()/toUpperCase()).isEqualTo("foo") -> assertThat(foo).isEqualToIgnoringCase()
 | 
				
			||||||
@ -814,9 +836,27 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  from: assertThat(object).extracting("propOne", "propNoGetter", "propTwo.innerProp")...
 | 
					  from: assertThat(object).extracting("propOne", "propNoGetter", "propTwo.innerProp")...
 | 
				
			||||||
    to: assertThat(object).extracting(type::getPropOne, it -> it.propNoGetter, it -> it.getPropTwo().getInnerProp())...
 | 
					    to: assertThat(object).extracting(type::getPropOne, it -> it.propNoGetter, it -> it.getPropTwo().getInnerProp())...
 | 
				
			||||||
  ```
 | 
					  ```
 | 
				
			||||||
 | 
					- Support primitives in assertThat(map.containsKey(1)).isTrue();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Changelog
 | 
					## Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### V1.14 (19-Feb-24)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Now requires minimum version 2022.2.
 | 
				
			||||||
 | 
					- Maintenance. Updated various dependencies (Kotlin 1.9.22) and AssertJ 3.25.3 and AssertJ-Guava 3.25.3.
 | 
				
			||||||
 | 
					- Reworked JUnit 5 test framework to work again. However, all the tests are broken.
 | 
				
			||||||
 | 
					  I spent several days trying to figure out what is going on, but I'm giving up on this pile of crap called IntelliJ.
 | 
				
			||||||
 | 
					  Jetbrains keeps breaking the APIs and implementations every year and I just cannot be bothered anymore.
 | 
				
			||||||
 | 
					- This is very likely the last version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### V1.13 (18-Aug-22)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- API change in IntelliJ platforms now requires minimum version 2019.3.1. Sorry, giving up to maintain compatibility after four attempts.
 | 
				
			||||||
 | 
					- Maintenance. Updated various dependencies (Kotlin 1.7.10) and AssertJ 3.23.1 and AssertJ-Guava 3.5.0.
 | 
				
			||||||
 | 
					- Tried to fix unreproducible issue #9.
 | 
				
			||||||
 | 
					- Added AssertThatIsZeroOne inspection demanded by issue #5.
 | 
				
			||||||
 | 
					- Fix for wrongly joining statements that cannot be trivially joined (e.g. with filteredOn). Fixes issue #6.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### V1.12 (06-May-21)
 | 
					### V1.12 (06-May-21)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Maintenance. Updated various dependencies (Kotlin 1.50.0) and AssertJ 3.19.0
 | 
					- Maintenance. Updated various dependencies (Kotlin 1.50.0) and AssertJ 3.19.0
 | 
				
			||||||
@ -834,10 +874,12 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  inspection.
 | 
					  inspection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.10 (31-Jul-20) Friday the 31st Edition
 | 
					#### V1.10 (31-Jul-20) Friday the 31st Edition
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Updated libraries to the latest versions (including AssertJ 3.16.1 and Kotlin 1.40-rc).
 | 
					- Updated libraries to the latest versions (including AssertJ 3.16.1 and Kotlin 1.40-rc).
 | 
				
			||||||
- Fixed two possible index out-of-bounds exceptions in ExtractorReferenceContributor and BogusAssertionInspection.
 | 
					- Fixed two possible index out-of-bounds exceptions in ExtractorReferenceContributor and BogusAssertionInspection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.9 (25-Feb-20) Mardi Gras Edition
 | 
					#### V1.9 (25-Feb-20) Mardi Gras Edition
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- TwistedAssertion inspection will no longer warn for ```.matches()``` and ```doesNotMatch()``` for regular expressions.
 | 
					- TwistedAssertion inspection will no longer warn for ```.matches()``` and ```doesNotMatch()``` for regular expressions.
 | 
				
			||||||
  Apparently, ```assertThat("somestring").matches(regex)``` is a valid test if the regex is what needs to be tested.
 | 
					  Apparently, ```assertThat("somestring").matches(regex)``` is a valid test if the regex is what needs to be tested.
 | 
				
			||||||
  If the actual expression is of ```Class``` type, this will no longer be reported.
 | 
					  If the actual expression is of ```Class``` type, this will no longer be reported.
 | 
				
			||||||
@ -848,12 +890,14 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  the warning will be reduced to information level as the assertion may be testing ```equals()``` or ```hashCode()``` for validity.
 | 
					  the warning will be reduced to information level as the assertion may be testing ```equals()``` or ```hashCode()``` for validity.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.8 (14-Feb-20) Valentine Edition
 | 
					#### V1.8 (14-Feb-20) Valentine Edition
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Maintenance. Removed experimental API use. Updated dependencies. Fixed testing problems introduced with IntelliJ IDEA 2019.3
 | 
					- Maintenance. Removed experimental API use. Updated dependencies. Fixed testing problems introduced with IntelliJ IDEA 2019.3
 | 
				
			||||||
- Added new TwistedAssertion inspection that will warn about assertions with the actual expression being a constant indicating
 | 
					- Added new TwistedAssertion inspection that will warn about assertions with the actual expression being a constant indicating
 | 
				
			||||||
  swapped use of actual and expected expressions.
 | 
					  swapped use of actual and expected expressions.
 | 
				
			||||||
- Added new BogusAssertion inspection that showing typical copy and paste errors where actual and expected expressions are the same.
 | 
					- Added new BogusAssertion inspection that showing typical copy and paste errors where actual and expected expressions are the same.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.7 (19-Nov-19)
 | 
					#### V1.7 (19-Nov-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed a lapsuus in AssertThatFileExpression also transforming ```.listFiles()``` with a filter argument.
 | 
					- Fixed a lapsuus in AssertThatFileExpression also transforming ```.listFiles()``` with a filter argument.
 | 
				
			||||||
- Added first version of AssertThatPathExpression for a limited number transformations (more stuff is possible,
 | 
					- Added first version of AssertThatPathExpression for a limited number transformations (more stuff is possible,
 | 
				
			||||||
  but requires detection and transformation of static ```Files```-methods).
 | 
					  but requires detection and transformation of static ```Files```-methods).
 | 
				
			||||||
@ -861,6 +905,7 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
- Added ```hasSize(), isEmpty()``` and ```isNotEmpty()``` for AssertThatFileExpression when using AssertJ >= 3.14.0.
 | 
					- Added ```hasSize(), isEmpty()``` and ```isNotEmpty()``` for AssertThatFileExpression when using AssertJ >= 3.14.0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.6 (30-Sep-19)
 | 
					#### V1.6 (30-Sep-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Really fixed AssertThatGuavaOptional inspections to avoid conversions from ```.get()``` to ```.contains()```
 | 
					- Really fixed AssertThatGuavaOptional inspections to avoid conversions from ```.get()``` to ```.contains()```
 | 
				
			||||||
  for array types. Sigh. Shouldn't be working >12h a day and then do some more stuff at home.
 | 
					  for array types. Sigh. Shouldn't be working >12h a day and then do some more stuff at home.
 | 
				
			||||||
- Fixed a bug in AssertThatBinaryExpression inspection for ```assertThat(null != expression)``` and related
 | 
					- Fixed a bug in AssertThatBinaryExpression inspection for ```assertThat(null != expression)``` and related
 | 
				
			||||||
@ -871,6 +916,7 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  Specifically, uses of ```matches()```, ```compareToIgnoreCase()```, ```indexOf()```, and ```trim()```.
 | 
					  Specifically, uses of ```matches()```, ```compareToIgnoreCase()```, ```indexOf()```, and ```trim()```.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.5 (24-Sep-19)
 | 
					#### V1.5 (24-Sep-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fix for AssertThatCollectionOrMap inspection sometimes causing an index out-of-bounds exception.
 | 
					- Fix for AssertThatCollectionOrMap inspection sometimes causing an index out-of-bounds exception.
 | 
				
			||||||
- AssertThatGuavaOptional inspections will now avoid conversions from ```.get()``` to ```.contains()```
 | 
					- AssertThatGuavaOptional inspections will now avoid conversions from ```.get()``` to ```.contains()```
 | 
				
			||||||
  for array types (currently not correctly supported by ```contains()``` in AssertJ-Guava).
 | 
					  for array types (currently not correctly supported by ```contains()``` in AssertJ-Guava).
 | 
				
			||||||
@ -881,23 +927,27 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  combinations for ```.hasSameSizeAs()``` are supported.
 | 
					  combinations for ```.hasSameSizeAs()``` are supported.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.4 (25-Aug-19)
 | 
					#### V1.4 (25-Aug-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Minor fix for highlighting of JoinVarArgsContains inspection.
 | 
					- Minor fix for highlighting of JoinVarArgsContains inspection.
 | 
				
			||||||
- Extended AssertThatSize inspection to Maps, too.
 | 
					- Extended AssertThatSize inspection to Maps, too.
 | 
				
			||||||
- Extended AssertThatCollectionOrMap inspection for several ```assertThat(map.get())``` cases as suggested by Georgij G.
 | 
					- Extended AssertThatCollectionOrMap inspection for several ```assertThat(map.get())``` cases as suggested by Georgij G.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.3 (03-Aug-19)
 | 
					#### V1.3 (03-Aug-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- New JoinVarArgsContains inspection that will detect multiple ```.contains()```, ```.doesNotContain()```,
 | 
					- New JoinVarArgsContains inspection that will detect multiple ```.contains()```, ```.doesNotContain()```,
 | 
				
			||||||
  and ```.containsOnlyOnce()``` calls within the same statement that could be joined together using variadic arguments.
 | 
					  and ```.containsOnlyOnce()``` calls within the same statement that could be joined together using variadic arguments.
 | 
				
			||||||
- AssertJ 3.13.0 broke some inspections due to new ```AbstractStringAssert::isEqualTo()``` method.
 | 
					- AssertJ 3.13.0 broke some inspections due to new ```AbstractStringAssert::isEqualTo()``` method.
 | 
				
			||||||
- AssertThatJava8Optional and AssertThatGuavaOptional inspections do not longer try to fix
 | 
					- AssertThatJava8Optional and AssertThatGuavaOptional inspections do not longer try to fix
 | 
				
			||||||
  ```assertThat(optional).isEqualTo(Optional.fromNullable(expression))``` to ```contains()```
 | 
					  ```assertThat(optional).isEqualTo(Optional.fromNullable(expression))``` to ```contains()```
 | 
				
			||||||
  when ```expression``` is not a non-null constant expression.
 | 
					  when ```expression``` is not a non-null constant expression.
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
#### V1.2 (23-Jun-19)
 | 
					#### V1.2 (23-Jun-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Due to popular demand the JoinAssertThatStatements inspection will now add line breaks on joining statements.
 | 
					- Due to popular demand the JoinAssertThatStatements inspection will now add line breaks on joining statements.
 | 
				
			||||||
  The amount of statements joined without causing line breaks can be configured but defaults to 1 (always).
 | 
					  The amount of statements joined without causing line breaks can be configured but defaults to 1 (always).
 | 
				
			||||||
          
 | 
					
 | 
				
			||||||
#### V1.1 (09-Jun-19)
 | 
					#### V1.1 (09-Jun-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Improved JoinAssertThatStatements detection of expressions with side-effects and added pre/post-increment/decrement detection.
 | 
					- Improved JoinAssertThatStatements detection of expressions with side-effects and added pre/post-increment/decrement detection.
 | 
				
			||||||
- Added Guava Optional ```opt.orNull() == null``` case. You know, I'm not making this stuff up, people actually write this kind of code.
 | 
					- Added Guava Optional ```opt.orNull() == null``` case. You know, I'm not making this stuff up, people actually write this kind of code.
 | 
				
			||||||
- Added Java 8 Optional ```opt.orElse(null) == null``` case, too.
 | 
					- Added Java 8 Optional ```opt.orElse(null) == null``` case, too.
 | 
				
			||||||
@ -908,14 +958,18 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
- Added new AssertThatObjectExpression inspection for ```toString()``` and ```hashCode()``` and moved ```equals()``` from AssertThatBinaryExpression there.
 | 
					- Added new AssertThatObjectExpression inspection for ```toString()``` and ```hashCode()``` and moved ```equals()``` from AssertThatBinaryExpression there.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V1.0 (06-May-19)
 | 
					#### V1.0 (06-May-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- First release to be considered stable enough for production use.
 | 
					- First release to be considered stable enough for production use.
 | 
				
			||||||
- Fixed a NPE in AssumeThatInsteadOfReturn inspection quickfix for empty else branches.
 | 
					- Fixed a NPE in AssumeThatInsteadOfReturn inspection quickfix for empty else branches.
 | 
				
			||||||
- Fixed missing description for AssumeThatInsteadOfReturn inspection.
 | 
					- Fixed missing description for AssumeThatInsteadOfReturn inspection.
 | 
				
			||||||
- Added new AssertThatCollectionOrMapExpression inspection that tries to pull out methods such as ```isEmpty()``` or ```contains()``` out of an actual ```assertThat()``` expression.
 | 
					- Added new AssertThatCollectionOrMapExpression inspection that tries to pull out methods such as ```isEmpty()``` or ```contains()``` out of an actual ```assertThat()```
 | 
				
			||||||
 | 
					  expression.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.8 (05-May-19)
 | 
					#### V0.8 (05-May-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed missing description for JoinAssertThatStatements and detection of equivalent expressions (sorry, released it too hastily).
 | 
					- Fixed missing description for JoinAssertThatStatements and detection of equivalent expressions (sorry, released it too hastily).
 | 
				
			||||||
- Fixed ```isEmpty()``` for enumerables and strings and ```isNull()``` for object conversions to be applied only if it is the terminal method call as ```isEmpty()``` and ```isNull()``` return void.
 | 
					- Fixed ```isEmpty()``` for enumerables and strings and ```isNull()``` for object conversions to be applied only if it is the terminal method call as ```isEmpty()```
 | 
				
			||||||
 | 
					  and ```isNull()``` return void.
 | 
				
			||||||
- Heavily reworked inspections for edge cases, such as multiple ```isEqualTo()``` calls inside a single statement.
 | 
					- Heavily reworked inspections for edge cases, such as multiple ```isEqualTo()``` calls inside a single statement.
 | 
				
			||||||
- Some inspections could generate bogus code for weird situations, this has been made more fool-proof.
 | 
					- Some inspections could generate bogus code for weird situations, this has been made more fool-proof.
 | 
				
			||||||
- Corrected highlighting for many inspections.
 | 
					- Corrected highlighting for many inspections.
 | 
				
			||||||
@ -924,6 +978,7 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
- Added a first version of a new inspection that tries to detect bogus uses of return statements in test methods and replaces them by ```assumeThat()``` calls.
 | 
					- Added a first version of a new inspection that tries to detect bogus uses of return statements in test methods and replaces them by ```assumeThat()``` calls.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.7 (28-Apr-19)
 | 
					#### V0.7 (28-Apr-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Another fix for AssertThatGuavaOptional inspection regarding using the same family name for slightly different quick fix executions
 | 
					- Another fix for AssertThatGuavaOptional inspection regarding using the same family name for slightly different quick fix executions
 | 
				
			||||||
  (really, Jetbrains, this sucks for no reason).
 | 
					  (really, Jetbrains, this sucks for no reason).
 | 
				
			||||||
- Extended AssertThatSize inspection to transform ```hasSize()``` into ```hasSameSizeAs()```, if possible.
 | 
					- Extended AssertThatSize inspection to transform ```hasSize()``` into ```hasSameSizeAs()```, if possible.
 | 
				
			||||||
@ -931,6 +986,7 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
  actual object together, preserving comments.
 | 
					  actual object together, preserving comments.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.6 (22-Apr-19)
 | 
					#### V0.6 (22-Apr-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- New AssertThatStringExpression inspection that will move ```isEmpty()```, ```equals()```, ```equalsIgnoreCase()```, ```contains()```,
 | 
					- New AssertThatStringExpression inspection that will move ```isEmpty()```, ```equals()```, ```equalsIgnoreCase()```, ```contains()```,
 | 
				
			||||||
  ```startsWith()```, and ```endsWith()``` out of actual expression.
 | 
					  ```startsWith()```, and ```endsWith()``` out of actual expression.
 | 
				
			||||||
- Extended AssertThatSize inspection to take ```String```s and ```CharSequences``` into account, too.
 | 
					- Extended AssertThatSize inspection to take ```String```s and ```CharSequences``` into account, too.
 | 
				
			||||||
@ -939,28 +995,36 @@ Feel free to use the code (in package ```de.platon42.intellij.jupiter```) for yo
 | 
				
			|||||||
- New AssertThatInstanceOf inspection that moves instanceof expressions out of ```assertThat()```.
 | 
					- New AssertThatInstanceOf inspection that moves instanceof expressions out of ```assertThat()```.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.5 (18-Apr-19)
 | 
					#### V0.5 (18-Apr-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed incompatibility with IDEA versions < 2018.2 (affected AssertThatSizeInspection). Minimal version is now 2017.3.
 | 
					- Fixed incompatibility with IDEA versions < 2018.2 (affected AssertThatSizeInspection). Minimal version is now 2017.3.
 | 
				
			||||||
- Fixed missing Guava imports (if not already present) for AssertThatGuavaInspection. This was a major PITA to get right.
 | 
					- Fixed missing Guava imports (if not already present) for AssertThatGuavaInspection. This was a major PITA to get right.
 | 
				
			||||||
- Added support for referencing and refactoring inside ```.extracting()``` methods with fields, properties and methods (though
 | 
					- Added support for referencing and refactoring inside ```.extracting()``` methods with fields, properties and methods (though
 | 
				
			||||||
  getter renaming does not work that perfect, but I'm giving up for now as the IntelliJ SDK docs are seriously lacking).
 | 
					  getter renaming does not work that perfect, but I'm giving up for now as the IntelliJ SDK docs are seriously lacking).
 | 
				
			||||||
- Fixed an exception in batch mode if the description string was the same but for different fixes. 
 | 
					- Fixed an exception in batch mode if the description string was the same but for different fixes.
 | 
				
			||||||
  Now descriptions are different for quick fixes triggered by AssertThatJava8OptionalInspection and AssertThatGuavaOptionalInspection.
 | 
					  Now descriptions are different for quick fixes triggered by AssertThatJava8OptionalInspection and AssertThatGuavaOptionalInspection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.4 (11-Apr-19)
 | 
					#### V0.4 (11-Apr-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Reduced minimal supported IDEA version from 2018.2 to 2017.2.
 | 
					- Reduced minimal supported IDEA version from 2018.2 to 2017.2.
 | 
				
			||||||
- New inspection AssertThatJava8Optional that operates on Java 8 ```Optional``` objects and tries to use ```contains()```, ```containsSame()```, ```isPresent()```, and ```isNotPresent()``` instead.
 | 
					- New inspection AssertThatJava8Optional that operates on Java 8 ```Optional``` objects and tries to use ```contains()```, ```containsSame()```, ```isPresent()```,
 | 
				
			||||||
 | 
					  and ```isNotPresent()``` instead.
 | 
				
			||||||
- New inspection AssertThatGuavaOptional that operates on Guava ```Optional``` objects and tries to use ```contains()```, ```isPresent()```, and ```isAbsent()``` instead.
 | 
					- New inspection AssertThatGuavaOptional that operates on Guava ```Optional``` objects and tries to use ```contains()```, ```isPresent()```, and ```isAbsent()``` instead.
 | 
				
			||||||
- Added support in AssertThatBinaryExpressionIsTrueOrFalse for ```is(Not)EqualTo(Boolean.TRUE/FALSE)```.
 | 
					- Added support in AssertThatBinaryExpressionIsTrueOrFalse for ```is(Not)EqualTo(Boolean.TRUE/FALSE)```.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.3 (07-Apr-19)
 | 
					#### V0.3 (07-Apr-19)
 | 
				
			||||||
- New inspection AssertThatBinaryExpressionIsTrueOrFalse that will find and fix common binary expressions and ```equals()``` statements (more than 150 combinations) inside ```assertThat()```.
 | 
					
 | 
				
			||||||
 | 
					- New inspection AssertThatBinaryExpressionIsTrueOrFalse that will find and fix common binary expressions and ```equals()``` statements (more than 150 combinations)
 | 
				
			||||||
 | 
					  inside ```assertThat()```.
 | 
				
			||||||
- Merged AssertThatObjectIsNull and AssertThatObjectIsNotNull to AssertThatObjectIsNullOrNotNull.
 | 
					- Merged AssertThatObjectIsNull and AssertThatObjectIsNotNull to AssertThatObjectIsNullOrNotNull.
 | 
				
			||||||
- Support for ```hasSizeLessThan()```, ```hasSizeLessThanOrEqualTo()```, ```hasSizeGreaterThanOrEqualTo()```, and ```hasSizeGreaterThan()``` for AssertThatSizeInspection (with AssertJ >=3.12.0).
 | 
					- Support for ```hasSizeLessThan()```, ```hasSizeLessThanOrEqualTo()```, ```hasSizeGreaterThanOrEqualTo()```, and ```hasSizeGreaterThan()``` for AssertThatSizeInspection (with
 | 
				
			||||||
 | 
					  AssertJ >=3.12.0).
 | 
				
			||||||
- Really fixed highlighting for JUnit conversion. Sorry.
 | 
					- Really fixed highlighting for JUnit conversion. Sorry.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.2 (01-Apr-19)
 | 
					#### V0.2 (01-Apr-19)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Fixed descriptions and quick fix texts.
 | 
					- Fixed descriptions and quick fix texts.
 | 
				
			||||||
- Fixed highlighting of found problems and 'Run inspection by Name' returning nothing, too.
 | 
					- Fixed highlighting of found problems and 'Run inspection by Name' returning nothing, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### V0.1 (31-Mar-19)
 | 
					#### V0.1 (31-Mar-19)
 | 
				
			||||||
- Initial release.
 | 
					
 | 
				
			||||||
 | 
					- Initial release.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										80
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										80
									
								
								build.gradle
									
									
									
									
									
								
							@ -1,80 +0,0 @@
 | 
				
			|||||||
plugins {
 | 
					 | 
				
			||||||
    id 'java'
 | 
					 | 
				
			||||||
    id 'org.jetbrains.intellij' version '1.1.3'
 | 
					 | 
				
			||||||
    id 'org.jetbrains.kotlin.jvm' version '1.5.21'
 | 
					 | 
				
			||||||
    id 'jacoco'
 | 
					 | 
				
			||||||
    id 'com.github.kt3k.coveralls' version '2.11.0'
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
group 'de.platon42'
 | 
					 | 
				
			||||||
version '1.12'
 | 
					 | 
				
			||||||
sourceCompatibility = "1.8"
 | 
					 | 
				
			||||||
targetCompatibility = "1.8"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
repositories {
 | 
					 | 
				
			||||||
    mavenCentral()
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
  To run tests in IntelliJ use these VM Options for run configuration 
 | 
					 | 
				
			||||||
  -ea -Didea.system.path=build/idea-sandbox/system-test -Didea.config.path=build/idea-sandbox/config-test -Didea.plugins.path=build/idea-sandbox/plugins-test
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
dependencies {
 | 
					 | 
				
			||||||
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
 | 
					 | 
				
			||||||
    testImplementation "org.assertj:assertj-core:3.20.2"
 | 
					 | 
				
			||||||
    testImplementation "org.assertj:assertj-guava:3.4.0"
 | 
					 | 
				
			||||||
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
 | 
					 | 
				
			||||||
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
 | 
					 | 
				
			||||||
    testImplementation "org.jetbrains.kotlin:kotlin-test"
 | 
					 | 
				
			||||||
    testImplementation "org.jetbrains.kotlin:kotlin-reflect"
 | 
					 | 
				
			||||||
//    testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
compileKotlin {
 | 
					 | 
				
			||||||
    kotlinOptions.jvmTarget = "1.8"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
compileTestKotlin {
 | 
					 | 
				
			||||||
    kotlinOptions.jvmTarget = "1.8"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
intellij {
 | 
					 | 
				
			||||||
    setVersion("2021.1.3") // LATEST-EAP-SNAPSHOT
 | 
					 | 
				
			||||||
    //pluginName.set(provider { 'Concise AssertJ Optimizing Nitpicker (Cajon)' })
 | 
					 | 
				
			||||||
    setUpdateSinceUntilBuild(false)
 | 
					 | 
				
			||||||
    setPlugins(["com.intellij.java"])
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
patchPluginXml {
 | 
					 | 
				
			||||||
    setChangeNotes("""
 | 
					 | 
				
			||||||
  <h4>V1.12 (06-May-21)</h4>
 | 
					 | 
				
			||||||
    <ul>
 | 
					 | 
				
			||||||
      <li>Maintenance. Updated various dependencies (Kotlin 1.50.0) and AssertJ 3.19.0
 | 
					 | 
				
			||||||
      <li>Fixed issue#3 reported by hankem where usingRecursiveComparison() was not considered a complex transformation.
 | 
					 | 
				
			||||||
    </ul>
 | 
					 | 
				
			||||||
  <p>Full changelog available at <a href="https://github.com/chrisly42/cajon-plugin#changelog">Github project site</a>.</p>
 | 
					 | 
				
			||||||
""")
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
test {
 | 
					 | 
				
			||||||
    useJUnitPlatform()
 | 
					 | 
				
			||||||
    testLogging {
 | 
					 | 
				
			||||||
        events "passed", "skipped", "failed"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jacoco {
 | 
					 | 
				
			||||||
    toolVersion = '0.8.7'
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jacocoTestReport {
 | 
					 | 
				
			||||||
    reports {
 | 
					 | 
				
			||||||
        xml.required.set(true)
 | 
					 | 
				
			||||||
        csv.required.set(false)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
publishPlugin {
 | 
					 | 
				
			||||||
    setToken(intellijPublishToken)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										131
									
								
								build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,131 @@
 | 
				
			|||||||
 | 
					plugins {
 | 
				
			||||||
 | 
					    id("java")
 | 
				
			||||||
 | 
					    id("org.jetbrains.intellij") version "1.17.1"
 | 
				
			||||||
 | 
					    id("org.jetbrains.kotlin.jvm") version "1.9.22"
 | 
				
			||||||
 | 
					    id("jacoco")
 | 
				
			||||||
 | 
					    id("com.github.kt3k.coveralls") version "2.12.2"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					group = "de.platon42"
 | 
				
			||||||
 | 
					version = "1.14"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					repositories {
 | 
				
			||||||
 | 
					    mavenCentral()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					  To run tests in IntelliJ use these VM Options for run configuration
 | 
				
			||||||
 | 
					  -ea -Didea.system.path=build/idea-sandbox/system-test -Didea.config.path=build/idea-sandbox/config-test -Didea.plugins.path=build/idea-sandbox/plugins-test
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dependencies {
 | 
				
			||||||
 | 
					    //implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
 | 
				
			||||||
 | 
					    testImplementation("org.assertj:assertj-core:3.25.3")
 | 
				
			||||||
 | 
					    testImplementation("org.assertj:assertj-guava:3.25.3")
 | 
				
			||||||
 | 
					    testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
 | 
				
			||||||
 | 
					    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.2")
 | 
				
			||||||
 | 
					    testImplementation("org.jetbrains.kotlin:kotlin-test")
 | 
				
			||||||
 | 
					    testImplementation("org.jetbrains.kotlin:kotlin-reflect")
 | 
				
			||||||
 | 
					    testImplementation("org.junit.platform:junit-platform-launcher:1.10.2")
 | 
				
			||||||
 | 
					//    testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					intellij {
 | 
				
			||||||
 | 
					    version.set("2022.2") // LATEST-EAP-SNAPSHOT
 | 
				
			||||||
 | 
					    //pluginName.set(provider { 'Concise AssertJ Optimizing Nitpicker (Cajon)' })
 | 
				
			||||||
 | 
					    updateSinceUntilBuild.set(false)
 | 
				
			||||||
 | 
					    plugins.set(listOf("com.intellij.java"))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tasks {
 | 
				
			||||||
 | 
					    withType<JavaCompile> {
 | 
				
			||||||
 | 
					        sourceCompatibility = "11"
 | 
				
			||||||
 | 
					        targetCompatibility = "11"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
 | 
				
			||||||
 | 
					        kotlinOptions.jvmTarget = "11"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    test {
 | 
				
			||||||
 | 
					        useJUnitPlatform()
 | 
				
			||||||
 | 
					        testLogging {
 | 
				
			||||||
 | 
					            events("passed", "skipped", "failed")
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    prepareSandbox {
 | 
				
			||||||
 | 
					        enabled = true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    verifyPlugin {
 | 
				
			||||||
 | 
					        enabled = true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    verifyPluginConfiguration {
 | 
				
			||||||
 | 
					        enabled = true
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    patchPluginXml {
 | 
				
			||||||
 | 
					        enabled = true
 | 
				
			||||||
 | 
					        sinceBuild.set("222")
 | 
				
			||||||
 | 
					        changeNotes.set(
 | 
				
			||||||
 | 
					            """
 | 
				
			||||||
 | 
					  <h4>V1.14 (19-Feb-24)</h4>
 | 
				
			||||||
 | 
					    <ul>
 | 
				
			||||||
 | 
					      <li>Now requires minimum version 2022.2.
 | 
				
			||||||
 | 
					      <li>Maintenance. Updated various dependencies (Kotlin 1.9.22) and AssertJ 3.25.3 and AssertJ-Guava 3.25.3.
 | 
				
			||||||
 | 
					      <li>Reworked JUnit 5 test framework to work again. However, all the tests are broken.
 | 
				
			||||||
 | 
					      I spent several days trying to figure out what is going on, but I'm giving up on this pile of crap called IntelliJ. 
 | 
				
			||||||
 | 
					      Jetbrains keeps breaking the APIs and implementations every year and I just cannot be bothered anymore.
 | 
				
			||||||
 | 
					      <li>This is very likely the last version.
 | 
				
			||||||
 | 
					    </ul>
 | 
				
			||||||
 | 
					  <h4>V1.13 (18-Aug-22)</h4>
 | 
				
			||||||
 | 
					    <ul>
 | 
				
			||||||
 | 
					      <li>API change in IntelliJ platforms now requires minimum version 2019.3.1. Sorry, giving up to maintain compatibility after four attempts.
 | 
				
			||||||
 | 
					      <li>Maintenance. Updated various dependencies (Kotlin 1.7.10) and AssertJ 3.23.1 and AssertJ-Guava 3.5.0.
 | 
				
			||||||
 | 
					      <li>Tried to fix unreproducible issue #9.
 | 
				
			||||||
 | 
					      <li>Added AssertThatIsZeroOne inspection demanded by issue #5.
 | 
				
			||||||
 | 
					      <li>Fix for wrongly joining statements that cannot be trivially joined (e.g. with filteredOn). Fixes issue #6.
 | 
				
			||||||
 | 
					    </ul>
 | 
				
			||||||
 | 
					  <p>Full changelog available at <a href="https://git.platon42.de/chrisly42/cajon-plugin#changelog">Gitea project site</a>.</p>
 | 
				
			||||||
 | 
					"""
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    publishPlugin {
 | 
				
			||||||
 | 
					        token.set(System.getProperty("org.gradle.project.intellijPublishToken"))
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    runIde {
 | 
				
			||||||
 | 
					        enabled = true
 | 
				
			||||||
 | 
					        if (project.hasProperty("ideDir")) {
 | 
				
			||||||
 | 
					            ideDir.set(file(project.property("ideDir")!!))
 | 
				
			||||||
 | 
					            jbrVersion.set(project.property("ideJBR")!! as String)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        autoReloadPlugins.set(false)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    runPluginVerifier {
 | 
				
			||||||
 | 
					        ideVersions.set(listOf("IC-222.4167.29", "IC-233.14015.106")) // 2022.2.2 - 2023.3.3
 | 
				
			||||||
 | 
					        downloadDir.set(System.getenv("user.home") + "/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/verifier")
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//tasks.coveralls {
 | 
				
			||||||
 | 
					//    dependsOn(jacocoTestReport)
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//jacoco {
 | 
				
			||||||
 | 
					//    toolVersion = '0.8.8'
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//jacocoTestReport {
 | 
				
			||||||
 | 
					//    reports {
 | 
				
			||||||
 | 
					//        xml.required.set(true)
 | 
				
			||||||
 | 
					//        csv.required.set(false)
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
distributionBase=GRADLE_USER_HOME
 | 
					distributionBase=GRADLE_USER_HOME
 | 
				
			||||||
distributionPath=wrapper/dists
 | 
					distributionPath=wrapper/dists
 | 
				
			||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
 | 
					distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
 | 
				
			||||||
zipStoreBase=GRADLE_USER_HOME
 | 
					zipStoreBase=GRADLE_USER_HOME
 | 
				
			||||||
zipStorePath=wrapper/dists
 | 
					zipStorePath=wrapper/dists
 | 
				
			||||||
 | 
				
			|||||||
@ -12,69 +12,101 @@ class AssertJClassNames {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DESCRIPTABLE_INTERFACE = "org.assertj.core.api.Descriptable"
 | 
					        const val DESCRIPTABLE_INTERFACE = "org.assertj.core.api.Descriptable"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val EXTENSION_POINTS_INTERFACE = "org.assertj.core.api.ExtensionPoints"
 | 
					        const val EXTENSION_POINTS_INTERFACE = "org.assertj.core.api.ExtensionPoints"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ENUMERABLE_ASSERT_INTERFACE = "org.assertj.core.api.EnumerableAssert"
 | 
					        const val ENUMERABLE_ASSERT_INTERFACE = "org.assertj.core.api.EnumerableAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val OBJECT_ENUMERABLE_ASSERT_INTERFACE = "org.assertj.core.api.ObjectEnumerableAssert"
 | 
					        const val OBJECT_ENUMERABLE_ASSERT_INTERFACE = "org.assertj.core.api.ObjectEnumerableAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ASSERT_INTERFACE = "org.assertj.core.api.Assert"
 | 
					        const val ASSERT_INTERFACE = "org.assertj.core.api.Assert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractAssert"
 | 
					        const val ABSTRACT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_OBJECT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractObjectAssert"
 | 
					        const val ABSTRACT_OBJECT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractObjectAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_BOOLEAN_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractBooleanAssert"
 | 
					        const val ABSTRACT_BOOLEAN_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractBooleanAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @NonNls
 | 
				
			||||||
 | 
					        const val ABSTRACT_SHORT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractShortAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_INTEGER_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIntegerAssert"
 | 
					        const val ABSTRACT_INTEGER_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIntegerAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_LONG_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractLongAssert"
 | 
					        const val ABSTRACT_LONG_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractLongAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_FLOAT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFloatAssert"
 | 
					        const val ABSTRACT_FLOAT_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFloatAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_DOUBLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractDoubleAssert"
 | 
					        const val ABSTRACT_DOUBLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractDoubleAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_COMPARABLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractComparableAssert"
 | 
					        const val ABSTRACT_COMPARABLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractComparableAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_STRING_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractStringAssert"
 | 
					        const val ABSTRACT_STRING_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractStringAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_CHAR_SEQUENCE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractCharSequenceAssert"
 | 
					        const val ABSTRACT_CHAR_SEQUENCE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractCharSequenceAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_MAP_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractMapAssert"
 | 
					        const val ABSTRACT_MAP_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractMapAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_BOOLEAN_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractBooleanArrayAssert"
 | 
					        const val ABSTRACT_BOOLEAN_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractBooleanArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_BYTE_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractByteArrayAssert"
 | 
					        const val ABSTRACT_BYTE_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractByteArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_SHORT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractShortArrayAssert"
 | 
					        const val ABSTRACT_SHORT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractShortArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_INT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIntArrayAssert"
 | 
					        const val ABSTRACT_INT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIntArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_LONG_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractLongArrayAssert"
 | 
					        const val ABSTRACT_LONG_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractLongArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_FLOAT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFloatArrayAssert"
 | 
					        const val ABSTRACT_FLOAT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFloatArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_DOUBLE_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractDoubleArrayAssert"
 | 
					        const val ABSTRACT_DOUBLE_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractDoubleArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_CHAR_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractCharArrayAssert"
 | 
					        const val ABSTRACT_CHAR_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractCharArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_OBJECT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractObjectArrayAssert"
 | 
					        const val ABSTRACT_OBJECT_ARRAY_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractObjectArrayAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_ITERABLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIterableAssert"
 | 
					        const val ABSTRACT_ITERABLE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractIterableAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_FILE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFileAssert"
 | 
					        const val ABSTRACT_FILE_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractFileAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ABSTRACT_OPTIONAL_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractOptionalAssert"
 | 
					        const val ABSTRACT_OPTIONAL_ASSERT_CLASSNAME = "org.assertj.core.api.AbstractOptionalAssert"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val EXTRACTORS_CLASSNAME = "org.assertj.core.extractor.Extractors"
 | 
					        const val EXTRACTORS_CLASSNAME = "org.assertj.core.extractor.Extractors"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val GUAVA_OPTIONAL_CLASSNAME = "com.google.common.base.Optional"
 | 
					        const val GUAVA_OPTIONAL_CLASSNAME = "com.google.common.base.Optional"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val GUAVA_ASSERTIONS_CLASSNAME = "org.assertj.guava.api.Assertions"
 | 
					        const val GUAVA_ASSERTIONS_CLASSNAME = "org.assertj.guava.api.Assertions"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val GUAVA_OPTIONAL_ASSERTIONS_CLASSNAME = "org.assertj.guava.api.OptionalAssert"
 | 
					        const val GUAVA_OPTIONAL_ASSERTIONS_CLASSNAME = "org.assertj.guava.api.OptionalAssert"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -50,9 +50,21 @@ val MORE_EXTENSION_POINTS = CallMatcher.instanceCall(
 | 
				
			|||||||
    "singleElement", "hasOnlyOneElementSatisfying", "anyMatch", "noneMatch", "anySatisfy", "noneSatisfy"
 | 
					    "singleElement", "hasOnlyOneElementSatisfying", "anyMatch", "noneMatch", "anySatisfy", "noneSatisfy"
 | 
				
			||||||
)!!
 | 
					)!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					val FILTERED_ON = CallMatcher.instanceCall(AssertJClassNames.ABSTRACT_ITERABLE_ASSERT_CLASSNAME, "filteredOn", "filteredOnNull", "filteredOnAssertions")!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
val COMPLEX_CALLS_THAT_MAKES_STUFF_TRICKY = CallMatcher.anyOf(
 | 
					val COMPLEX_CALLS_THAT_MAKES_STUFF_TRICKY = CallMatcher.anyOf(
 | 
				
			||||||
 | 
					    EXTRACTING_CALL_MATCHERS,
 | 
				
			||||||
    DESCRIBED_AS,
 | 
					    DESCRIBED_AS,
 | 
				
			||||||
    WITH_REPRESENTATION_AND_SUCH,
 | 
					    WITH_REPRESENTATION_AND_SUCH,
 | 
				
			||||||
 | 
					    FILTERED_ON,
 | 
				
			||||||
 | 
					    USING_COMPARATOR,
 | 
				
			||||||
 | 
					    IN_HEXADECIMAL_OR_BINARY
 | 
				
			||||||
 | 
					)!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					val COMPLEX_STUFF_THAT_MAKES_JOINING_IMPOSSIBLE = CallMatcher.anyOf(
 | 
				
			||||||
 | 
					    EXTRACTING_CALL_MATCHERS,
 | 
				
			||||||
 | 
					    WITH_REPRESENTATION_AND_SUCH,
 | 
				
			||||||
 | 
					    FILTERED_ON,
 | 
				
			||||||
    USING_COMPARATOR,
 | 
					    USING_COMPARATOR,
 | 
				
			||||||
    IN_HEXADECIMAL_OR_BINARY
 | 
					    IN_HEXADECIMAL_OR_BINARY
 | 
				
			||||||
)!!
 | 
					)!!
 | 
				
			||||||
 | 
				
			|||||||
@ -115,8 +115,7 @@ fun PsiMethodCallExpression.getExpectedNullNonNullResult(): Boolean? {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun PsiMethodCallExpression.calculateConstantParameterValue(argIndex: Int): Any? {
 | 
					fun PsiMethodCallExpression.calculateConstantParameterValue(argIndex: Int): Any? {
 | 
				
			||||||
    if (argIndex >= argumentList.expressions.size) return null
 | 
					    return getArgOrNull(argIndex)?.calculateConstantValue()
 | 
				
			||||||
    return getArg(argIndex).calculateConstantValue()
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun PsiExpression.calculateConstantValue(): Any? {
 | 
					fun PsiExpression.calculateConstantValue(): Any? {
 | 
				
			||||||
@ -181,4 +180,4 @@ fun PsiExpression.getAllTheSameNullNotNullConstants(): Boolean? {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return lockedResult
 | 
					    return lockedResult
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -17,19 +17,25 @@ class MethodNames {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val AS = "as"
 | 
					        const val AS = "as"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DESCRIBED_AS = "describedAs"
 | 
					        const val DESCRIBED_AS = "describedAs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IN_HEXADECIMAL = "inHexadecimal"
 | 
					        const val IN_HEXADECIMAL = "inHexadecimal"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IN_BINARY = "inBinary"
 | 
					        const val IN_BINARY = "inBinary"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_EQUAL_TO = "isEqualTo"
 | 
					        const val IS_EQUAL_TO = "isEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_EQUAL_TO = "isNotEqualTo"
 | 
					        const val IS_NOT_EQUAL_TO = "isNotEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_SAME_AS = "isSameAs"
 | 
					        const val IS_SAME_AS = "isSameAs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_SAME_AS = "isNotSameAs"
 | 
					        const val IS_NOT_SAME_AS = "isNotSameAs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -38,89 +44,133 @@ class MethodNames {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_GREATER_THAN = "isGreaterThan"
 | 
					        const val IS_GREATER_THAN = "isGreaterThan"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_GREATER_THAN_OR_EQUAL_TO = "isGreaterThanOrEqualTo"
 | 
					        const val IS_GREATER_THAN_OR_EQUAL_TO = "isGreaterThanOrEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_LESS_THAN = "isLessThan"
 | 
					        const val IS_LESS_THAN = "isLessThan"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_LESS_THAN_OR_EQUAL_TO = "isLessThanOrEqualTo"
 | 
					        const val IS_LESS_THAN_OR_EQUAL_TO = "isLessThanOrEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_ZERO = "isZero"
 | 
					        const val IS_ZERO = "isZero"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_ZERO = "isNotZero"
 | 
					        const val IS_NOT_ZERO = "isNotZero"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @NonNls
 | 
				
			||||||
 | 
					        const val IS_ONE = "isOne"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_TRUE = "isTrue"
 | 
					        const val IS_TRUE = "isTrue"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_FALSE = "isFalse"
 | 
					        const val IS_FALSE = "isFalse"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NULL = "isNull" // terminal, returns void
 | 
					        const val IS_NULL = "isNull" // terminal, returns void
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_NULL = "isNotNull"
 | 
					        const val IS_NOT_NULL = "isNotNull"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_CLOSE_TO = "isCloseTo"
 | 
					        const val IS_CLOSE_TO = "isCloseTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_CLOSE_TO = "isNotCloseTo"
 | 
					        const val IS_NOT_CLOSE_TO = "isNotCloseTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_INSTANCE_OF = "isInstanceOf"
 | 
					        const val IS_INSTANCE_OF = "isInstanceOf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_INSTANCE_OF = "isNotInstanceOf"
 | 
					        const val IS_NOT_INSTANCE_OF = "isNotInstanceOf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NULL_OR_EMPTY = "isNullOrEmpty" // terminal, returns void
 | 
					        const val IS_NULL_OR_EMPTY = "isNullOrEmpty" // terminal, returns void
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_EMPTY = "isEmpty" // terminal, returns void
 | 
					        const val IS_EMPTY = "isEmpty" // terminal, returns void
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_EMPTY = "isNotEmpty"
 | 
					        const val IS_NOT_EMPTY = "isNotEmpty"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SIZE = "hasSize"
 | 
					        const val HAS_SIZE = "hasSize"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SIZE_LESS_THAN = "hasSizeLessThan"
 | 
					        const val HAS_SIZE_LESS_THAN = "hasSizeLessThan"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SIZE_LESS_THAN_OR_EQUAL_TO = "hasSizeLessThanOrEqualTo"
 | 
					        const val HAS_SIZE_LESS_THAN_OR_EQUAL_TO = "hasSizeLessThanOrEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SIZE_GREATER_THAN = "hasSizeGreaterThan"
 | 
					        const val HAS_SIZE_GREATER_THAN = "hasSizeGreaterThan"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SIZE_GREATER_THAN_OR_EQUAL_TO = "hasSizeGreaterThanOrEqualTo"
 | 
					        const val HAS_SIZE_GREATER_THAN_OR_EQUAL_TO = "hasSizeGreaterThanOrEqualTo"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val HAS_SAME_SIZE_AS = "hasSameSizeAs"
 | 
					        const val HAS_SAME_SIZE_AS = "hasSameSizeAs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS = "contains"
 | 
					        const val CONTAINS = "contains"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_ONLY_ONCE = "containsOnlyOnce"
 | 
					        const val CONTAINS_ONLY_ONCE = "containsOnlyOnce"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_CONTAIN = "doesNotContain"
 | 
					        const val DOES_NOT_CONTAIN = "doesNotContain"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_EXACTLY = "containsExactly"
 | 
					        const val CONTAINS_EXACTLY = "containsExactly"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_ALL = "containsAll"
 | 
					        const val CONTAINS_ALL = "containsAll"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_KEY = "containsKey"
 | 
					        const val CONTAINS_KEY = "containsKey"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_CONTAIN_KEY = "doesNotContainKey"
 | 
					        const val DOES_NOT_CONTAIN_KEY = "doesNotContainKey"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_VALUE = "containsValue"
 | 
					        const val CONTAINS_VALUE = "containsValue"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_CONTAIN_VALUE = "doesNotContainValue"
 | 
					        const val DOES_NOT_CONTAIN_VALUE = "doesNotContainValue"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_ENTRY = "containsEntry"
 | 
					        const val CONTAINS_ENTRY = "containsEntry"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_CONTAIN_ENTRY = "doesNotContainEntry"
 | 
					        const val DOES_NOT_CONTAIN_ENTRY = "doesNotContainEntry"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_EQUAL_TO_IC = "isEqualToIgnoringCase"
 | 
					        const val IS_EQUAL_TO_IC = "isEqualToIgnoringCase"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_EQUAL_TO_IC = "isNotEqualToIgnoringCase"
 | 
					        const val IS_NOT_EQUAL_TO_IC = "isNotEqualToIgnoringCase"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val STARTS_WITH = "startsWith"
 | 
					        const val STARTS_WITH = "startsWith"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val ENDS_WITH = "endsWith"
 | 
					        const val ENDS_WITH = "endsWith"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_START_WITH = "doesNotStartWith"
 | 
					        const val DOES_NOT_START_WITH = "doesNotStartWith"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val DOES_NOT_END_WITH = "doesNotEndWith"
 | 
					        const val DOES_NOT_END_WITH = "doesNotEndWith"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val CONTAINS_SAME = "containsSame"
 | 
					        const val CONTAINS_SAME = "containsSame"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_PRESENT = "isPresent"
 | 
					        const val IS_PRESENT = "isPresent"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNls
 | 
					        @NonNls
 | 
				
			||||||
        const val IS_NOT_PRESENT = "isNotPresent"
 | 
					        const val IS_NOT_PRESENT = "isNotPresent"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@ import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_D
 | 
				
			|||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_FLOAT_ASSERT_CLASSNAME
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_FLOAT_ASSERT_CLASSNAME
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_INTEGER_ASSERT_CLASSNAME
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_INTEGER_ASSERT_CLASSNAME
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_LONG_ASSERT_CLASSNAME
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_LONG_ASSERT_CLASSNAME
 | 
				
			||||||
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_SHORT_ASSERT_CLASSNAME
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_STRING_ASSERT_CLASSNAME
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ABSTRACT_STRING_ASSERT_CLASSNAME
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ASSERTIONS_CLASSNAME
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ASSERTIONS_CLASSNAME
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ASSERT_INTERFACE
 | 
					import de.platon42.intellij.plugins.cajon.AssertJClassNames.Companion.ASSERT_INTERFACE
 | 
				
			||||||
@ -88,6 +89,8 @@ abstract class AbstractAssertJInspection : AbstractBaseJavaLocalInspectionTool()
 | 
				
			|||||||
            .parameterTypes(CommonClassNames.JAVA_LANG_OBJECT)!!
 | 
					            .parameterTypes(CommonClassNames.JAVA_LANG_OBJECT)!!
 | 
				
			||||||
        val IS_EQUAL_TO_STRING = CallMatcher.instanceCall(ABSTRACT_STRING_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
					        val IS_EQUAL_TO_STRING = CallMatcher.instanceCall(ABSTRACT_STRING_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
				
			||||||
            .parameterTypes(CommonClassNames.JAVA_LANG_STRING)!!
 | 
					            .parameterTypes(CommonClassNames.JAVA_LANG_STRING)!!
 | 
				
			||||||
 | 
					        val IS_EQUAL_TO_SHORT = CallMatcher.instanceCall(ABSTRACT_SHORT_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
				
			||||||
 | 
					            .parameterTypes("short")!!
 | 
				
			||||||
        val IS_EQUAL_TO_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
					        val IS_EQUAL_TO_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
				
			||||||
            .parameterTypes("int")!!
 | 
					            .parameterTypes("int")!!
 | 
				
			||||||
        val IS_EQUAL_TO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
					        val IS_EQUAL_TO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_EQUAL_TO)
 | 
				
			||||||
@ -103,6 +106,8 @@ abstract class AbstractAssertJInspection : AbstractBaseJavaLocalInspectionTool()
 | 
				
			|||||||
            .parameterTypes(CommonClassNames.JAVA_LANG_OBJECT)!!
 | 
					            .parameterTypes(CommonClassNames.JAVA_LANG_OBJECT)!!
 | 
				
			||||||
        val IS_NOT_EQUAL_TO_BOOLEAN = CallMatcher.instanceCall(ABSTRACT_BOOLEAN_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
					        val IS_NOT_EQUAL_TO_BOOLEAN = CallMatcher.instanceCall(ABSTRACT_BOOLEAN_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
				
			||||||
            .parameterTypes("boolean")!!
 | 
					            .parameterTypes("boolean")!!
 | 
				
			||||||
 | 
					        val IS_NOT_EQUAL_TO_SHORT = CallMatcher.instanceCall(ABSTRACT_SHORT_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
				
			||||||
 | 
					            .parameterTypes("short")!!
 | 
				
			||||||
        val IS_NOT_EQUAL_TO_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
					        val IS_NOT_EQUAL_TO_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
				
			||||||
            .parameterTypes("int")!!
 | 
					            .parameterTypes("int")!!
 | 
				
			||||||
        val IS_NOT_EQUAL_TO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
					        val IS_NOT_EQUAL_TO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_NOT_EQUAL_TO)
 | 
				
			||||||
@ -155,15 +160,15 @@ abstract class AbstractAssertJInspection : AbstractBaseJavaLocalInspectionTool()
 | 
				
			|||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_NOT_ZERO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_NOT_ZERO)
 | 
					        val IS_NOT_ZERO_LONG = CallMatcher.instanceCall(ABSTRACT_LONG_ASSERT_CLASSNAME, MethodNames.IS_NOT_ZERO)
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_ONE = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isOne")
 | 
					        val IS_ONE_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isOne")
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_NEGATIVE = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNegative")
 | 
					        val IS_NEGATIVE_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNegative")
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_NOT_NEGATIVE = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNotNegative")
 | 
					        val IS_NOT_NEGATIVE_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNotNegative")
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_POSITIVE = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isPositive")
 | 
					        val IS_POSITIVE_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isPositive")
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
        val IS_NOT_POSITIVE = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNotPositive")
 | 
					        val IS_NOT_POSITIVE_INT = CallMatcher.instanceCall(ABSTRACT_INTEGER_ASSERT_CLASSNAME, "isNotPositive")
 | 
				
			||||||
            .parameterCount(0)!!
 | 
					            .parameterCount(0)!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        val IS_TRUE = CallMatcher.instanceCall(ABSTRACT_BOOLEAN_ASSERT_CLASSNAME, MethodNames.IS_TRUE)
 | 
					        val IS_TRUE = CallMatcher.instanceCall(ABSTRACT_BOOLEAN_ASSERT_CLASSNAME, MethodNames.IS_TRUE)
 | 
				
			||||||
@ -302,4 +307,4 @@ abstract class AbstractAssertJInspection : AbstractBaseJavaLocalInspectionTool()
 | 
				
			|||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
        registerConciseMethod(REMOVE_EXPECTED_OUTMOST_DESCRIPTION_TEMPLATE, holder, expression, oldExpectedCallExpression, replacementMethod, quickFixSupplier)
 | 
					        registerConciseMethod(REMOVE_EXPECTED_OUTMOST_DESCRIPTION_TEMPLATE, holder, expression, oldExpectedCallExpression, replacementMethod, quickFixSupplier)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -52,7 +52,7 @@ class AssertThatComparableInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                COMPARABLE_COMPARE_TO,
 | 
					                COMPARABLE_COMPARE_TO,
 | 
				
			||||||
                MethodNames.IS_GREATER_THAN_OR_EQUAL_TO, expectedMatcher = IS_NOT_NEGATIVE, replaceFromOriginalMethod = true
 | 
					                MethodNames.IS_GREATER_THAN_OR_EQUAL_TO, expectedMatcher = IS_NOT_NEGATIVE_INT, replaceFromOriginalMethod = true
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
@ -67,7 +67,7 @@ class AssertThatComparableInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                COMPARABLE_COMPARE_TO,
 | 
					                COMPARABLE_COMPARE_TO,
 | 
				
			||||||
                MethodNames.IS_GREATER_THAN, expectedMatcher = CallMatcher.anyOf(IS_POSITIVE, IS_ONE), replaceFromOriginalMethod = true
 | 
					                MethodNames.IS_GREATER_THAN, expectedMatcher = CallMatcher.anyOf(IS_POSITIVE_INT, IS_ONE_INT), replaceFromOriginalMethod = true
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
@ -82,7 +82,7 @@ class AssertThatComparableInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                COMPARABLE_COMPARE_TO,
 | 
					                COMPARABLE_COMPARE_TO,
 | 
				
			||||||
                MethodNames.IS_LESS_THAN_OR_EQUAL_TO, expectedMatcher = IS_NOT_POSITIVE, replaceFromOriginalMethod = true
 | 
					                MethodNames.IS_LESS_THAN_OR_EQUAL_TO, expectedMatcher = IS_NOT_POSITIVE_INT, replaceFromOriginalMethod = true
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
@ -97,7 +97,7 @@ class AssertThatComparableInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                COMPARABLE_COMPARE_TO,
 | 
					                COMPARABLE_COMPARE_TO,
 | 
				
			||||||
                MethodNames.IS_LESS_THAN, expectedMatcher = IS_NEGATIVE, replaceFromOriginalMethod = true
 | 
					                MethodNames.IS_LESS_THAN, expectedMatcher = IS_NEGATIVE_INT, replaceFromOriginalMethod = true
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,81 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.codeInspection.ProblemsHolder
 | 
				
			||||||
 | 
					import com.intellij.psi.JavaElementVisitor
 | 
				
			||||||
 | 
					import com.intellij.psi.PsiElementVisitor
 | 
				
			||||||
 | 
					import com.intellij.psi.PsiMethodCallExpression
 | 
				
			||||||
 | 
					import com.intellij.psi.util.TypeConversionUtil
 | 
				
			||||||
 | 
					import com.siyeh.ig.callMatcher.CallMatcher
 | 
				
			||||||
 | 
					import de.platon42.intellij.plugins.cajon.*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AssertThatIsZeroOneInspection : AbstractAssertJInspection() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    companion object {
 | 
				
			||||||
 | 
					        private const val DISPLAY_NAME = "Asserting a zero or one value"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    override fun getDisplayName() = DISPLAY_NAME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
 | 
				
			||||||
 | 
					        return object : JavaElementVisitor() {
 | 
				
			||||||
 | 
					            override fun visitMethodCallExpression(expression: PsiMethodCallExpression) {
 | 
				
			||||||
 | 
					                super.visitMethodCallExpression(expression)
 | 
				
			||||||
 | 
					                if (!expression.hasAssertThat()) return
 | 
				
			||||||
 | 
					                val isEqualTo = CallMatcher.anyOf(IS_EQUAL_TO_OBJECT, IS_EQUAL_TO_SHORT, IS_EQUAL_TO_INT, IS_EQUAL_TO_LONG, IS_EQUAL_TO_FLOAT, IS_EQUAL_TO_DOUBLE).test(expression)
 | 
				
			||||||
 | 
					                val isNotEqualTo =
 | 
				
			||||||
 | 
					                    CallMatcher.anyOf(IS_NOT_EQUAL_TO_OBJECT, IS_NOT_EQUAL_TO_SHORT, IS_NOT_EQUAL_TO_INT, IS_NOT_EQUAL_TO_LONG, IS_NOT_EQUAL_TO_FLOAT, IS_NOT_EQUAL_TO_DOUBLE)
 | 
				
			||||||
 | 
					                        .test(expression)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (!(isEqualTo || isNotEqualTo)) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                val expectedExpression = expression.firstArg
 | 
				
			||||||
 | 
					                if (!TypeConversionUtil.isNumericType(expectedExpression.type)) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                val expectedResult = expression.calculateConstantParameterValue(0) ?: return
 | 
				
			||||||
 | 
					                var isZero = false
 | 
				
			||||||
 | 
					                var isOne = false
 | 
				
			||||||
 | 
					                when (expectedResult) {
 | 
				
			||||||
 | 
					                    is Short -> {
 | 
				
			||||||
 | 
					                        isZero = (expectedResult == 0.toShort())
 | 
				
			||||||
 | 
					                        isOne = (expectedResult == 1.toShort())
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    is Int -> {
 | 
				
			||||||
 | 
					                        isZero = (expectedResult == 0)
 | 
				
			||||||
 | 
					                        isOne = (expectedResult == 1)
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    is Long -> {
 | 
				
			||||||
 | 
					                        isZero = (expectedResult == 0L)
 | 
				
			||||||
 | 
					                        isOne = (expectedResult == 1L)
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    is Float -> {
 | 
				
			||||||
 | 
					                        isZero = (expectedResult == 0.0f)
 | 
				
			||||||
 | 
					                        isOne = (expectedResult == 1.0f)
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    is Double -> {
 | 
				
			||||||
 | 
					                        isZero = (expectedResult == 0.0)
 | 
				
			||||||
 | 
					                        isOne = (expectedResult == 1.0)
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (isZero || isOne) {
 | 
				
			||||||
 | 
					                    val numericBaseClass = listOf(
 | 
				
			||||||
 | 
					                        AssertJClassNames.ABSTRACT_SHORT_ASSERT_CLASSNAME,
 | 
				
			||||||
 | 
					                        AssertJClassNames.ABSTRACT_INTEGER_ASSERT_CLASSNAME,
 | 
				
			||||||
 | 
					                        AssertJClassNames.ABSTRACT_LONG_ASSERT_CLASSNAME,
 | 
				
			||||||
 | 
					                        AssertJClassNames.ABSTRACT_FLOAT_ASSERT_CLASSNAME,
 | 
				
			||||||
 | 
					                        AssertJClassNames.ABSTRACT_DOUBLE_ASSERT_CLASSNAME
 | 
				
			||||||
 | 
					                    ).any { checkAssertedType(expression, it) }
 | 
				
			||||||
 | 
					                    if (!numericBaseClass) return
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (isZero) {
 | 
				
			||||||
 | 
					                    registerSimplifyMethod(holder, expression, isEqualTo.map(MethodNames.IS_ZERO, MethodNames.IS_NOT_ZERO))
 | 
				
			||||||
 | 
					                } else if (isOne && isEqualTo) {
 | 
				
			||||||
 | 
					                    registerSimplifyMethod(holder, expression, MethodNames.IS_ONE)
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -76,4 +76,4 @@ class AssertThatJava8OptionalInspection : AbstractAssertJInspection() {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -32,4 +32,4 @@ class AssertThatObjectIsNullOrNotNullInspection : AbstractAssertJInspection() {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,7 @@ class AssertThatStringExpressionInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                STRING_INDEX_OF,
 | 
					                STRING_INDEX_OF,
 | 
				
			||||||
                MethodNames.CONTAINS, expectedMatcher = IS_NOT_NEGATIVE, replaceFromOriginalMethod = true
 | 
					                MethodNames.CONTAINS, expectedMatcher = IS_NOT_NEGATIVE_INT, replaceFromOriginalMethod = true
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                STRING_INDEX_OF,
 | 
					                STRING_INDEX_OF,
 | 
				
			||||||
@ -119,7 +119,7 @@ class AssertThatStringExpressionInspection : AbstractMoveOutInspection() {
 | 
				
			|||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                STRING_INDEX_OF,
 | 
					                STRING_INDEX_OF,
 | 
				
			||||||
                MethodNames.DOES_NOT_CONTAIN, expectedMatcher = IS_NEGATIVE, replaceFromOriginalMethod = true
 | 
					                MethodNames.DOES_NOT_CONTAIN, expectedMatcher = IS_NEGATIVE_INT, replaceFromOriginalMethod = true
 | 
				
			||||||
            ),
 | 
					            ),
 | 
				
			||||||
            MoveOutMapping(
 | 
					            MoveOutMapping(
 | 
				
			||||||
                STRING_INDEX_OF,
 | 
					                STRING_INDEX_OF,
 | 
				
			||||||
 | 
				
			|||||||
@ -72,7 +72,7 @@ class JoinAssertThatStatementsInspection : AbstractAssertJInspection() {
 | 
				
			|||||||
                    if (!statement.hasAssertThat()) return null
 | 
					                    if (!statement.hasAssertThat()) return null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    val assertThatCall = PsiTreeUtil.findChildrenOfType(statement, PsiMethodCallExpression::class.java).find { ALL_ASSERT_THAT_MATCHERS.test(it) }
 | 
					                    val assertThatCall = PsiTreeUtil.findChildrenOfType(statement, PsiMethodCallExpression::class.java).find { ALL_ASSERT_THAT_MATCHERS.test(it) }
 | 
				
			||||||
                    return assertThatCall?.takeIf { it.findFluentCallTo(EXTRACTING_CALL_MATCHERS) == null }
 | 
					                    return assertThatCall?.takeIf { it.findFluentCallTo(COMPLEX_STUFF_THAT_MAKES_JOINING_IMPOSSIBLE) == null }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return null
 | 
					                return null
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -83,6 +83,7 @@ class JoinAssertThatStatementsInspection : AbstractAssertJInspection() {
 | 
				
			|||||||
                    val matched = when (element) {
 | 
					                    val matched = when (element) {
 | 
				
			||||||
                        is PsiUnaryExpression -> (element.operationTokenType == JavaTokenType.PLUSPLUS)
 | 
					                        is PsiUnaryExpression -> (element.operationTokenType == JavaTokenType.PLUSPLUS)
 | 
				
			||||||
                                || (element.operationTokenType == JavaTokenType.MINUSMINUS)
 | 
					                                || (element.operationTokenType == JavaTokenType.MINUSMINUS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        is PsiMethodCallExpression -> KNOWN_METHODS_WITH_SIDE_EFFECTS.test(element)
 | 
					                        is PsiMethodCallExpression -> KNOWN_METHODS_WITH_SIDE_EFFECTS.test(element)
 | 
				
			||||||
                        else -> false
 | 
					                        else -> false
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
				
			|||||||
@ -56,9 +56,8 @@ class JoinStatementsQuickFix(private val separateLineLimit: Int) : AbstractCommo
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun addLineBreak(project: Project, lastElementBeforeConcat: PsiElement) {
 | 
					    private fun addLineBreak(project: Project, lastElementBeforeConcat: PsiElement) {
 | 
				
			||||||
        val newLineNode =
 | 
					        // was PsiParserFacade.getInstance(project).createWhiteSpaceFromText("\n\t"), changed due to breaking API changes
 | 
				
			||||||
            PsiParserFacade.SERVICE.getInstance(project).createWhiteSpaceFromText("\n\t")
 | 
					        val newLineNode = project.getService(PsiParserFacade::class.java).createWhiteSpaceFromText("\n\t")
 | 
				
			||||||
 | 
					 | 
				
			||||||
        lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
 | 
					        lastElementBeforeConcat.addAfter(newLineNode, lastElementBeforeConcat.firstChild)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,7 @@
 | 
				
			|||||||
<idea-plugin>
 | 
					<idea-plugin>
 | 
				
			||||||
    <id>de.platon42.cajon</id>
 | 
					    <id>de.platon42.cajon</id>
 | 
				
			||||||
    <name>Concise AssertJ Optimizing Nitpicker (Cajon)</name>
 | 
					    <name>Concise AssertJ Optimizing Nitpicker (Cajon)</name>
 | 
				
			||||||
    <vendor email="chrisly@platon42.de" url="https://github.com/chrisly42/cajon-plugin">Chris 'platon42' Hodges</vendor>
 | 
					    <vendor email="chrisly@platon42.de" url="https://git.platon42.de/chrisly42/cajon-plugin">Chris 'platon42' Hodges</vendor>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <description><![CDATA[
 | 
					    <description><![CDATA[
 | 
				
			||||||
    Cajon is an IntelliJ IDEA Plugin for shortening and optimizing AssertJ assertions.
 | 
					    Cajon is an IntelliJ IDEA Plugin for shortening and optimizing AssertJ assertions.
 | 
				
			||||||
@ -14,8 +14,6 @@
 | 
				
			|||||||
    <a href="https://github.com/chrisly42/cajon-plugin/blob/master/README.md">Full documentation here...</a>
 | 
					    <a href="https://github.com/chrisly42/cajon-plugin/blob/master/README.md">Full documentation here...</a>
 | 
				
			||||||
    ]]></description>
 | 
					    ]]></description>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <idea-version since-build="173.2696.26"/>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <depends>com.intellij.modules.lang</depends>
 | 
					    <depends>com.intellij.modules.lang</depends>
 | 
				
			||||||
    <depends>com.intellij.modules.platform</depends>
 | 
					    <depends>com.intellij.modules.platform</depends>
 | 
				
			||||||
    <depends>com.intellij.modules.java</depends>
 | 
					    <depends>com.intellij.modules.java</depends>
 | 
				
			||||||
@ -28,6 +26,8 @@
 | 
				
			|||||||
                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatBooleanConditionInspection"/>
 | 
					                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatBooleanConditionInspection"/>
 | 
				
			||||||
        <localInspection groupPath="Java" shortName="AssertThatInvertedBooleanCondition" enabledByDefault="true" level="WARNING"
 | 
					        <localInspection groupPath="Java" shortName="AssertThatInvertedBooleanCondition" enabledByDefault="true" level="WARNING"
 | 
				
			||||||
                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatInvertedBooleanConditionInspection"/>
 | 
					                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatInvertedBooleanConditionInspection"/>
 | 
				
			||||||
 | 
					        <localInspection groupPath="Java" shortName="AssertThatIsZeroOne" enabledByDefault="true" level="WARNING"
 | 
				
			||||||
 | 
					                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatIsZeroOneInspection"/>
 | 
				
			||||||
        <localInspection groupPath="Java" shortName="AssertThatInstanceOf" enabledByDefault="true" level="WARNING"
 | 
					        <localInspection groupPath="Java" shortName="AssertThatInstanceOf" enabledByDefault="true" level="WARNING"
 | 
				
			||||||
                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatInstanceOfInspection"/>
 | 
					                         implementationClass="de.platon42.intellij.plugins.cajon.inspections.AssertThatInstanceOfInspection"/>
 | 
				
			||||||
        <localInspection groupPath="Java" shortName="AssertThatStringIsEmpty" enabledByDefault="true" level="WARNING"
 | 
					        <localInspection groupPath="Java" shortName="AssertThatStringIsEmpty" enabledByDefault="true" level="WARNING"
 | 
				
			||||||
@ -79,4 +79,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <actions>
 | 
					    <actions>
 | 
				
			||||||
    </actions>
 | 
					    </actions>
 | 
				
			||||||
</idea-plugin>
 | 
					</idea-plugin>
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					<html>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					Turns assertThat(numeric).isEqualTo(0/1) into assertThat(numeric).isZero()/isOne()
 | 
				
			||||||
 | 
					or assertThat(numeric).isNotEqualTo(0) into assertThat(numeric).isNotZero().
 | 
				
			||||||
 | 
					<!-- tooltip end -->
 | 
				
			||||||
 | 
					<br>Also works with constant expressions.
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
@ -0,0 +1,151 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.jarRepository.JarRepositoryManager
 | 
				
			||||||
 | 
					import com.intellij.jarRepository.RemoteRepositoryDescription
 | 
				
			||||||
 | 
					import com.intellij.openapi.module.Module
 | 
				
			||||||
 | 
					import com.intellij.openapi.roots.ContentEntry
 | 
				
			||||||
 | 
					import com.intellij.openapi.roots.DependencyScope
 | 
				
			||||||
 | 
					import com.intellij.openapi.roots.ModifiableRootModel
 | 
				
			||||||
 | 
					import com.intellij.openapi.vfs.LocalFileSystem
 | 
				
			||||||
 | 
					import com.intellij.testFramework.IdeaTestUtil
 | 
				
			||||||
 | 
					import com.intellij.testFramework.LightProjectDescriptor
 | 
				
			||||||
 | 
					import com.intellij.testFramework.PlatformTestUtil
 | 
				
			||||||
 | 
					import com.intellij.testFramework.PsiTestUtil
 | 
				
			||||||
 | 
					import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
 | 
				
			||||||
 | 
					import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
				
			||||||
 | 
					import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
 | 
				
			||||||
 | 
					import com.intellij.testFramework.rules.TestNameExtension
 | 
				
			||||||
 | 
					import org.jetbrains.idea.maven.utils.library.RepositoryLibraryProperties
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.AfterEachCallback
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.BeforeEachCallback
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.ExtensionContext
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.RegisterExtension
 | 
				
			||||||
 | 
					import java.nio.file.Paths
 | 
				
			||||||
 | 
					import java.util.*
 | 
				
			||||||
 | 
					import java.util.function.Consumer
 | 
				
			||||||
 | 
					import java.util.stream.Collectors
 | 
				
			||||||
 | 
					import java.util.stream.Stream
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					abstract class AbstractJUnit5TestCase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RegisterExtension
 | 
				
			||||||
 | 
					    protected val testNameRule = TestNameExtension()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RegisterExtension
 | 
				
			||||||
 | 
					    protected val edtInterceptorExtension = EdtInterceptorExtension()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected fun getTestName(lowercaseFirstLetter: Boolean): String {
 | 
				
			||||||
 | 
					        return PlatformTestUtil.getTestName(testNameRule.methodName, lowercaseFirstLetter)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @RegisterExtension
 | 
				
			||||||
 | 
					    private val testCase = object : LightJavaCodeInsightFixtureTestCase(), BeforeEachCallback, AfterEachCallback {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        lateinit var extensionContext: ExtensionContext
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        override fun getProjectDescriptor(): LightProjectDescriptor {
 | 
				
			||||||
 | 
					            val testJdk = getMethodOrClassAnnotation(TestJdk::class.java) ?: return super.getProjectDescriptor()
 | 
				
			||||||
 | 
					            val projectDescriptor: DefaultLightProjectDescriptor = object : DefaultLightProjectDescriptor({ IdeaTestUtil.getMockJdk(testJdk.value.toJavaVersion()) }) {
 | 
				
			||||||
 | 
					                override fun configureModule(module: Module, model: ModifiableRootModel, contentEntry: ContentEntry) {
 | 
				
			||||||
 | 
					                    super.configureModule(module, model, contentEntry)
 | 
				
			||||||
 | 
					                    val localJars = getMethodOrClassAnnotation(AddLocalJarToModule::class.java)
 | 
				
			||||||
 | 
					                    if (localJars != null) {
 | 
				
			||||||
 | 
					                        localJars.value.forEach {
 | 
				
			||||||
 | 
					                            addJarContaining(
 | 
				
			||||||
 | 
					                                model,
 | 
				
			||||||
 | 
					                                it.java
 | 
				
			||||||
 | 
					                            )
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    val mavenDependencies = getMethodOrClassAnnotations(AddMavenDependencyToModule::class.java)
 | 
				
			||||||
 | 
					                    mavenDependencies.forEach(Consumer { it: AddMavenDependencyToModule ->
 | 
				
			||||||
 | 
					                        addFromMaven(
 | 
				
			||||||
 | 
					                            model,
 | 
				
			||||||
 | 
					                            it.value,
 | 
				
			||||||
 | 
					                            it.includeTransitiveDependencies,
 | 
				
			||||||
 | 
					                            it.scope
 | 
				
			||||||
 | 
					                        )
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return projectDescriptor
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun addJarContaining(model: ModifiableRootModel?, clazz: Class<*>) {
 | 
				
			||||||
 | 
					            val filename = clazz.getResource(clazz.simpleName + ".class").file
 | 
				
			||||||
 | 
					            val jarName = filename.substring(0, filename.indexOf(".jar") + 4).removePrefix("file:")
 | 
				
			||||||
 | 
					            val jarPath = Paths.get(jarName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            val jarFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(jarName)
 | 
				
			||||||
 | 
					            myFixture.allowTreeAccessForFile(jarFile!!)
 | 
				
			||||||
 | 
					            PsiTestUtil.addLibrary(
 | 
				
			||||||
 | 
					                model!!,
 | 
				
			||||||
 | 
					                jarPath.fileName.toString().replace(".jar", ""),
 | 
				
			||||||
 | 
					                jarPath.parent.toString(),
 | 
				
			||||||
 | 
					                jarPath.fileName.toString()
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun addFromMaven(
 | 
				
			||||||
 | 
					            model: ModifiableRootModel, mavenCoordinates: String,
 | 
				
			||||||
 | 
					            includeTransitiveDependencies: Boolean, dependencyScope: DependencyScope?
 | 
				
			||||||
 | 
					        ) {
 | 
				
			||||||
 | 
					            val remoteRepositoryDescriptions = RemoteRepositoryDescription.DEFAULT_REPOSITORIES
 | 
				
			||||||
 | 
					            val libraryProperties = RepositoryLibraryProperties(mavenCoordinates, includeTransitiveDependencies)
 | 
				
			||||||
 | 
					            val roots =
 | 
				
			||||||
 | 
					                JarRepositoryManager.loadDependenciesModal(model.project, libraryProperties, false, false, null, remoteRepositoryDescriptions)
 | 
				
			||||||
 | 
					            val tableModel = model.moduleLibraryTable.modifiableModel
 | 
				
			||||||
 | 
					            val library = tableModel.createLibrary(mavenCoordinates)
 | 
				
			||||||
 | 
					            val libraryModel = library.modifiableModel
 | 
				
			||||||
 | 
					            check(!roots.isEmpty()) { String.format("No roots for '%s'", mavenCoordinates) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            for (root in roots) {
 | 
				
			||||||
 | 
					                libraryModel.addRoot(root.file, root.type)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            val libraryOrderEntry = model.findLibraryOrderEntry(library) ?: throw java.lang.IllegalStateException("Unable to find registered library $mavenCoordinates")
 | 
				
			||||||
 | 
					            libraryOrderEntry.scope = dependencyScope!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            libraryModel.commit()
 | 
				
			||||||
 | 
					            tableModel.commit()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        override fun getTestDataPath(): String {
 | 
				
			||||||
 | 
					            val testDataPath = getMethodOrClassAnnotation(TestDataPath::class.java) ?: return super.getTestDataPath()
 | 
				
			||||||
 | 
					            val testDataSubPath = getMethodOrClassAnnotation(TestDataSubPath::class.java) ?: return testDataPath.value
 | 
				
			||||||
 | 
					            return Paths.get(testDataPath.value, testDataSubPath.value).toString()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fun getMyFixture(): JavaCodeInsightTestFixture = myFixture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private fun <T : Annotation?> getMethodOrClassAnnotation(clazz: Class<T>): T? {
 | 
				
			||||||
 | 
					            var annotation = extensionContext.requiredTestMethod.getAnnotation(clazz)
 | 
				
			||||||
 | 
					            if (annotation == null) {
 | 
				
			||||||
 | 
					                annotation = extensionContext.requiredTestClass.getAnnotation(clazz)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return annotation
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private fun <T : Annotation?> getMethodOrClassAnnotations(clazz: Class<T>): List<T> {
 | 
				
			||||||
 | 
					            return Stream.of(
 | 
				
			||||||
 | 
					                extensionContext.requiredTestMethod.getAnnotationsByType(clazz),
 | 
				
			||||||
 | 
					                extensionContext.requiredTestClass.getAnnotationsByType(clazz)
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					                .flatMap { array: Array<T>? -> Arrays.stream(array) }
 | 
				
			||||||
 | 
					                .collect(Collectors.toList())
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        override fun beforeEach(context: ExtensionContext) {
 | 
				
			||||||
 | 
					            extensionContext = context
 | 
				
			||||||
 | 
					            setUp()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        override fun afterEach(context: ExtensionContext) {
 | 
				
			||||||
 | 
					            tearDown()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected val fixture: JavaCodeInsightTestFixture get() = testCase.getMyFixture()
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
@Inherited
 | 
					 | 
				
			||||||
public @interface AddLocalJarToModule {
 | 
					 | 
				
			||||||
    Class<?>[] value();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.annotation.Inherited
 | 
				
			||||||
 | 
					import kotlin.reflect.KClass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					@Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					@Inherited
 | 
				
			||||||
 | 
					annotation class AddLocalJarToModule(vararg val value: KClass<*>)
 | 
				
			||||||
@ -1,24 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.DependencyScope;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
@Inherited
 | 
					 | 
				
			||||||
@Repeatable(AddMavenDependencyToModule.List.class)
 | 
					 | 
				
			||||||
public @interface AddMavenDependencyToModule {
 | 
					 | 
				
			||||||
    String value();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    boolean includeTransitiveDependencies = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    DependencyScope scope = DependencyScope.COMPILE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
    @Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
    @Inherited
 | 
					 | 
				
			||||||
    @interface List {
 | 
					 | 
				
			||||||
        AddMavenDependencyToModule[] value();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.openapi.roots.DependencyScope
 | 
				
			||||||
 | 
					import java.lang.annotation.Inherited
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					@Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					@Inherited
 | 
				
			||||||
 | 
					@JvmRepeatable(
 | 
				
			||||||
 | 
					    AddMavenDependencyToModule.List::class
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					annotation class AddMavenDependencyToModule(val value: String, val includeTransitiveDependencies: Boolean = false, val scope: DependencyScope = DependencyScope.COMPILE) {
 | 
				
			||||||
 | 
					    @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					    @Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					    @Inherited
 | 
				
			||||||
 | 
					    annotation class List(vararg val value: AddMavenDependencyToModule)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,50 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.testFramework.TestLoggerFactory
 | 
				
			||||||
 | 
					import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy
 | 
				
			||||||
 | 
					import com.intellij.testFramework.runInEdtAndWait
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.ExtensionContext
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.InvocationInterceptor
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.extension.ReflectiveInvocationContext
 | 
				
			||||||
 | 
					import java.lang.reflect.Method
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class EdtInterceptorExtension : InvocationInterceptor {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    override fun interceptTestMethod(
 | 
				
			||||||
 | 
					        invocation: InvocationInterceptor.Invocation<Void>,
 | 
				
			||||||
 | 
					        invocationContext: ReflectiveInvocationContext<Method>,
 | 
				
			||||||
 | 
					        extensionContext: ExtensionContext
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
 | 
					        val throwables = arrayOfNulls<Throwable>(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        val runnable = Runnable {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                TestLoggerFactory.onTestStarted()
 | 
				
			||||||
 | 
					                invocation.proceed()
 | 
				
			||||||
 | 
					                TestLoggerFactory.onTestFinished(true, extensionContext.displayName)
 | 
				
			||||||
 | 
					            } catch (e: Throwable) {
 | 
				
			||||||
 | 
					                TestLoggerFactory.onTestFinished(false, extensionContext.displayName)
 | 
				
			||||||
 | 
					                throwables[0] = e
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        invokeTestRunnable(runnable)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (throwables[0] != null) {
 | 
				
			||||||
 | 
					            throw throwables[0]!!
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    companion object {
 | 
				
			||||||
 | 
					        private fun invokeTestRunnable(runnable: Runnable) {
 | 
				
			||||||
 | 
					            val policy = IdeaTestExecutionPolicy.current()
 | 
				
			||||||
 | 
					            if (policy != null && !policy.runInDispatchThread()) {
 | 
				
			||||||
 | 
					                runnable.run()
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                runInEdtAndWait {
 | 
				
			||||||
 | 
					                    runnable.run()
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,259 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.intellij.jarRepository.JarRepositoryManager;
 | 
					 | 
				
			||||||
import com.intellij.jarRepository.RemoteRepositoryDescription;
 | 
					 | 
				
			||||||
import com.intellij.openapi.Disposable;
 | 
					 | 
				
			||||||
import com.intellij.openapi.module.Module;
 | 
					 | 
				
			||||||
import com.intellij.openapi.projectRoots.Sdk;
 | 
					 | 
				
			||||||
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.ContentEntry;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.DependencyScope;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.LibraryOrderEntry;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.ModifiableRootModel;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.libraries.Library;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.libraries.LibraryTable;
 | 
					 | 
				
			||||||
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
 | 
					 | 
				
			||||||
import com.intellij.openapi.util.Disposer;
 | 
					 | 
				
			||||||
import com.intellij.openapi.vfs.LocalFileSystem;
 | 
					 | 
				
			||||||
import com.intellij.openapi.vfs.VirtualFile;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.EdtTestUtilKt;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.LightProjectDescriptor;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.PsiTestUtil;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.TestLoggerFactory;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
 | 
					 | 
				
			||||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
 | 
					 | 
				
			||||||
import org.jetbrains.annotations.NotNull;
 | 
					 | 
				
			||||||
import org.jetbrains.idea.maven.utils.library.RepositoryLibraryProperties;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.extension.*;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.extension.ExtensionContext.Store;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.Annotation;
 | 
					 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					 | 
				
			||||||
import java.lang.reflect.Parameter;
 | 
					 | 
				
			||||||
import java.net.URISyntaxException;
 | 
					 | 
				
			||||||
import java.nio.file.Path;
 | 
					 | 
				
			||||||
import java.nio.file.Paths;
 | 
					 | 
				
			||||||
import java.util.Arrays;
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.logging.Logger;
 | 
					 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					 | 
				
			||||||
import java.util.stream.Stream;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class LightCodeInsightExtension implements ParameterResolver, AfterTestExecutionCallback, InvocationInterceptor {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static final Logger LOG = Logger.getLogger(LightCodeInsightExtension.class.getName());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
 | 
					 | 
				
			||||||
        Parameter parameter = parameterContext.getParameter();
 | 
					 | 
				
			||||||
        return parameter.isAnnotationPresent(MyFixture.class)
 | 
					 | 
				
			||||||
                || parameter.isAnnotationPresent(MyTestCase.class);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
 | 
					 | 
				
			||||||
        LightCodeInsightFixtureTestCaseWrapper testCase = getWrapper(extensionContext);
 | 
					 | 
				
			||||||
        Parameter parameter = parameterContext.getParameter();
 | 
					 | 
				
			||||||
        if (parameter.isAnnotationPresent(MyFixture.class)) {
 | 
					 | 
				
			||||||
            return testCase.getMyFixture();
 | 
					 | 
				
			||||||
        } else if (parameter.isAnnotationPresent(MyTestCase.class)) {
 | 
					 | 
				
			||||||
            return testCase;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private LightCodeInsightFixtureTestCaseWrapper getWrapper(ExtensionContext extensionContext) {
 | 
					 | 
				
			||||||
        Store store = getStore(extensionContext);
 | 
					 | 
				
			||||||
        return (LightCodeInsightFixtureTestCaseWrapper) store.getOrComputeIfAbsent("testCase",
 | 
					 | 
				
			||||||
                key -> {
 | 
					 | 
				
			||||||
                    LightCodeInsightFixtureTestCaseWrapper wrapper = new LightCodeInsightFixtureTestCaseWrapper(extensionContext);
 | 
					 | 
				
			||||||
                    try {
 | 
					 | 
				
			||||||
                        wrapper.setUp();
 | 
					 | 
				
			||||||
                    } catch (Exception e) {
 | 
					 | 
				
			||||||
                        LOG.severe("Exception during setUp(): " + e);
 | 
					 | 
				
			||||||
                        throw new IllegalStateException("Exception during setUp()", e);
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    return wrapper;
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void afterTestExecution(ExtensionContext context) throws Exception {
 | 
					 | 
				
			||||||
        Store store = getStore(context);
 | 
					 | 
				
			||||||
        LightCodeInsightFixtureTestCaseWrapper testCase = (LightCodeInsightFixtureTestCaseWrapper) store.get("testCase");
 | 
					 | 
				
			||||||
        if (testCase != null) {
 | 
					 | 
				
			||||||
            testCase.tearDown();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static Store getStore(ExtensionContext context) {
 | 
					 | 
				
			||||||
        return context.getStore(Namespace.create(LightCodeInsightExtension.class, context.getRequiredTestMethod()));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void interceptTestMethod(Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable {
 | 
					 | 
				
			||||||
        Throwable[] throwables = new Throwable[1];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        Runnable runnable = () -> {
 | 
					 | 
				
			||||||
            try {
 | 
					 | 
				
			||||||
                TestLoggerFactory.onTestStarted();
 | 
					 | 
				
			||||||
                invocation.proceed();
 | 
					 | 
				
			||||||
                TestLoggerFactory.onTestFinished(true);
 | 
					 | 
				
			||||||
            } catch (Throwable e) {
 | 
					 | 
				
			||||||
                TestLoggerFactory.onTestFinished(false);
 | 
					 | 
				
			||||||
                throwables[0] = e;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        invokeTestRunnable(runnable);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (throwables[0] != null) {
 | 
					 | 
				
			||||||
            throw throwables[0];
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static void invokeTestRunnable(@NotNull Runnable runnable) {
 | 
					 | 
				
			||||||
        IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current();
 | 
					 | 
				
			||||||
        if (policy != null && !policy.runInDispatchThread()) {
 | 
					 | 
				
			||||||
            runnable.run();
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            EdtTestUtilKt.runInEdtAndWait(() -> {
 | 
					 | 
				
			||||||
                runnable.run();
 | 
					 | 
				
			||||||
                return null;
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static class LightCodeInsightFixtureTestCaseWrapper extends LightJavaCodeInsightFixtureTestCase {
 | 
					 | 
				
			||||||
        private final ExtensionContext extensionContext;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private LightCodeInsightFixtureTestCaseWrapper(ExtensionContext extensionContext) {
 | 
					 | 
				
			||||||
            this.extensionContext = extensionContext;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        @Override
 | 
					 | 
				
			||||||
        public void setUp() throws Exception {
 | 
					 | 
				
			||||||
            super.setUp();
 | 
					 | 
				
			||||||
            Store store = getStore(extensionContext);
 | 
					 | 
				
			||||||
            store.put("disposable", Disposer.newDisposable("LightCodeInsightFixtureTestCaseWrapper"));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        @Override
 | 
					 | 
				
			||||||
        public void tearDown() throws Exception {
 | 
					 | 
				
			||||||
            Store store = getStore(extensionContext);
 | 
					 | 
				
			||||||
            Disposable disposable = (Disposable) store.get("disposable");
 | 
					 | 
				
			||||||
            if (myFixture != null && disposable != null) {
 | 
					 | 
				
			||||||
                Disposer.dispose(disposable);
 | 
					 | 
				
			||||||
                store.remove("disposable");
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            super.tearDown();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        @NotNull
 | 
					 | 
				
			||||||
        @Override
 | 
					 | 
				
			||||||
        protected LightProjectDescriptor getProjectDescriptor() {
 | 
					 | 
				
			||||||
            TestJdk testJdk = getMethodOrClassAnnotation(TestJdk.class);
 | 
					 | 
				
			||||||
            if (testJdk == null) {
 | 
					 | 
				
			||||||
                return super.getProjectDescriptor();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            return new ProjectDescriptor(testJdk.value(), testJdk.annotations()) {
 | 
					 | 
				
			||||||
                @Override
 | 
					 | 
				
			||||||
                public Sdk getSdk() {
 | 
					 | 
				
			||||||
                    return testJdk.useInternal()
 | 
					 | 
				
			||||||
                            ? JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk()
 | 
					 | 
				
			||||||
                            : super.getSdk();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                @Override
 | 
					 | 
				
			||||||
                public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
 | 
					 | 
				
			||||||
                    super.configureModule(module, model, contentEntry);
 | 
					 | 
				
			||||||
                    AddLocalJarToModule localJars = getMethodOrClassAnnotation(AddLocalJarToModule.class);
 | 
					 | 
				
			||||||
                    if (localJars != null) {
 | 
					 | 
				
			||||||
                        Stream.of(localJars.value()).forEach(it -> addJarContaining(model, it));
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    List<AddMavenDependencyToModule> mavenDependencies = getMethodOrClassAnnotations(AddMavenDependencyToModule.class);
 | 
					 | 
				
			||||||
                    mavenDependencies.forEach(it -> addFromMaven(model, it.value(), it.includeTransitiveDependencies, it.scope));
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void addJarContaining(ModifiableRootModel model, Class<?> clazz) {
 | 
					 | 
				
			||||||
            try {
 | 
					 | 
				
			||||||
                Path jarPath = Paths.get(clazz.getProtectionDomain().getCodeSource().getLocation().toURI());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                VirtualFile jarFile = LocalFileSystem.getInstance().findFileByIoFile(jarPath.toFile());
 | 
					 | 
				
			||||||
                myFixture.allowTreeAccessForFile(jarFile);
 | 
					 | 
				
			||||||
                PsiTestUtil.addLibrary(
 | 
					 | 
				
			||||||
                        model,
 | 
					 | 
				
			||||||
                        jarPath.getFileName().toString().replace(".jar", ""),
 | 
					 | 
				
			||||||
                        jarPath.getParent().toString(),
 | 
					 | 
				
			||||||
                        jarPath.getFileName().toString()
 | 
					 | 
				
			||||||
                );
 | 
					 | 
				
			||||||
            } catch (URISyntaxException e) {
 | 
					 | 
				
			||||||
                throw new IllegalArgumentException("Class URL malformed", e);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        void addFromMaven(ModifiableRootModel model, String mavenCoordinates,
 | 
					 | 
				
			||||||
                          boolean includeTransitiveDependencies, DependencyScope dependencyScope) {
 | 
					 | 
				
			||||||
            List<RemoteRepositoryDescription> remoteRepositoryDescriptions = RemoteRepositoryDescription.DEFAULT_REPOSITORIES;
 | 
					 | 
				
			||||||
            RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties(mavenCoordinates, includeTransitiveDependencies);
 | 
					 | 
				
			||||||
            Collection<OrderRoot> roots =
 | 
					 | 
				
			||||||
                    JarRepositoryManager.loadDependenciesModal(model.getProject(), libraryProperties, false, false, null, remoteRepositoryDescriptions);
 | 
					 | 
				
			||||||
            LibraryTable.ModifiableModel tableModel = model.getModuleLibraryTable().getModifiableModel();
 | 
					 | 
				
			||||||
            Library library = tableModel.createLibrary(mavenCoordinates);
 | 
					 | 
				
			||||||
            Library.ModifiableModel libraryModel = library.getModifiableModel();
 | 
					 | 
				
			||||||
            if (roots.isEmpty()) {
 | 
					 | 
				
			||||||
                throw new IllegalStateException(String.format("No roots for '%s'", mavenCoordinates));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            for (OrderRoot root : roots) {
 | 
					 | 
				
			||||||
                libraryModel.addRoot(root.getFile(), root.getType());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            LibraryOrderEntry libraryOrderEntry = model.findLibraryOrderEntry(library);
 | 
					 | 
				
			||||||
            if (libraryOrderEntry == null) {
 | 
					 | 
				
			||||||
                throw new IllegalStateException("Unable to find registered library " + mavenCoordinates);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            libraryOrderEntry.setScope(dependencyScope);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            libraryModel.commit();
 | 
					 | 
				
			||||||
            tableModel.commit();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        @Override
 | 
					 | 
				
			||||||
        protected String getTestDataPath() {
 | 
					 | 
				
			||||||
            TestDataPath testDataPath = getMethodOrClassAnnotation(TestDataPath.class);
 | 
					 | 
				
			||||||
            if (testDataPath == null) {
 | 
					 | 
				
			||||||
                return super.getTestDataPath();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            TestDataSubPath testDataSubPath = getMethodOrClassAnnotation(TestDataSubPath.class);
 | 
					 | 
				
			||||||
            if (testDataSubPath == null) {
 | 
					 | 
				
			||||||
                return testDataPath.value();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            return Paths.get(testDataPath.value(), testDataSubPath.value()).toString();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        public JavaCodeInsightTestFixture getMyFixture() {
 | 
					 | 
				
			||||||
            return myFixture;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private <T extends Annotation> T getMethodOrClassAnnotation(Class<T> clazz) {
 | 
					 | 
				
			||||||
            T annotation = extensionContext.getRequiredTestMethod().getAnnotation(clazz);
 | 
					 | 
				
			||||||
            if (annotation == null) {
 | 
					 | 
				
			||||||
                annotation = extensionContext.getRequiredTestClass().getAnnotation(clazz);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            return annotation;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        private <T extends Annotation> List<T> getMethodOrClassAnnotations(Class<T> clazz) {
 | 
					 | 
				
			||||||
            return Stream.of(extensionContext.getRequiredTestMethod().getAnnotationsByType(clazz),
 | 
					 | 
				
			||||||
                    extensionContext.getRequiredTestClass().getAnnotationsByType(clazz))
 | 
					 | 
				
			||||||
                    .flatMap(Arrays::stream)
 | 
					 | 
				
			||||||
                    .collect(Collectors.toList());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,11 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.ElementType;
 | 
					 | 
				
			||||||
import java.lang.annotation.Retention;
 | 
					 | 
				
			||||||
import java.lang.annotation.RetentionPolicy;
 | 
					 | 
				
			||||||
import java.lang.annotation.Target;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target(ElementType.PARAMETER)
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
public @interface MyFixture {
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,11 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.ElementType;
 | 
					 | 
				
			||||||
import java.lang.annotation.Retention;
 | 
					 | 
				
			||||||
import java.lang.annotation.RetentionPolicy;
 | 
					 | 
				
			||||||
import java.lang.annotation.Target;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target(ElementType.PARAMETER)
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
public @interface MyTestCase {
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
@Inherited
 | 
					 | 
				
			||||||
public @interface TestDataPath {
 | 
					 | 
				
			||||||
    String value();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.annotation.Inherited
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					@Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					@Inherited
 | 
				
			||||||
 | 
					annotation class TestDataPath(val value: String)
 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
@Inherited
 | 
					 | 
				
			||||||
public @interface TestDataSubPath {
 | 
					 | 
				
			||||||
    String value();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.annotation.Inherited
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					@Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					@Inherited
 | 
				
			||||||
 | 
					annotation class TestDataSubPath(val value: String)
 | 
				
			||||||
@ -1,16 +0,0 @@
 | 
				
			|||||||
package de.platon42.intellij.jupiter;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.intellij.pom.java.LanguageLevel;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.lang.annotation.*;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Target({ElementType.TYPE, ElementType.METHOD})
 | 
					 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					 | 
				
			||||||
@Inherited
 | 
					 | 
				
			||||||
public @interface TestJdk {
 | 
					 | 
				
			||||||
    LanguageLevel value();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    boolean annotations() default false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    boolean useInternal() default false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										9
									
								
								src/test/java/de/platon42/intellij/jupiter/TestJdk.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/test/java/de/platon42/intellij/jupiter/TestJdk.kt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.jupiter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.pom.java.LanguageLevel
 | 
				
			||||||
 | 
					import java.lang.annotation.Inherited
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
 | 
				
			||||||
 | 
					@Retention(AnnotationRetention.RUNTIME)
 | 
				
			||||||
 | 
					@Inherited
 | 
				
			||||||
 | 
					annotation class TestJdk(val value: LanguageLevel)
 | 
				
			||||||
@ -2,48 +2,45 @@ package de.platon42.intellij.plugins.cajon
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.intellij.codeInsight.intention.IntentionAction
 | 
					import com.intellij.codeInsight.intention.IntentionAction
 | 
				
			||||||
import com.intellij.pom.java.LanguageLevel
 | 
					import com.intellij.pom.java.LanguageLevel
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import de.platon42.intellij.jupiter.AbstractJUnit5TestCase
 | 
				
			||||||
import de.platon42.intellij.jupiter.AddMavenDependencyToModule
 | 
					import de.platon42.intellij.jupiter.AddLocalJarToModule
 | 
				
			||||||
import de.platon42.intellij.jupiter.LightCodeInsightExtension
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataPath
 | 
					import de.platon42.intellij.jupiter.TestDataPath
 | 
				
			||||||
import de.platon42.intellij.jupiter.TestJdk
 | 
					import de.platon42.intellij.jupiter.TestJdk
 | 
				
			||||||
 | 
					import org.assertj.core.api.Assertions
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThat
 | 
					import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
 | 
					import org.assertj.core.api.Condition
 | 
				
			||||||
import org.junit.jupiter.api.DisplayNameGeneration
 | 
					import org.junit.jupiter.api.DisplayNameGeneration
 | 
				
			||||||
import org.junit.jupiter.api.DisplayNameGenerator
 | 
					import org.junit.jupiter.api.DisplayNameGenerator
 | 
				
			||||||
import org.junit.jupiter.api.extension.ExtendWith
 | 
					 | 
				
			||||||
import java.lang.reflect.Method
 | 
					import java.lang.reflect.Method
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ExtendWith(LightCodeInsightExtension::class)
 | 
					 | 
				
			||||||
@TestDataPath("src/test/resources")
 | 
					@TestDataPath("src/test/resources")
 | 
				
			||||||
@TestJdk(LanguageLevel.JDK_1_8, annotations = true, useInternal = true)
 | 
					@TestJdk(LanguageLevel.JDK_1_8)
 | 
				
			||||||
//@AddLocalJarToModule(Assertions::class)
 | 
					@AddLocalJarToModule(Assertions::class)
 | 
				
			||||||
@AddMavenDependencyToModule("org.assertj:assertj-core:3.15.0")
 | 
					//@AddMavenDependencyToModule("org.assertj:assertj-core:3.25.3", includeTransitiveDependencies = false, DependencyScope.COMPILE)
 | 
				
			||||||
@DisplayNameGeneration(AbstractCajonTest.CutOffFixtureDisplayNameGenerator::class)
 | 
					@DisplayNameGeneration(AbstractCajonTest.CutOffFixtureDisplayNameGenerator::class)
 | 
				
			||||||
abstract class AbstractCajonTest {
 | 
					abstract class AbstractCajonTest : AbstractJUnit5TestCase() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected fun executeQuickFixes(myFixture: JavaCodeInsightTestFixture, regex: Regex, expectedFixes: Int) {
 | 
					    protected fun executeQuickFixes(regex: Regex, expectedFixes: Int) {
 | 
				
			||||||
        val quickfixes = getQuickFixes(myFixture, regex, expectedFixes)
 | 
					        val quickfixes = getQuickFixes(regex, expectedFixes)
 | 
				
			||||||
        assertThat(quickfixes.groupBy { it.familyName }).hasSize(1)
 | 
					        assertThat(quickfixes.groupBy { it.familyName }).hasSize(1)
 | 
				
			||||||
        quickfixes.forEach(myFixture::launchAction)
 | 
					        quickfixes.forEach(fixture::launchAction)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected fun executeQuickFixesNoFamilyNameCheck(myFixture: JavaCodeInsightTestFixture, regex: Regex, expectedFixes: Int) {
 | 
					    protected fun executeQuickFixesNoFamilyNameCheck(regex: Regex, expectedFixes: Int) {
 | 
				
			||||||
        val quickfixes = getQuickFixes(myFixture, regex, expectedFixes)
 | 
					        val quickfixes = getQuickFixes(regex, expectedFixes)
 | 
				
			||||||
        quickfixes.forEach(myFixture::launchAction)
 | 
					        quickfixes.forEach(fixture::launchAction)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected fun getQuickFixes(myFixture: JavaCodeInsightTestFixture, regex: Regex, expectedFixes: Int): List<IntentionAction> {
 | 
					    protected fun getQuickFixes(regex: Regex, expectedFixes: Int): List<IntentionAction> {
 | 
				
			||||||
        val quickfixes = myFixture.getAllQuickFixes().filter { it.text.matches(regex) }
 | 
					        val allFixes = fixture.getAllQuickFixes()
 | 
				
			||||||
        assertThat(quickfixes).`as`("Fixes matched by $regex: ${myFixture.getAllQuickFixes().map { it.text }}").hasSize(expectedFixes)
 | 
					        val quickfixes = allFixes.filter { it.text.matches(regex) }
 | 
				
			||||||
 | 
					        assertThat(quickfixes).`as`("Fixes matched by $regex: ${allFixes.map { it.text }}").hasSize(expectedFixes)
 | 
				
			||||||
        return quickfixes
 | 
					        return quickfixes
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected fun assertHighlightings(myFixture: JavaCodeInsightTestFixture, count: Int, snippet: String) {
 | 
					    protected fun assertHighlightings(count: Int, snippet: String) {
 | 
				
			||||||
        val highlights = myFixture.doHighlighting()
 | 
					        assertThat(fixture.doHighlighting())
 | 
				
			||||||
            .asSequence()
 | 
					            .areExactly(count, Condition({ it.description?.contains(snippet) ?: false }, "containing"))
 | 
				
			||||||
            .filter { it.description?.contains(snippet) ?: false }
 | 
					 | 
				
			||||||
            .toList()
 | 
					 | 
				
			||||||
        assertThat(highlights).hasSize(count)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class CutOffFixtureDisplayNameGenerator : DisplayNameGenerator.ReplaceUnderscores() {
 | 
					    class CutOffFixtureDisplayNameGenerator : DisplayNameGenerator.ReplaceUnderscores() {
 | 
				
			||||||
@ -52,4 +49,4 @@ abstract class AbstractCajonTest {
 | 
				
			|||||||
            return nameForMethod.substringBefore("$")
 | 
					            return nameForMethod.substringBefore("$")
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,19 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import com.intellij.testFramework.RunsInEdt
 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/BinaryExpression")
 | 
				
			||||||
internal class AssertThatBinaryExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatBinaryExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/BinaryExpression")
 | 
					    @RunsInEdt
 | 
				
			||||||
    internal fun assertThat_of_binary_expression_can_be_moved_out(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_of_binary_expression_can_be_moved_out() {
 | 
				
			||||||
        myFixture.enableInspections(AssertThatBinaryExpressionInspection::class.java)
 | 
					        fixture.enableInspections(AssertThatBinaryExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.configureByFile("BinaryExpressionBefore.java")
 | 
					        fixture.configureByFile("BinaryExpressionBefore.java")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Split binary expression out of assertThat()"), 161)
 | 
					        executeQuickFixes(Regex.fromLiteral("Split binary expression out of assertThat()"), 161)
 | 
				
			||||||
        myFixture.checkResultByFile("BinaryExpressionAfter.java")
 | 
					        fixture.checkResultByFile("BinaryExpressionAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,20 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/BooleanCondition")
 | 
				
			||||||
internal class AssertThatBooleanConditionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatBooleanConditionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/BooleanCondition")
 | 
					    internal fun assertThat_with_isEqualTo_true_or_false_can_use_isTrue_or_isFalse() {
 | 
				
			||||||
    internal fun assertThat_with_isEqualTo_true_or_false_can_use_isTrue_or_isFalse(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatBooleanConditionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatBooleanConditionInspection::class.java)
 | 
					        fixture.configureByFile("BooleanConditionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("BooleanConditionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isTrue()"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isTrue()"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isFalse()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isFalse()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with isTrue()"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isTrue()"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with isFalse()"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isFalse()"), 4)
 | 
					        fixture.checkResultByFile("BooleanConditionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("BooleanConditionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,5 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThat
 | 
					import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
@ -11,68 +9,68 @@ import org.junit.jupiter.api.Test
 | 
				
			|||||||
internal class AssertThatCollectionOrMapExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatCollectionOrMapExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_with_certain_Collection_and_Map_methods(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_with_certain_Collection_and_Map_methods() {
 | 
				
			||||||
        myFixture.enableInspections(AssertThatCollectionOrMapExpressionInspection::class.java)
 | 
					        fixture.enableInspections(AssertThatCollectionOrMapExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
					        fixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsAll() of actual expression and use assertThat().containsAll() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsAll() of actual expression and use assertThat().containsAll() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().containsKey() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().containsKey() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().containsValue() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().containsValue() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().doesNotContainKey() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().doesNotContainKey() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().doesNotContainValue() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().doesNotContainValue() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 4)
 | 
				
			||||||
        myFixture.checkResultByFile("CollectionMapExpressionAfter.java")
 | 
					        fixture.checkResultByFile("CollectionMapExpressionAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_with_certain_Collection_and_Map_methods_with_Null_values(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_with_certain_Collection_and_Map_methods_with_Null_values() {
 | 
				
			||||||
        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
					        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
				
			||||||
        inspection.behaviorForMapValueEqualsNull = 3
 | 
					        inspection.behaviorForMapValueEqualsNull = 3
 | 
				
			||||||
        myFixture.enableInspections(inspection)
 | 
					        fixture.enableInspections(inspection)
 | 
				
			||||||
        myFixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
					        fixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsAll() of actual expression and use assertThat().containsAll() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsAll() of actual expression and use assertThat().containsAll() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().containsKey() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().containsKey() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().containsValue() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().containsValue() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().doesNotContainKey() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsKey() of actual expression and use assertThat().doesNotContainKey() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().doesNotContainValue() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove containsValue() of actual expression and use assertThat().doesNotContainValue() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
				
			||||||
        myFixture.checkResultByFile("CollectionMapExpressionWithNullValuesAfter.java")
 | 
					        fixture.checkResultByFile("CollectionMapExpressionWithNullValuesAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_with_certain_Collection_and_Map_methods_with_no_quickfixes_for_get_equals_null(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_with_certain_Collection_and_Map_methods_with_no_quickfixes_for_get_equals_null() {
 | 
				
			||||||
        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
					        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
				
			||||||
        inspection.behaviorForMapValueEqualsNull = 0
 | 
					        inspection.behaviorForMapValueEqualsNull = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        myFixture.enableInspections(inspection)
 | 
					        fixture.enableInspections(inspection)
 | 
				
			||||||
        myFixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
					        fixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_with_certain_Collection_and_Map_methods_with_only_warnings_for_get_equals_null(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_with_certain_Collection_and_Map_methods_with_only_warnings_for_get_equals_null() {
 | 
				
			||||||
        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
					        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
				
			||||||
        inspection.behaviorForMapValueEqualsNull = 1
 | 
					        inspection.behaviorForMapValueEqualsNull = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        myFixture.enableInspections(inspection)
 | 
					        fixture.enableInspections(inspection)
 | 
				
			||||||
        myFixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
					        fixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
				
			||||||
        val highlights = myFixture.doHighlighting()
 | 
					        val highlights = fixture.doHighlighting()
 | 
				
			||||||
            .asSequence()
 | 
					            .asSequence()
 | 
				
			||||||
            .filter { it.description == "Moving get() expression out of assertThat() would be more concise" }
 | 
					            .filter { it.description == "Moving get() expression out of assertThat() would be more concise" }
 | 
				
			||||||
            .filter {
 | 
					            .filter {
 | 
				
			||||||
@ -81,24 +79,24 @@ internal class AssertThatCollectionOrMapExpressionInspectionTest : AbstractCajon
 | 
				
			|||||||
            .toList()
 | 
					            .toList()
 | 
				
			||||||
        assertThat(highlights).hasSize(4)
 | 
					        assertThat(highlights).hasSize(4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_with_certain_Collection_and_Map_methods_with_both_quickfixes_for_get_equals_null(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_with_certain_Collection_and_Map_methods_with_both_quickfixes_for_get_equals_null() {
 | 
				
			||||||
        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
					        val inspection = AssertThatCollectionOrMapExpressionInspection()
 | 
				
			||||||
        inspection.behaviorForMapValueEqualsNull = 4
 | 
					        inspection.behaviorForMapValueEqualsNull = 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        myFixture.enableInspections(inspection)
 | 
					        fixture.enableInspections(inspection)
 | 
				
			||||||
        myFixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
					        fixture.configureByFile("CollectionMapExpressionBefore.java")
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead (regular map)"), 4)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead (regular map)"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry(key, null) instead (degenerated map)"), 4)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsEntry(key, null) instead (degenerated map)"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainEntry() instead"), 2)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsKey() instead"), 4)
 | 
				
			||||||
        getQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
					        getQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().doesNotContainKey() instead"), 0)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,22 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/Comparable")
 | 
				
			||||||
internal class AssertThatComparableInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatComparableInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/Comparable")
 | 
					    internal fun assertThat_with_compareTo_method() {
 | 
				
			||||||
    internal fun assertThat_with_compareTo_method(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatComparableInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatComparableInspection::class.java)
 | 
					        fixture.configureByFile("ComparableBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("ComparableBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isEqualByComparingTo() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isEqualByComparingTo() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isNotEqualByComparingTo() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isNotEqualByComparingTo() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isGreaterThanOrEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isGreaterThanOrEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isGreaterThan() instead"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isGreaterThan() instead"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isLessThanOrEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isLessThanOrEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isLessThan() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareTo() of actual expression and use assertThat().isLessThan() instead"), 4)
 | 
					        fixture.checkResultByFile("ComparableAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("ComparableAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,21 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/EnumerableIsEmpty")
 | 
				
			||||||
internal class AssertThatEnumerableIsEmptyInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatEnumerableIsEmptyInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/EnumerableIsEmpty")
 | 
					    internal fun assertThat_with_hasSize_zero_and_similar_can_use_isEmpty() {
 | 
				
			||||||
    internal fun assertThat_with_hasSize_zero_and_similar_can_use_isEmpty(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatEnumerableIsEmptyInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatEnumerableIsEmptyInspection::class.java)
 | 
					        fixture.configureByFile("EnumerableIsEmptyBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("EnumerableIsEmptyBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSize() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSize() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSizeLessThan() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSizeLessThan() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSizeLessThanOrEqualTo() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSizeLessThanOrEqualTo() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSizeGreaterThan() with isNotEmpty()"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSizeGreaterThan() with isNotEmpty()"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSizeGreaterThanOrEqualTo() with isNotEmpty()"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSizeGreaterThanOrEqualTo() with isNotEmpty()"), 6)
 | 
					        fixture.checkResultByFile("EnumerableIsEmptyAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("EnumerableIsEmptyAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,38 +1,36 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/FileExpression")
 | 
				
			||||||
internal class AssertThatFileExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatFileExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/FileExpression")
 | 
					    internal fun assertThat_with_certain_File_methods() {
 | 
				
			||||||
    internal fun assertThat_with_certain_File_methods(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatFileExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatFileExpressionInspection::class.java)
 | 
					        fixture.configureByFile("FileExpressionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("FileExpressionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove canRead() of actual expression and use assertThat().canRead() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove canRead() of actual expression and use assertThat().canRead() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove canWrite() of actual expression and use assertThat().canWrite() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove canWrite() of actual expression and use assertThat().canWrite() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove exists() of actual expression and use assertThat().exists() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove exists() of actual expression and use assertThat().exists() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove exists() of actual expression and use assertThat().doesNotExist() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove exists() of actual expression and use assertThat().doesNotExist() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isAbsolute() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isAbsolute() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isRelative() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isRelative() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isDirectory() of actual expression and use assertThat().isDirectory() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isDirectory() of actual expression and use assertThat().isDirectory() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isFile() of actual expression and use assertThat().isFile() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isFile() of actual expression and use assertThat().isFile() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getName() of actual expression and use assertThat().hasName() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getName() of actual expression and use assertThat().hasName() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasNoParent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasNoParent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParentFile() of actual expression and use assertThat().hasNoParent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParentFile() of actual expression and use assertThat().hasNoParent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasParent() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasParent() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParentFile() of actual expression and use assertThat().hasParent() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParentFile() of actual expression and use assertThat().hasParent() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove listFiles() of actual expression and use assertThat().isEmptyDirectory() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove listFiles() of actual expression and use assertThat().isEmptyDirectory() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove listFiles() of actual expression and use assertThat().isNotEmptyDirectory() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove listFiles() of actual expression and use assertThat().isNotEmptyDirectory() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove list() of actual expression and use assertThat().isEmptyDirectory() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove list() of actual expression and use assertThat().isEmptyDirectory() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove list() of actual expression and use assertThat().isNotEmptyDirectory() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove list() of actual expression and use assertThat().isNotEmptyDirectory() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove length() of actual expression and use assertThat().isEmpty() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove length() of actual expression and use assertThat().isEmpty() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove length() of actual expression and use assertThat().isNotEmpty() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove length() of actual expression and use assertThat().isNotEmpty() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove length() of actual expression and use assertThat().hasSize() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove length() of actual expression and use assertThat().hasSize() instead"), 1)
 | 
					        fixture.checkResultByFile("FileExpressionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("FileExpressionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,48 +1,45 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import de.platon42.intellij.jupiter.AddMavenDependencyToModule
 | 
				
			||||||
import de.platon42.intellij.jupiter.AddLocalJarToModule
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@AddLocalJarToModule(com.google.common.base.Optional::class, org.assertj.guava.api.Assertions::class, Assertions::class)
 | 
					@AddMavenDependencyToModule("org.assertj:assertj-guava:3.25.3")
 | 
				
			||||||
@TestDataSubPath("inspections/GuavaOptional")
 | 
					@TestDataSubPath("inspections/GuavaOptional")
 | 
				
			||||||
internal class AssertThatGuavaOptionalInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatGuavaOptionalInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun assertThat_get_or_isPresent_for_Guava_Optional_can_be_simplified(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun assertThat_get_or_isPresent_for_Guava_Optional_can_be_simplified() {
 | 
				
			||||||
        myFixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
					        fixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
				
			||||||
        myFixture.configureByFile("GuavaOptionalBefore.java")
 | 
					        fixture.configureByFile("GuavaOptionalBefore.java")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isPresent() instead"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isPresent() instead"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isAbsent() instead"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isAbsent() instead"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove orNull() of actual expression and use assertThat().isPresent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove orNull() of actual expression and use assertThat().isPresent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove orNull() of actual expression and use assertThat().isAbsent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove orNull() of actual expression and use assertThat().isAbsent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().contains() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().contains() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Unwrap expected expression and replace isEqualTo() with contains()"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Unwrap expected expression and replace isEqualTo() with contains()"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with Guava assertThat().isAbsent()"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with Guava assertThat().isAbsent()"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with Guava assertThat().isPresent()"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with Guava assertThat().isPresent()"), 3)
 | 
				
			||||||
        myFixture.checkResultByFile("GuavaOptionalAfter.java")
 | 
					        fixture.checkResultByFile("GuavaOptionalAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun adds_missing_Guava_import_any_order(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun adds_missing_Guava_import_any_order() {
 | 
				
			||||||
        myFixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
					        fixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
				
			||||||
        myFixture.configureByFile("WithoutPriorGuavaImportBefore.java")
 | 
					        fixture.configureByFile("WithoutPriorGuavaImportBefore.java")
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex(".*eplace .* with .*"), 4)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex(".*eplace .* with .*"), 4)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Remove .*"), 3)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Remove .*"), 3)
 | 
				
			||||||
        myFixture.checkResultByFile("WithoutPriorGuavaImportAfter.java")
 | 
					        fixture.checkResultByFile("WithoutPriorGuavaImportAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun adds_missing_Guava_import_isAbsent_first(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun adds_missing_Guava_import_isAbsent_first() {
 | 
				
			||||||
        myFixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
					        fixture.enableInspections(AssertThatGuavaOptionalInspection::class.java)
 | 
				
			||||||
        myFixture.configureByFile("WithoutPriorGuavaImportBefore.java")
 | 
					        fixture.configureByFile("WithoutPriorGuavaImportBefore.java")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with Guava assertThat().isAbsent()"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with Guava assertThat().isAbsent()"), 1)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex(".*eplace .* with .*"), 3)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex(".*eplace .* with .*"), 3)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Remove .*"), 3)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Remove .*"), 3)
 | 
				
			||||||
        myFixture.checkResultByFile("WithoutPriorGuavaImportAfter.java")
 | 
					        fixture.checkResultByFile("WithoutPriorGuavaImportAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,20 +1,18 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/InstanceOf")
 | 
				
			||||||
internal class AssertThatInstanceOfInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatInstanceOfInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/InstanceOf")
 | 
					    internal fun assertThat_with_instanceof_can_be_moved_out() {
 | 
				
			||||||
    internal fun assertThat_with_instanceof_can_be_moved_out(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatInstanceOfInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatInstanceOfInspection::class.java)
 | 
					        fixture.configureByFile("InstanceOfBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("InstanceOfBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove instanceof in actual expression and use assertThat().isInstanceOf() instead"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove instanceof in actual expression and use assertThat().isInstanceOf() instead"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove instanceof in actual expression and use assertThat().isNotInstanceOf() instead"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove instanceof in actual expression and use assertThat().isNotInstanceOf() instead"), 6)
 | 
					        fixture.checkResultByFile("InstanceOfAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("InstanceOfAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,21 +1,19 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/InvertedBooleanCondition")
 | 
				
			||||||
internal class AssertThatInvertedBooleanConditionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatInvertedBooleanConditionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/InvertedBooleanCondition")
 | 
					    internal fun assertThat_with_inverted_boolean_condition_can_be_inverted() {
 | 
				
			||||||
    internal fun assertThat_with_inverted_boolean_condition_can_be_inverted(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatInvertedBooleanConditionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatInvertedBooleanConditionInspection::class.java)
 | 
					        fixture.configureByFile("InvertedBooleanConditionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("InvertedBooleanConditionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Invert condition in assertThat()"), 25)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Invert condition in assertThat()"), 25)
 | 
					        executeQuickFixes(Regex.fromLiteral("Invert condition in isEqualTo() and use isNotEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Invert condition in isEqualTo() and use isNotEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Invert condition in isNotEqualTo() and use isEqualTo() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Invert condition in isNotEqualTo() and use isEqualTo() instead"), 2)
 | 
					        fixture.checkResultByFile("InvertedBooleanConditionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("InvertedBooleanConditionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/IsZeroOne")
 | 
				
			||||||
 | 
					internal class AssertThatIsZeroOneInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    internal fun assertThat_with_isEqualTo_zero_or_one_can_use_isZero_or_isOne_plus_isNotZero() {
 | 
				
			||||||
 | 
					        fixture.enableInspections(AssertThatIsZeroOneInspection::class.java)
 | 
				
			||||||
 | 
					        fixture.configureByFile("IsZeroOneBefore.java")
 | 
				
			||||||
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isZero()"), 10)
 | 
				
			||||||
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isOne()"), 10)
 | 
				
			||||||
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with isNotZero()"), 10)
 | 
				
			||||||
 | 
					        fixture.checkResultByFile("IsZeroOneAfter.java")
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,27 +1,25 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/Java8Optional")
 | 
				
			||||||
internal class AssertThatJava8OptionalInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatJava8OptionalInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/Java8Optional")
 | 
					    internal fun assertThat_get_or_isPresent_for_Java8_Optional_can_be_simplified() {
 | 
				
			||||||
    internal fun assertThat_get_or_isPresent_for_Java8_Optional_can_be_simplified(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatJava8OptionalInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatJava8OptionalInspection::class.java)
 | 
					        fixture.configureByFile("Java8OptionalBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("Java8OptionalBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isPresent() instead"), 6)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isPresent() instead"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isNotPresent() instead"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isPresent() of actual expression and use assertThat().isNotPresent() instead"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove orElse() of actual expression and use assertThat().isPresent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove orElse() of actual expression and use assertThat().isPresent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove orElse() of actual expression and use assertThat().isNotPresent() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove orElse() of actual expression and use assertThat().isNotPresent() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().contains() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().contains() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsSame() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove get() of actual expression and use assertThat().containsSame() instead"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isNotPresent()"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isNotPresent()"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with isPresent()"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isPresent()"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Unwrap expected expression and replace isEqualTo() with contains()"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Unwrap expected expression and replace isEqualTo() with contains()"), 2)
 | 
					        fixture.checkResultByFile("Java8OptionalAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("Java8OptionalAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,20 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/ObjectExpression")
 | 
				
			||||||
internal class AssertThatObjectExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatObjectExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/ObjectExpression")
 | 
					    internal fun assertThat_with_certain_Object_methods() {
 | 
				
			||||||
    internal fun assertThat_with_certain_Object_methods(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatObjectExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatObjectExpressionInspection::class.java)
 | 
					        fixture.configureByFile("ObjectExpressionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("ObjectExpressionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isNotEqualTo() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isNotEqualTo() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace calls to hashCode() with hasSameHashCodeAs()"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace calls to hashCode() with hasSameHashCodeAs()"), 1)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove toString() of actual expression and use assertThat().hasToString() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove toString() of actual expression and use assertThat().hasToString() instead"), 1)
 | 
					        fixture.checkResultByFile("ObjectExpressionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("ObjectExpressionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,20 +1,18 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/ObjectIsNullOrNotNull")
 | 
				
			||||||
internal class AssertThatObjectIsNullOrNotNullInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatObjectIsNullOrNotNullInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/ObjectIsNullOrNotNull")
 | 
					    internal fun assertThat_with_isEqualTo_null_can_use_isNull() {
 | 
				
			||||||
    internal fun assertThat_with_isEqualTo_null_can_use_isNull(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatObjectIsNullOrNotNullInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatObjectIsNullOrNotNullInspection::class.java)
 | 
					        fixture.configureByFile("ObjectIsNullOrNotNullBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("ObjectIsNullOrNotNullBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isNull()"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isNull()"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotEqualTo() with isNotNull()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotEqualTo() with isNotNull()"), 5)
 | 
					        fixture.checkResultByFile("ObjectIsNullOrNotNullAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("ObjectIsNullOrNotNullAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,22 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/PathExpression")
 | 
				
			||||||
internal class AssertThatPathExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatPathExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/PathExpression")
 | 
					    internal fun assertThat_with_certain_Path_methods() {
 | 
				
			||||||
    internal fun assertThat_with_certain_Path_methods(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatPathExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatPathExpressionInspection::class.java)
 | 
					        fixture.configureByFile("PathExpressionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("PathExpressionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isAbsolute() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isAbsolute() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isRelative() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isAbsolute() of actual expression and use assertThat().isRelative() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().startsWithRaw() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().startsWithRaw() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().endsWithRaw() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().endsWithRaw() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasNoParentRaw() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasNoParentRaw() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasParentRaw() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove getParent() of actual expression and use assertThat().hasParentRaw() instead"), 1)
 | 
					        fixture.checkResultByFile("PathExpressionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("PathExpressionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,34 +1,32 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/Size")
 | 
				
			||||||
internal class AssertThatSizeInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatSizeInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/Size")
 | 
					    internal fun assertThat_size_of_array_collection_or_map_can_be_simplified() {
 | 
				
			||||||
    internal fun assertThat_size_of_array_collection_or_map_can_be_simplified(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatSizeInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatSizeInspection::class.java)
 | 
					        fixture.configureByFile("SizeBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("SizeBefore.java")
 | 
					        assertHighlightings(1, "Try to operate on the iterable itself rather than its size")
 | 
				
			||||||
        assertHighlightings(myFixture, 1, "Try to operate on the iterable itself rather than its size")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isZero() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isZero() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isNotZero() with isNotEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isNotZero() with isNotEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isGreaterThan() with isNotEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isGreaterThan() with isNotEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isGreaterThanOrEqualTo() with isNotEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isGreaterThanOrEqualTo() with isNotEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isLessThan() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isLessThan() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isLessThanOrEqualTo() with isEmpty()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isLessThanOrEqualTo() with isEmpty()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with hasSameSizeAs()"), 15)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with hasSameSizeAs()"), 15)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with hasSize()"), 15)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with hasSize()"), 15)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isGreaterThan() with hasSizeGreaterThan()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isGreaterThan() with hasSizeGreaterThan()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isGreaterThanOrEqualTo() with hasSizeGreaterThanOrEqualTo()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isGreaterThanOrEqualTo() with hasSizeGreaterThanOrEqualTo()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isLessThan() with hasSizeLessThan()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isLessThan() with hasSizeLessThan()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isLessThanOrEqualTo() with hasSizeLessThanOrEqualTo()"), 5)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isLessThanOrEqualTo() with hasSizeLessThanOrEqualTo()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove size determination of expected expression and replace hasSize() with hasSameSizeAs()"), 17)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove size determination of expected expression and replace hasSize() with hasSameSizeAs()"), 17)
 | 
				
			||||||
        myFixture.checkResultByFile("SizeAfter.java")
 | 
					        fixture.checkResultByFile("SizeAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,41 +1,39 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/StringExpression")
 | 
				
			||||||
internal class AssertThatStringExpressionInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatStringExpressionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/StringExpression")
 | 
					    internal fun assertThat_with_certain_String_methods() {
 | 
				
			||||||
    internal fun assertThat_with_certain_String_methods(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatStringExpressionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatStringExpressionInspection::class.java)
 | 
					        fixture.configureByFile("StringExpressionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("StringExpressionBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isEmpty() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isEqualTo() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isEqualTo() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equalsIgnoreCase() of actual expression and use assertThat().isEqualToIgnoringCase() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equalsIgnoreCase() of actual expression and use assertThat().isEqualToIgnoringCase() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contentEquals() of actual expression and use assertThat().isEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contentEquals() of actual expression and use assertThat().isEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().contains() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().startsWith() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().startsWith() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().endsWith() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().endsWith() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove matches() of actual expression and use assertThat().matches() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove matches() of actual expression and use assertThat().matches() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove matches() of actual expression and use assertThat().doesNotMatch() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove matches() of actual expression and use assertThat().doesNotMatch() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove isEmpty() of actual expression and use assertThat().isNotEmpty() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isNotEqualTo() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equals() of actual expression and use assertThat().isNotEqualTo() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove equalsIgnoreCase() of actual expression and use assertThat().isNotEqualToIgnoringCase() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove equalsIgnoreCase() of actual expression and use assertThat().isNotEqualToIgnoringCase() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contentEquals() of actual expression and use assertThat().isNotEqualTo() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contentEquals() of actual expression and use assertThat().isNotEqualTo() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove contains() of actual expression and use assertThat().doesNotContain() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().doesNotStartWith() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove startsWith() of actual expression and use assertThat().doesNotStartWith() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().doesNotEndWith() instead"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove endsWith() of actual expression and use assertThat().doesNotEndWith() instead"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareToIgnoreCase() of actual expression and use assertThat().isEqualToIgnoringCase() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareToIgnoreCase() of actual expression and use assertThat().isEqualToIgnoringCase() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove compareToIgnoreCase() of actual expression and use assertThat().isNotEqualToIgnoringCase() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove compareToIgnoreCase() of actual expression and use assertThat().isNotEqualToIgnoringCase() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().startsWith() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().startsWith() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().doesNotStartWith() instead"), 2)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().doesNotStartWith() instead"), 2)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().contains() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().contains() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().doesNotContain() instead"), 4)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove indexOf() of actual expression and use assertThat().doesNotContain() instead"), 4)
 | 
					        executeQuickFixes(Regex.fromLiteral("Remove trim() of actual expression and use assertThat().isNotBlank() instead"), 1)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Remove trim() of actual expression and use assertThat().isNotBlank() instead"), 1)
 | 
					        fixture.checkResultByFile("StringExpressionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("StringExpressionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,27 +1,25 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThat
 | 
					import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
import org.assertj.core.api.extrakting
 | 
					import org.assertj.core.api.extrakting
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/StringIsEmpty")
 | 
				
			||||||
internal class AssertThatStringIsEmptyInspectionTest : AbstractCajonTest() {
 | 
					internal class AssertThatStringIsEmptyInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/StringIsEmpty")
 | 
					    internal fun assertThat_with_isEqualTo_emptyString_can_use_isEmpty() {
 | 
				
			||||||
    internal fun assertThat_with_isEqualTo_emptyString_can_use_isEmpty(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssertThatStringIsEmptyInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssertThatStringIsEmptyInspection::class.java)
 | 
					        fixture.configureByFile("StringIsEmptyBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("StringIsEmptyBefore.java")
 | 
					        val highlights = fixture.doHighlighting()
 | 
				
			||||||
        val highlights = myFixture.doHighlighting()
 | 
					 | 
				
			||||||
            .asSequence()
 | 
					            .asSequence()
 | 
				
			||||||
            .filter { it.description?.contains(" can be simplified to") ?: false }
 | 
					            .filter { it.description?.contains(" can be simplified to") ?: false }
 | 
				
			||||||
            .toList()
 | 
					            .toList()
 | 
				
			||||||
        assertThat(highlights).hasSize(6).extrakting { it.text }.doesNotContain("assertThat")
 | 
					        assertThat(highlights).hasSize(6).extrakting { it.text }.doesNotContain("assertThat")
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace isEqualTo() with isEmpty()"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace isEqualTo() with isEmpty()"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace hasSize() with isEmpty()"), 3)
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace hasSize() with isEmpty()"), 3)
 | 
				
			||||||
        myFixture.checkResultByFile("StringIsEmptyAfter.java")
 | 
					        fixture.checkResultByFile("StringIsEmptyAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,20 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import de.platon42.intellij.jupiter.AddMavenDependencyToModule
 | 
				
			||||||
import de.platon42.intellij.jupiter.AddLocalJarToModule
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@AddLocalJarToModule(Assertions::class, Test::class, org.junit.Test::class)
 | 
					@AddMavenDependencyToModule("junit:junit:4.13.2")
 | 
				
			||||||
 | 
					@AddMavenDependencyToModule("org.junit.jupiter:junit-jupiter-api:5.10.2")
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/AssumeThat")
 | 
				
			||||||
internal class AssumeThatInsteadOfReturnInspectionTest : AbstractCajonTest() {
 | 
					internal class AssumeThatInsteadOfReturnInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/AssumeThat")
 | 
					    internal fun conditional_returns_can_be_replaced_by_assumeThat() {
 | 
				
			||||||
    internal fun conditional_returns_can_be_replaced_by_assumeThat(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(AssumeThatInsteadOfReturnInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(AssumeThatInsteadOfReturnInspection::class.java)
 | 
					        fixture.configureByFile("AssumeThatBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("AssumeThatBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Replace if statement by assumeTrue()"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Replace if statement by assumeTrue()"), 5)
 | 
					        fixture.checkResultByFile("AssumeThatAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("AssumeThatAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,17 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/BogusAssertion")
 | 
				
			||||||
internal class BogusAssertionInspectionTest : AbstractCajonTest() {
 | 
					internal class BogusAssertionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/BogusAssertion")
 | 
					    internal fun reports_bogus_assertions() {
 | 
				
			||||||
    internal fun reports_bogus_assertions(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(BogusAssertionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(BogusAssertionInspection::class.java)
 | 
					        fixture.configureByFile("BogusAssertionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("BogusAssertionBefore.java")
 | 
					        assertHighlightings(14 * 9 + 10 + 12 + 8, "Actual expression in assertThat() is the same as expected")
 | 
				
			||||||
        assertHighlightings(myFixture, 14 * 9 + 10 + 12 + 8, "Actual expression in assertThat() is the same as expected")
 | 
					        assertHighlightings(3, "Same actual and expected expression, but may be testing equals() or hashCode()")
 | 
				
			||||||
        assertHighlightings(myFixture, 3, "Same actual and expected expression, but may be testing equals() or hashCode()")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,21 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import de.platon42.intellij.jupiter.AddMavenDependencyToModule
 | 
				
			||||||
import de.platon42.intellij.jupiter.AddLocalJarToModule
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@AddLocalJarToModule(com.google.common.base.Optional::class, org.assertj.guava.api.Assertions::class, Assertions::class)
 | 
					@AddMavenDependencyToModule("org.assertj:assertj-guava:3.25.3")
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/ImplicitAssertion")
 | 
				
			||||||
internal class ImplicitAssertionInspectionTest : AbstractCajonTest() {
 | 
					internal class ImplicitAssertionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/ImplicitAssertion")
 | 
					    internal fun implicit_assertions_can_be_removed() {
 | 
				
			||||||
    internal fun implicit_assertions_can_be_removed(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(ImplicitAssertionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(ImplicitAssertionInspection::class.java)
 | 
					        fixture.configureByFile("ImplicitAssertionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("ImplicitAssertionBefore.java")
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Delete implicit isNotNull\\(\\) covered by .*"), 102)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Delete implicit isNotNull\\(\\) covered by .*"), 102)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Delete implicit isNotEmpty\\(\\) covered by .*"), 17)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Delete implicit isNotEmpty\\(\\) covered by .*"), 17)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Delete implicit isPresent\\(\\) covered by .*"), 8)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Delete implicit isPresent\\(\\) covered by .*"), 8)
 | 
					        fixture.checkResultByFile("ImplicitAssertionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("ImplicitAssertionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,24 +1,20 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					import de.platon42.intellij.jupiter.AddMavenDependencyToModule
 | 
				
			||||||
import de.platon42.intellij.jupiter.AddLocalJarToModule
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions
 | 
					 | 
				
			||||||
import org.junit.Assert
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@AddLocalJarToModule(Assert::class, Assertions::class)
 | 
					@AddMavenDependencyToModule("junit:junit:4.13.2")
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/JUnitAssertToAssertJ")
 | 
				
			||||||
internal class JUnitAssertToAssertJInspectionTest : AbstractCajonTest() {
 | 
					internal class JUnitAssertToAssertJInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/JUnitAssertToAssertJ")
 | 
					    internal fun junit_Assertions_can_be_converted_into_AssertJ() {
 | 
				
			||||||
    internal fun junit_Assertions_can_be_converted_into_AssertJ(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(JUnitAssertToAssertJInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(JUnitAssertToAssertJInspection::class.java)
 | 
					        fixture.configureByFile("JUnitAssertToAssertJInspectionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("JUnitAssertToAssertJInspectionBefore.java")
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Convert assert.*\\(\\) to assertThat\\(\\).*"), 48)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Convert assert.*\\(\\) to assertThat\\(\\).*"), 48)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Convert assume.*\\(\\) to assumeThat\\(\\).*"), 7)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Convert assume.*\\(\\) to assumeThat\\(\\).*"), 7)
 | 
					        fixture.checkResultByFile("JUnitAssertToAssertJInspectionAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("JUnitAssertToAssertJInspectionAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,17 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/JoinStatements")
 | 
				
			||||||
internal class JoinAssertThatStatementsInspectionTest : AbstractCajonTest() {
 | 
					internal class JoinAssertThatStatementsInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/JoinStatements")
 | 
					    internal fun assertThat_statements_can_be_joined_together() {
 | 
				
			||||||
    internal fun assertThat_statements_can_be_joined_together(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(JoinAssertThatStatementsInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(JoinAssertThatStatementsInspection::class.java)
 | 
					        fixture.configureByFile("JoinStatementsBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("JoinStatementsBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Join assertThat() statements"), 5)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Join assertThat() statements"), 5)
 | 
					        fixture.checkResultByFile("JoinStatementsAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("JoinStatementsAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,17 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/JoinVarArgsContains")
 | 
				
			||||||
internal class JoinVarArgsContainsInspectionTest : AbstractCajonTest() {
 | 
					internal class JoinVarArgsContainsInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/JoinVarArgsContains")
 | 
					    internal fun join_contains_and_doesNotContain_together_where_possible() {
 | 
				
			||||||
    internal fun join_contains_and_doesNotContain_together_where_possible(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(JoinVarArgsContainsInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(JoinVarArgsContainsInspection::class.java)
 | 
					        fixture.configureByFile("JoinVarArgsContainsBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("JoinVarArgsContainsBefore.java")
 | 
					        executeQuickFixes(Regex.fromLiteral("Join multiple arguments to variadic argument method calls"), 3)
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Join multiple arguments to variadic argument method calls"), 3)
 | 
					        fixture.checkResultByFile("JoinVarArgsContainsAfter.java")
 | 
				
			||||||
        myFixture.checkResultByFile("JoinVarArgsContainsAfter.java")
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,21 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.inspections
 | 
					package de.platon42.intellij.plugins.cajon.inspections
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@TestDataSubPath("inspections/TwistedAssertion")
 | 
				
			||||||
internal class TwistedAssertionInspectionTest : AbstractCajonTest() {
 | 
					internal class TwistedAssertionInspectionTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    @TestDataSubPath("inspections/TwistedAssertion")
 | 
					    internal fun hint_twisted_actual_and_expected_and_provide_quickfix_where_possible() {
 | 
				
			||||||
    internal fun hint_twisted_actual_and_expected_and_provide_quickfix_where_possible(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					        fixture.enableInspections(TwistedAssertionInspection::class.java)
 | 
				
			||||||
        myFixture.enableInspections(TwistedAssertionInspection::class.java)
 | 
					        fixture.configureByFile("TwistedAssertionBefore.java")
 | 
				
			||||||
        myFixture.configureByFile("TwistedAssertionBefore.java")
 | 
					        assertHighlightings(9, "Actual expression in assertThat() is a constant")
 | 
				
			||||||
        assertHighlightings(myFixture, 9, "Actual expression in assertThat() is a constant")
 | 
					        assertHighlightings(10, "Twisted actual and expected expressions")
 | 
				
			||||||
        assertHighlightings(myFixture, 10, "Twisted actual and expected expressions")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        executeQuickFixes(myFixture, Regex.fromLiteral("Swap actual and expected expressions in assertion"), 6)
 | 
					        executeQuickFixes(Regex.fromLiteral("Swap actual and expected expressions in assertion"), 6)
 | 
				
			||||||
        executeQuickFixesNoFamilyNameCheck(myFixture, Regex("Replace .* by .* and swap actual and expected expressions"), 4)
 | 
					        executeQuickFixesNoFamilyNameCheck(Regex("Replace .* by .* and swap actual and expected expressions"), 4)
 | 
				
			||||||
        myFixture.checkResultByFile("TwistedAssertionAfter.java")
 | 
					        fixture.checkResultByFile("TwistedAssertionAfter.java")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,5 @@
 | 
				
			|||||||
package de.platon42.intellij.plugins.cajon.references
 | 
					package de.platon42.intellij.plugins.cajon.references
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.MyFixture
 | 
					 | 
				
			||||||
import de.platon42.intellij.jupiter.TestDataSubPath
 | 
					import de.platon42.intellij.jupiter.TestDataSubPath
 | 
				
			||||||
import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
					import de.platon42.intellij.plugins.cajon.AbstractCajonTest
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThat
 | 
					import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
@ -13,68 +11,68 @@ import org.junit.jupiter.api.Test
 | 
				
			|||||||
internal class ExtractorReferenceContributorTest : AbstractCajonTest() {
 | 
					internal class ExtractorReferenceContributorTest : AbstractCajonTest() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_field_extracting(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_field_extracting() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference1.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference1.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
					        assertThat(fixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_first_part_of_a_path(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_first_part_of_a_path() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference2.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference2.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).isEqualTo("protected Address address;")
 | 
					        assertThat(fixture.elementAtCaret.text).isEqualTo("protected Address address;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_second_part_of_a_path_and_both_getter_and_field(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_second_part_of_a_path_and_both_getter_and_field() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference3.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference3.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("private String street;")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("private String street;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_on_a_bare_method_call(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_on_a_bare_method_call() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference4.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference4.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("public Boolean getREALLYnoMAILINGS()")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("public Boolean getREALLYnoMAILINGS()")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_with_only_Getter_on_second_part(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_with_only_Getter_on_second_part() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference5.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference5.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("public boolean isNoMailings()")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("public boolean isNoMailings()")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_using_byName_extractor(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_using_byName_extractor() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference6.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference6.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
					        assertThat(fixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_using_resultOf_extractor(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_using_resultOf_extractor() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference7.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference7.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("public String getStreetName()")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("public String getStreetName()")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_field_extraction_on_list(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_field_extraction_on_list() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference8.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference8.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
					        assertThat(fixture.elementAtCaret.text).isEqualTo("private String name;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_field_flat_extraction_of_path_on_list(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_field_flat_extraction_of_path_on_list() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference9.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference9.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("private String street;")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("private String street;")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_able_to_find_reference_for_extraction_on_result_of_method(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_able_to_find_reference_for_extraction_on_result_of_method() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference10.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference10.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThat(myFixture.elementAtCaret.text).startsWith("public String getStreetName()")
 | 
					        assertThat(fixture.elementAtCaret.text).startsWith("public String getStreetName()")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    internal fun extractor_is_unable_to_find_reference(@MyFixture myFixture: JavaCodeInsightTestFixture) {
 | 
					    internal fun extractor_is_unable_to_find_reference() {
 | 
				
			||||||
        myFixture.configureByFiles("FindReference11.java", "Address.java", "Contact.java")
 | 
					        fixture.configureByFiles("FindReference11.java", "Address.java", "Contact.java")
 | 
				
			||||||
        assertThatThrownBy { myFixture.elementAtCaret.text }.isInstanceOf(AssertionError::class.java)
 | 
					        assertThatThrownBy { fixture.elementAtCaret.text }.isInstanceOf(AssertionError::class.java)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										67
									
								
								src/test/resources/inspections/IsZeroOne/IsZeroOneAfter.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								src/test/resources/inspections/IsZeroOne/IsZeroOneAfter.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					import static org.assertj.core.api.Assertions.assertThat;
 | 
				
			||||||
 | 
					import static org.assertj.core.api.Assertions.fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class IsZeroOne {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void isZeroOne() {
 | 
				
			||||||
 | 
					        short shortValue = 0;
 | 
				
			||||||
 | 
					        int intValue = 0;
 | 
				
			||||||
 | 
					        long longValue = 0L;
 | 
				
			||||||
 | 
					        float floatValue = 0.0f;
 | 
				
			||||||
 | 
					        double doubleValue = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isZero();
 | 
				
			||||||
 | 
					        assertThat(shortValue).isZero();
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isOne();
 | 
				
			||||||
 | 
					        assertThat(shortValue).isOne();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isNotZero();
 | 
				
			||||||
 | 
					        assertThat(shortValue).isNotZero();
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isNotEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(shortValue).isNotEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isZero();
 | 
				
			||||||
 | 
					        assertThat(intValue).isZero();
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isOne();
 | 
				
			||||||
 | 
					        assertThat(intValue).isOne();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isNotZero();
 | 
				
			||||||
 | 
					        assertThat(intValue).isNotZero();
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isNotEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(intValue).isNotEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isZero();
 | 
				
			||||||
 | 
					        assertThat(longValue).isZero();
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isOne();
 | 
				
			||||||
 | 
					        assertThat(longValue).isOne();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isNotZero();
 | 
				
			||||||
 | 
					        assertThat(longValue).isNotZero();
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isNotEqualTo(1L);
 | 
				
			||||||
 | 
					        assertThat(longValue).isNotEqualTo(0L + 1L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isZero();
 | 
				
			||||||
 | 
					        assertThat(floatValue).isZero();
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isOne();
 | 
				
			||||||
 | 
					        assertThat(floatValue).isOne();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isNotZero();
 | 
				
			||||||
 | 
					        assertThat(floatValue).isNotZero();
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isNotEqualTo(1.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).isNotEqualTo(0.0f + 1.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isZero();
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isZero();
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isOne();
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isOne();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isNotZero();
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isNotZero();
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isNotEqualTo(1.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isNotEqualTo(0.0 + 1.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isEqualTo(2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fail("oh no!");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					import static org.assertj.core.api.Assertions.assertThat;
 | 
				
			||||||
 | 
					import static org.assertj.core.api.Assertions.fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class IsZeroOne {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void isZeroOne() {
 | 
				
			||||||
 | 
					        short shortValue = 0;
 | 
				
			||||||
 | 
					        int intValue = 0;
 | 
				
			||||||
 | 
					        long longValue = 0L;
 | 
				
			||||||
 | 
					        float floatValue = 0.0f;
 | 
				
			||||||
 | 
					        double doubleValue = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isEqualTo(0);
 | 
				
			||||||
 | 
					        assertThat(shortValue).isEqualTo(1 - 1);
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(shortValue).isEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isNotEqualTo(0);
 | 
				
			||||||
 | 
					        assertThat(shortValue).isNotEqualTo(1 - 1);
 | 
				
			||||||
 | 
					        assertThat(shortValue).as("foo").isNotEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(shortValue).isNotEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isEqualTo(0);
 | 
				
			||||||
 | 
					        assertThat(intValue).isEqualTo(1 - 1);
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(intValue).isEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isNotEqualTo(0);
 | 
				
			||||||
 | 
					        assertThat(intValue).isNotEqualTo(1 - 1);
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isNotEqualTo(1);
 | 
				
			||||||
 | 
					        assertThat(intValue).isNotEqualTo(0 + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isEqualTo(0L);
 | 
				
			||||||
 | 
					        assertThat(longValue).isEqualTo(1L - 1L);
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isEqualTo(1L);
 | 
				
			||||||
 | 
					        assertThat(longValue).isEqualTo(0L + 1L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isNotEqualTo(0L);
 | 
				
			||||||
 | 
					        assertThat(longValue).isNotEqualTo(1L - 1L);
 | 
				
			||||||
 | 
					        assertThat(longValue).as("foo").isNotEqualTo(1L);
 | 
				
			||||||
 | 
					        assertThat(longValue).isNotEqualTo(0L + 1L);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isEqualTo(0.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).isEqualTo(1.0f - 1.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isEqualTo(1.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).isEqualTo(0.0f + 1.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isNotEqualTo(0.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).isNotEqualTo(1.0f - 1.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).as("foo").isNotEqualTo(1.0f);
 | 
				
			||||||
 | 
					        assertThat(floatValue).isNotEqualTo(0.0f + 1.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isEqualTo(0.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isEqualTo(1.0 - 1.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isEqualTo(1.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isEqualTo(0.0 + 1.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isNotEqualTo(0.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isNotEqualTo(1.0 - 1.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).as("foo").isNotEqualTo(1.0);
 | 
				
			||||||
 | 
					        assertThat(doubleValue).isNotEqualTo(0.0 + 1.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(intValue).as("foo").isEqualTo(2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        fail("oh no!");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -66,6 +66,9 @@ public class JoinStatements {
 | 
				
			|||||||
        assertThat(list.get(--i)).isEqualTo("foo");
 | 
					        assertThat(list.get(--i)).isEqualTo("foo");
 | 
				
			||||||
        assertThat(list.get(--i)).isEqualTo("foo");
 | 
					        assertThat(list.get(--i)).isEqualTo("foo");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(list).filteredOn("foo", "foo").contains("narf");
 | 
				
			||||||
 | 
					        assertThat(list).filteredOn("bar", "bar").contains("puit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        org.junit.Assert.assertThat(list, null);
 | 
					        org.junit.Assert.assertThat(list, null);
 | 
				
			||||||
        fail("oh no!");
 | 
					        fail("oh no!");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -63,6 +63,9 @@ public class JoinStatements {
 | 
				
			|||||||
        assertThat(list.get(--i)).isEqualTo("foo");
 | 
					        assertThat(list.get(--i)).isEqualTo("foo");
 | 
				
			||||||
        assertThat(list.get(--i)).isEqualTo("foo");
 | 
					        assertThat(list.get(--i)).isEqualTo("foo");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assertThat(list).filteredOn("foo", "foo").contains("narf");
 | 
				
			||||||
 | 
					        assertThat(list).filteredOn("bar", "bar").contains("puit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        org.junit.Assert.assertThat(list, null);
 | 
					        org.junit.Assert.assertThat(list, null);
 | 
				
			||||||
        fail("oh no!");
 | 
					        fail("oh no!");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user