jeudi 26 novembre 2015

How to write a junit test for javafx checkbox?

So we have class CheckBox_Actions for a mental math programm, if, for instance, plus is selected, other options are consequently disabled. I guess that test for this class is really easy, but I am new to this and unfortunately not able to do that. Thank you in advance.

public static void ChekBoxPlus(Label znak, CheckBox plus, CheckBox minus, CheckBox korrutamine, CheckBox jagamine,
        TextField input) {

    znak.setText("+");
    plus.setDisable(true);
    minus.setDisable(true);
    korrutamine.setDisable(true);
    jagamine.setDisable(true);
}

public static void CheckBoxMinus(Label znak, CheckBox plus, CheckBox minus, CheckBox korrutamine,
        CheckBox jagamine) {

    znak.setText("-");
    plus.setDisable(true);
    minus.setDisable(true);
    korrutamine.setDisable(true);
    jagamine.setDisable(true);
}

public static void ChekBoxMultiply(Label znak, CheckBox plus, CheckBox minus, CheckBox korrutamine,
        CheckBox jagamine) {

    znak.setText("x");
    plus.setDisable(true);
    minus.setDisable(true);
    korrutamine.setDisable(true);
    jagamine.setDisable(true);
}

public static void CheBoxDivide(Label znak, CheckBox plus, CheckBox minus, CheckBox korrutamine,
        CheckBox jagamine) {

    znak.setText(":");
    plus.setDisable(true);
    minus.setDisable(true);
    korrutamine.setDisable(true);
    jagamine.setDisable(true);
}

}

Aucun commentaire:

Enregistrer un commentaire