Hardcoding of results should be able to apply to MutabilityAssert.assertX #64

Closed
Grundlefleck opened this Issue Nov 22, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@Grundlefleck
Contributor

Grundlefleck commented Nov 22, 2015

See this comment thread for further background.

Currently hardcoding of results via Configuration only applies when the mutability of class A is being looked up while analysing B, which references A. It should be possible to rely on the hardcoded results while calling MutabilityAssert.assertX methods. This allows assertions to be called programatically, and rely on the hardcoded results.

This should be configurable, and off by default, to retain backwards compatibility. Otherwise the following scenario could occur:

  • there is a test using MutabilityAssert.assertImmutable(A.class); with some allowed reasons
  • hardcoding of A to be immutable, to support the allowed reasons
  • tests for other classes referencing A, which consider A to be immutable
  • Mutability Detector is released where assertImmutable(A.class) now uses the hardcoded result
  • the class A is modified to be mutable in a way that is not allowed
  • the test for A does not fail

First thought is to name the configuration setting use hardcoded results for direct assertions.

@Grundlefleck

This comment has been minimized.

Show comment
Hide comment
@Grundlefleck

Grundlefleck Nov 22, 2015

Contributor

Ideally, the result of assertion, with all it's allowed reasons, would be used for the lookup, but that's a bigger change to consider.

Contributor

Grundlefleck commented Nov 22, 2015

Ideally, the result of assertion, with all it's allowed reasons, would be used for the lookup, but that's a bigger change to consider.

Grundlefleck added a commit that referenced this issue Nov 22, 2015

Grundlefleck added a commit that referenced this issue Nov 26, 2015

Merge pull request #65 from alexsalesdev/master
Added hard coded result usage only when it is DIRECTLY_IN_ASSERTION

(for issue #64)
@Grundlefleck

This comment has been minimized.

Show comment
Hide comment
@Grundlefleck

Grundlefleck Nov 26, 2015

Contributor

Relates to #65

Contributor

Grundlefleck commented Nov 26, 2015

Relates to #65

@Grundlefleck

This comment has been minimized.

Show comment
Hide comment
@Grundlefleck

Grundlefleck Dec 5, 2015

Contributor

Fixed and will be in the next version.

Contributor

Grundlefleck commented Dec 5, 2015

Fixed and will be in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment