@Test
public void checkNetworkFlows() throws IOException {

    Line line2 = Mockito.mock(Line.class);
    Mockito.when(line2.getId()).thenReturn("line2");
    Mockito.when(line2.getTerminal1()).thenReturn(terminal1);
    Mockito.when(line2.getTerminal2()).thenReturn(terminal2);
    Mockito.when(line2.getR()).thenReturn(r);
    Mockito.when(line2.getX()).thenReturn(x);
    Mockito.when(line2.getG1()).thenReturn(g1);
    Mockito.when(line2.getG2()).thenReturn(g2);
    Mockito.when(line2.getB1()).thenReturn(b1);
    Mockito.when(line2.getB2()).thenReturn(b2);
    TwoWindingsTransformer transformer2 = Mockito.mock(TwoWindingsTransformer.class);
    Mockito.when(transformer2.getId()).thenReturn("transformer2");
    Mockito.when(transformer2.getTerminal1()).thenReturn(terminal1);
    Mockito.when(transformer2.getTerminal2()).thenReturn(terminal2);
    Mockito.when(transformer2.getR()).thenReturn(r * (1 - r / 100));
    Mockito.when(transformer2.getX()).thenReturn(x * (1 - x / 100));
    Mockito.when(transformer2.getG()).thenReturn(g1 * (1 - g1 / 100));
    Mockito.when(transformer2.getB()).thenReturn(b1 * 2 * (1 - b1 / 100));
    Mockito.when(transformer2.getRatioTapChanger()).thenReturn(ratioTapChanger);
    Mockito.when(transformer2.getOptionalRatioTapChanger()).thenReturn(Optional.ofNullable(ratioTapChanger));
    Mockito.when(transformer2.hasRatioTapChanger()).thenReturn(true);
    Mockito.when(transformer2.getRatedU1()).thenReturn(ratedU1);
    Mockito.when(transformer2.getRatedU2()).thenReturn(ratedU2);
    assertTrue(FlowsValidation.INSTANCE.checkFlows(transformer2, looseConfig, NullWriter.NULL_WRITER));
    assertFalse(FlowsValidation.INSTANCE.checkFlows(transformer2, strictConfig, NullWriter.NULL_WRITER));
    Network network = Mockito.mock(Network.class);
    Mockito.when(network.getId()).thenReturn("network");
    Mockito.when(network.getLineStream()).thenAnswer(dummy -> Stream.of(line2, line1));
    Mockito.when(network.getTwoWindingsTransformerStream()).thenAnswer(dummy -> Stream.of(transformer2, transformer1));
    assertTrue(FlowsValidation.INSTANCE.checkFlows(network, looseConfig, data));
    assertFalse(FlowsValidation.INSTANCE.checkFlows(network, strictConfig, data));
    assertTrue(ValidationType.FLOWS.check(network, looseConfig, tmpDir));
    assertFalse(ValidationType.FLOWS.check(network, strictConfig, tmpDir));
    ValidationWriter validationWriter = ValidationUtils.createValidationWriter(network.getId(), looseConfig, NullWriter.NULL_WRITER, ValidationType.FLOWS);
    assertTrue(ValidationType.FLOWS.check(network, looseConfig, validationWriter));
}