TransformersValidation extends AbstractTransformersValidation { public boolean checkTransformer(TwoWindingsTransformer twt, ValidationConfig config, Writer writer) { Objects.requireNonNull(twt); Objects.requireNonNull(config); Objects.requireNonNull(writer); try (ValidationWriter twtsWriter = ValidationUtils.createValidationWriter(twt.getId(), config, writer, ValidationType.TWTS)) { return checkTransformer(twt, config, twtsWriter); } catch (IOException e) { throw new UncheckedIOException(e); } } private  TransformersValidation(); @Override boolean checkTransformers(Network network, ValidationConfig config, ValidationWriter twtsWriter); boolean checkTransformer(TwoWindingsTransformer twt, ValidationConfig config, Writer writer); boolean checkTransformer(TwoWindingsTransformer twt, ValidationConfig config, ValidationWriter twtsWriter); boolean checkTransformer(String id, double rho, double rhoPreviousStep, double rhoNextStep, int tapPosition,
                                           int lowTapPosition, int highTapPosition, double targetV, Side regulatedSide, double v,
                                           boolean connected, boolean mainComponent, ValidationConfig config, Writer writer); boolean checkTransformer(String id, double rho, double rhoPreviousStep, double rhoNextStep, int tapPosition,
                                           int lowTapPosition, int highTapPosition, double targetV, Side regulatedSide, double v,
                                           boolean connected, boolean mainComponent, ValidationConfig config, ValidationWriter twtsWriter); static final TransformersValidation INSTANCE; }
@Test public void checkTwtsValues() { assertTrue(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, v, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, lowV, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, Float.NaN, rhoNextStep, lowTapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, lowV, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, highV, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, Float.NaN, highTapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, highV, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, Float.NaN, regulatedSide, v, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); assertFalse(TransformersValidation.INSTANCE.checkTransformer("test", rho, rhoPreviousStep, rhoNextStep, tapPosition, lowTapPosition, highTapPosition, targetV, regulatedSide, Float.NaN, connected, mainComponent, strictConfig, NullWriter.NULL_WRITER)); }
@Test public void checkTwts() { assertTrue(TransformersValidation.INSTANCE.checkTransformer(transformer, strictConfig, NullWriter.NULL_WRITER)); Mockito.when(bus.getV()).thenReturn(highV); assertFalse(TransformersValidation.INSTANCE.checkTransformer(transformer, strictConfig, NullWriter.NULL_WRITER)); }