예제 #1
0
  public static void main(String[] args) {

    Grados.usarJava8 = true;

    testConstructorNormal();
    testConstructorExcepcion();

    testSetEmailNormal();
    testSetEmailExcepcion();

    testMatriculaAsignatura();
    testMatriculaAsignaturaExcepcion();

    testEliminaAsignatura();
    testEliminaAsignaturaExcepcion();

    Alumno a1 =
        Grados.createAlumno(
            "12345678Z",
            "Juaan",
            "Nadie Nadie",
            LocalDate.of(1950, 3, 15),
            "*****@*****.**");
    Alumno a2 =
        Grados.createAlumno(
            "12345678Z", "Juan", "Nadie Nadie", LocalDate.of(1950, 3, 15), "*****@*****.**");
    System.out.println(a1.equals(a2));
    System.out.println(a1.compareTo(a2));
  }
예제 #2
0
 private static void testMatriculaAsignatura() {
   System.out.println("\n==================================Probando matriculaAsignatura");
   Alumno a =
       Grados.createAlumno(
           "12345678Z", "Juan", "Nadie Nadie", LocalDate.of(1950, 3, 15), "*****@*****.**");
   Asignatura asig =
       Grados.createAsignatura(
           "Fundamentos de Programación", "2050001", 12.0, TipoAsignatura.ANUAL, 1, null);
   testMatriculaAsignatura(a, asig);
 }
예제 #3
0
  private static void testSetEmailExcepcion() {
    System.out.println("\n==================================Probando setEmail, email incorrecto");

    Alumno a =
        Grados.createAlumno(
            "12345678Z", "Juan", "Nadie Nadie", LocalDate.of(1950, 3, 15), "*****@*****.**");
    testSetEmail(a, "*****@*****.**");
  }
예제 #4
0
  private static void testSetEmailNormal() {
    System.out.println("\n==================================Probando setEmail");

    Alumno a =
        Grados.createAlumno(
            "12345678Z", "Juan", "Nadie Nadie", LocalDate.of(1950, 3, 15), "*****@*****.**");
    testSetEmail(a, "*****@*****.**");
  }
예제 #5
0
  private static void testConstructor(
      String dni, String nombre, String apellidos, LocalDate fechaNacimiento, String email) {

    try {
      Alumno a = Grados.createAlumno(dni, nombre, apellidos, fechaNacimiento, email);
      mostrarAlumno(a);
    } catch (ExcepcionAlumnoNoValido e) {
      System.out.println(
          "******************** Se ha capturado la excepción ExcepcionAlumnoNoValido");
    } catch (Exception e) {
      System.out.println("******************** Se ha capturado una excepción inesperada.");
    }
  }