Class TestMissingDataPolicyWiring

java.lang.Object
edu.cmu.tetrad.test.TestMissingDataPolicyWiring

public class TestMissingDataPolicyWiring extends Object
Checks that a score wrapper's missing-data policies agree across the three independent places a policy has to be admitted before a user can reach it:
  1. the score class's own policy switch, which throws on a policy it does not implement;
  2. the wrapper's getParameters(), which is what an interface reads to decide whether to render the control at all;
  3. the native-policy set the wrapper passes to MissingDataUtils .gate, which rejects anything outside it before the score is ever constructed.

Nothing else checks that those three agree, and they have drifted: EM covariance support was added to DegenerateGaussianScore and BasisFunctionBicScore, and the parameter was declared, while both wrappers still passed Set.of("testwise") to the gate. The score worked when constructed directly -- as BossMissingDataStudy does -- and was unreachable from the interface, which is the failure this test exists to catch.

The expected policies are written out per wrapper below rather than discovered, so the test fails in both directions: a policy that should work but throws, and a policy that should be refused but silently succeeds. Adding support to a score means updating this table, which is the point.

Author:
josephramsey
  • Constructor Details

    • TestMissingDataPolicyWiring

      public TestMissingDataPolicyWiring()
      Default constructor for the TestMissingDataPolicyWiring class.
  • Method Details

    • policiesReachableThroughWrapper

      public void policiesReachableThroughWrapper()
      Each wrapper accepts exactly the policies it is expected to, through the same call path an interface uses.
    • policyParametersAreDeclared

      public void policyParametersAreDeclared()
      A wrapper that gates a policy must also declare the parameters that select it, or the control never renders and the policy is unreachable however well the score implements it.