Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COHi David, Thanks for the prompt reply. You are right, the logic being tested does have a pre-condition which is that the MovieName for the entity has already been set by some other piece of logic in the distant past( In the entity's life cycle). That logic too also been unit tested and is fine. My requirement is that the 2 pieces of logic need to be tested independently, which I understand is the right way to unit test.
      singulars
    2. CO@rhk98: In general, yes, that's the right way to unit test. So this may require a deeper look at that "logic in the distant past." It sounds like that logic needs to be provided to the test or perhaps mocked in some way. Without more information about that logic, I can't really be more specific. This is likely one of those cases where you need to look at the return on investment for doing it "the clean way." Using reflection "works" and may be "good enough" in this case, it's just a matter of how much "the clean way" is worth to you.
      singulars
    3. COSorry,when I meant the entity's life cycle I did not mean the development lifecycle but the lifecycle of the Movie object after it has been created. After creation, some logic added the Movie Name(not by reflection but a separate method). The entity then got persisted. Some Other Client later retrieves the persisted entity( with MovieName set) and wants to add a review. The concept I am trying to get at is that an object's behaviour can depend on state that is not modifiable as per the Class's interface. Yet that behaviour needs to be unit tested.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload