You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is very similar behavior as #1106 , but that says it was fixed on release 1.9.10. I was using 1.17.4 and just updated to 1.18.0 today and still seeing this behavior. However, I am wondering if this has something to do with the fact I am using Lombok on this class.
I am using org.pitest.pitest-maven (tried 1.17.4 and 1.18.0) and org.projectlombok.lombok 1.18.28
I will try to provide a minimal reproducible example from what I have going on.
My assertion of course passes because PITest in its generated report, says it replaced Map.of() with Collections.emptyMap() which are both initially empty maps. I would prefer to avoid adding rather unnecessary assertions to check that the property isn't the same as Collections.emptyMap() since I don't even directly use that in my code. Adding that would only be to satisfy the mutation testing. I would also like to avoid adding anything to the PITest maven config that excludes all calls to Map.of() or similar since I assume that non-empty maps wouldn't get coverage.
Interestingly if I replace my usage of Map.of() with Collections.emptyMap() in my source code class, PITest report still reports it replaced Collections.emptyMap() with Collections.emptyMap().
Also note, there are other properties in my real implementation that use Set.of() and also initial values such as empty string "" and PITest is reporting it replaced those with Collections.emptySet() and "" respectively as well, leading me to believe there is a misunderstanding between PITest and Lombok Builder.
The text was updated successfully, but these errors were encountered:
Ok so I was looking over things again and I now that I am looking at it a bit more, the message in the tooltip for the info property line is saying
getInfo : replaced return value with Collections.emptyMap for com/pitestrepro/ApplicationState$InnerState::getInfo → SURVIVED
Which I am now realizing probably is talking about replacing the return value in the auto-generated getInfo method that lombok is creating in the bytecode, but isn't present in my source code, and doesn't really have anything to do with replacing the initial value I am providing to the property for the purpose of the lombok @Builder.Default. I think it was tripping me up because of the line it was showing the message on, but I don't really know where else it would have to show message due to it not being present in the source code. It's interesting its able to backwards associate it.
I also came across #347 and I think this discussion is more along the lines of what I was experiencing, but not realizing was happening. Reading that issue, I found the lombok config that includes @Generated to the generated methods/classes and this seems to clear that up. However unless I add any addition non-lombok generated code then there's really nothing left for PITest to mutate, so no report is created for the class.
Anyway, I think this issue can be closed. Thank you for your time.
This is very similar behavior as #1106 , but that says it was fixed on release 1.9.10. I was using 1.17.4 and just updated to 1.18.0 today and still seeing this behavior. However, I am wondering if this has something to do with the fact I am using Lombok on this class.
I am using
org.pitest.pitest-maven
(tried 1.17.4 and 1.18.0) andorg.projectlombok.lombok
1.18.28I will try to provide a minimal reproducible example from what I have going on.
ApplicationState.java
My test looks something like this:
ApplicationStateTest.java
My assertion of course passes because PITest in its generated report, says it replaced
Map.of()
withCollections.emptyMap()
which are both initially empty maps. I would prefer to avoid adding rather unnecessary assertions to check that the property isn't the same asCollections.emptyMap()
since I don't even directly use that in my code. Adding that would only be to satisfy the mutation testing. I would also like to avoid adding anything to the PITest maven config that excludes all calls to Map.of() or similar since I assume that non-empty maps wouldn't get coverage.Interestingly if I replace my usage of
Map.of()
withCollections.emptyMap()
in my source code class, PITest report still reports it replacedCollections.emptyMap()
withCollections.emptyMap()
.Also note, there are other properties in my real implementation that use
Set.of()
and also initial values such as empty string "" and PITest is reporting it replaced those withCollections.emptySet()
and""
respectively as well, leading me to believe there is a misunderstanding between PITest and Lombok Builder.The text was updated successfully, but these errors were encountered: