@Test
public void testFix() {

    UcteElementId id = createElementId();
    UcteRegulation regulation = new UcteRegulation(id, null, null);
    UctePhaseRegulation invalidPhaseRegulation1 = new UctePhaseRegulation(0.0f, 1, 1, -10);
    UctePhaseRegulation invalidPhaseRegulation2 = new UctePhaseRegulation(Float.NaN, null, null, Float.NaN);
    UctePhaseRegulation invalidPhaseRegulation3 = new UctePhaseRegulation(Float.NaN, 0, null, Float.NaN);
    UctePhaseRegulation invalidPhaseRegulation4 = new UctePhaseRegulation(Float.NaN, 1, null, Float.NaN);
    UctePhaseRegulation invalidPhaseRegulation5 = new UctePhaseRegulation(Float.NaN, 1, 0, Float.NaN);
    regulation.setPhaseRegulation(invalidPhaseRegulation1);
    regulation.fix();
    assertNotNull(regulation.getPhaseRegulation());
    assertTrue(Float.isNaN(invalidPhaseRegulation1.getU()));
    testFix(regulation, invalidPhaseRegulation2);
    testFix(regulation, invalidPhaseRegulation3);
    testFix(regulation, invalidPhaseRegulation4);
    testFix(regulation, invalidPhaseRegulation5);
    UcteAngleRegulation invalidAngleRegulation1 = new UcteAngleRegulation(0.0f, 0.0f, 1, 1, 0.0f, null);
    UcteAngleRegulation invalidAngleRegulation2 = new UcteAngleRegulation(Float.NaN, Float.NaN, null, null, Float.NaN, null);
    UcteAngleRegulation invalidAngleRegulation3 = new UcteAngleRegulation(Float.NaN, Float.NaN, 0, null, Float.NaN, null);
    UcteAngleRegulation invalidAngleRegulation4 = new UcteAngleRegulation(Float.NaN, Float.NaN, 1, null, Float.NaN, null);
    UcteAngleRegulation invalidAngleRegulation5 = new UcteAngleRegulation(Float.NaN, Float.NaN, 1, 0, Float.NaN, null);
    UcteAngleRegulation invalidAngleRegulation6 = new UcteAngleRegulation(Float.NaN, Float.NaN, 1, 0, Float.NaN, null);
    UcteAngleRegulation invalidAngleRegulation7 = new UcteAngleRegulation(0.0f, Float.NaN, 1, 0, Float.NaN, null);
    regulation.setAngleRegulation(invalidAngleRegulation1);
    regulation.fix();
    assertNotNull(regulation.getAngleRegulation());
    assertEquals(UcteAngleRegulationType.ASYM, invalidAngleRegulation1.getType());
    testFix(regulation, invalidAngleRegulation2);
    testFix(regulation, invalidAngleRegulation3);
    testFix(regulation, invalidAngleRegulation4);
    testFix(regulation, invalidAngleRegulation5);
    testFix(regulation, invalidAngleRegulation6);
    testFix(regulation, invalidAngleRegulation7);
}