Example usage for java.util Calendar DAY_OF_YEAR

List of usage examples for java.util Calendar DAY_OF_YEAR

Introduction

In this page you can find the example usage for java.util Calendar DAY_OF_YEAR.

Prototype

int DAY_OF_YEAR

To view the source code for java.util Calendar DAY_OF_YEAR.

Click Source Link

Document

Field number for get and set indicating the day number within the current year.

Usage

From source file:com.appeligo.showfiles.FilesByTime.java

/**
 * @param request//from w w w. ja va2 s  . com
 * @param out
 * @param path
 */
private void listFiles(HttpServletRequest request, PrintWriter out, String path, int limit) {
    header(out);
    Comparator<File> comparator = new Comparator<File>() {
        public int compare(File leftFile, File rightFile) {
            long leftMod = leftFile.lastModified();
            long rightMod = rightFile.lastModified();
            if (leftMod < rightMod) {
                return -1;
            } else if (leftMod > rightMod) {
                return 1;
            } else {
                return leftFile.getPath().compareTo(rightFile.getPath());
            }
        }
    };
    SortedSet<File> fileSet = new TreeSet<File>(comparator);
    addFile(fileSet, new File(path));

    log.info("Total files in tree is " + fileSet.size());

    if (limit > 0 && fileSet.size() > limit) {
        log.info("Trimming tree to limit " + limit);
        Iterator<File> iter = fileSet.iterator();
        int toDrop = fileSet.size() - limit;
        for (int i = 0; i < toDrop; i++) {
            iter.next();
        }
        File first = iter.next();
        fileSet = fileSet.tailSet(first);
    }

    int suggestedLimit = 1000;
    if (limit == 0 && fileSet.size() > suggestedLimit) {
        out.println("That's a lot of files!  There are " + fileSet.size() + " files to return.<br/>");
        out.println("How about just the <a href=\"" + request.getRequestURI() + "?" + suggestedLimit
                + "\">last " + suggestedLimit + "</a>.<br/>");
        out.println("If you really want them all, <a href=\"" + request.getRequestURI() + "?"
                + (fileSet.size() + suggestedLimit) + "\">click here</a>.<br/>");
    } else {

        DateFormat dateFormat = SimpleDateFormat.getDateInstance();
        DateFormat timeFormat = SimpleDateFormat.getTimeInstance();
        Calendar lastDay = Calendar.getInstance();
        Calendar day = Calendar.getInstance();
        boolean first = true;

        for (File file : fileSet) {
            Date fileDate = new Date(file.lastModified());
            day.setTime(fileDate);
            if (first || lastDay.get(Calendar.DAY_OF_YEAR) != day.get(Calendar.DAY_OF_YEAR)) {
                out.print("<b>" + dateFormat.format(fileDate) + "</b><br/>");
            }
            String servlet = "/ShowFile";
            if (file.getPath().endsWith(".flv")) {
                servlet = "/ShowFlv";
            }
            out.print(timeFormat.format(fileDate) + " <a href=\"" + request.getContextPath() + servlet
                    + file.getPath().substring(documentRoot.length()) + "\">" + file.getPath() + "</a>");
            out.println("<br/>");
            lastDay.setTime(fileDate);
            first = false;
        }
    }
    footer(out);
}

From source file:com.tianxiaxinyong.web.security.shrio.ShiroAuthorizingRealm.java

/**
 * @category ???//from ww w.  j av a  2  s . c o  m
 * @param lockedDate
 * @param nowDate
 * @param loginFailureLockTime
 * @return
 */
private boolean isUnLock(Date lockedDate, Date nowDate, int loginFailureLockTime) {
    //?+????
    Calendar calendarLock = Calendar.getInstance();
    calendarLock.setTime(lockedDate);
    calendarLock.add(Calendar.DAY_OF_YEAR, loginFailureLockTime);
    Calendar calendarNow = Calendar.getInstance();
    calendarNow.setTime(nowDate);
    if (calendarLock.getTimeInMillis() > calendarNow.getTimeInMillis()) {
        return false;
    } else {
        //??
        return true;
    }

}

From source file:com.msds.km.controller.BespeakController.java

@RequestMapping("/addMember")
public ModelAndView addMember(MemberEntity entity, HttpServletRequest request) throws Exception {
    entity.setIsEdit(false);//from  w ww. j  a  va 2s.c o  m
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Calendar rightNow = Calendar.getInstance();
    rightNow.add(Calendar.DAY_OF_YEAR, -1);
    Date dt1 = rightNow.getTime();
    String reStr = sdf.format(dt1);
    request.setAttribute("now", reStr);
    request.setAttribute("member", entity);
    return forword("/km/member/member_edit", null);
}

From source file:com.netflix.genie.core.services.impl.LocalJobKillServiceImpl.java

private void killJobOnUnix(final int pid) throws GenieException {
    try {//from  w ww .ja  va  2s. c o m
        // Ensure this process check can't be timed out
        final Calendar tomorrow = Calendar.getInstance(JobConstants.UTC);
        tomorrow.add(Calendar.DAY_OF_YEAR, 1);
        final ProcessChecker processChecker = new UnixProcessChecker(pid, this.executor, tomorrow.getTime());
        processChecker.checkProcess();
    } catch (final ExecuteException ee) {
        // This means the job was done already
        log.debug("Process with pid {} is already done", pid);
        return;
    } catch (final IOException ioe) {
        throw new GenieServerException("Unable to check process status for pid " + pid, ioe);
    }

    // TODO: Do we need retries?
    // This means the job client process is still running
    try {
        final CommandLine killCommand;
        if (this.runAsUser) {
            killCommand = new CommandLine("sudo");
            killCommand.addArgument("kill");
        } else {
            killCommand = new CommandLine("kill");
        }
        killCommand.addArguments(Integer.toString(pid));
        this.executor.execute(killCommand);
    } catch (final IOException ioe) {
        throw new GenieServerException("Unable to kill process " + pid, ioe);
    }
}

From source file:net.chaosserver.timelord.data.XmlDataReaderWriter.java

/**
 * Writes out the timelordData object to the default filename in the
 * user's home directory. Also generates a backup version of the file.
 *
 * @param timelordData the data to write to file
 * @param outputFile the file to output to
 * @throws TimelordDataException indicates an error writing the
 *         data out to file.//from  w w w . jav  a  2s . c o  m
 */
public void writeTimelordData(TimelordData timelordData, File outputFile) throws TimelordDataException {
    Calendar yesterday = Calendar.getInstance();
    yesterday.add(Calendar.DAY_OF_YEAR, -1);

    File homeDirectory = new File(System.getProperty("user.home"));

    try {
        FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream);

        XMLEncoder xmlEncoder = new XMLEncoder(bufferedOutputStream);
        xmlEncoder.writeObject(timelordData);
        xmlEncoder.close();

        File backupFile = new File(homeDirectory, (DEFAULT_FILENAME + "."
                + startWeekFormat.format(yesterday.getTime()) + DEFAULT_EXTENSION + ".gzip"));
        fileOutputStream = new FileOutputStream(backupFile);
        bufferedOutputStream = new BufferedOutputStream(fileOutputStream);
        GZIPOutputStream zipOutputStream = new GZIPOutputStream(bufferedOutputStream);

        xmlEncoder = new XMLEncoder(zipOutputStream);
        xmlEncoder.writeObject(timelordData);
        xmlEncoder.close();
    } catch (FileNotFoundException e) {
        throw new TimelordDataException("Failed to output", e);
    } catch (IOException e) {
        throw new TimelordDataException("Failed to output", e);
    }
}

From source file:br.com.hslife.orcamento.controller.OrcamentoController.java

@Override
public String save() {
    // Preenche a data de fim do perodo
    if (!entity.getPeriodoLancamento().equals(PeriodoLancamento.FIXO)) {
        Calendar temp = Calendar.getInstance();
        temp.setTime(entity.getInicio());

        switch (entity.getPeriodoLancamento()) {
        case MENSAL:
            temp.add(Calendar.MONTH, 1);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        case BIMESTRAL:
            temp.add(Calendar.MONTH, 2);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        case TRIMESTRAL:
            temp.add(Calendar.MONTH, 3);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        case QUADRIMESTRAL:
            temp.add(Calendar.MONTH, 4);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        case SEMESTRAL:
            temp.add(Calendar.MONTH, 6);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        case ANUAL:
            temp.add(Calendar.YEAR, 1);
            temp.add(Calendar.DAY_OF_YEAR, -1);
            break;
        default://from   w  w  w . j a va  2s.  c o m
            errorMessage("Opo invlida!");
            return "";
        }

        entity.setFim(temp.getTime());
    }
    entity.setDetalhes(listaItemDetalheOrcamento);
    entity.setUsuario(getUsuarioLogado());
    return super.save();
}

From source file:net.audumla.climate.bom.BOMStatisticalClimateDataObserver.java

private void loadHistoricalData(CSVReader reader) {
    // http://www.bom.gov.au/clim_data/cdio/tables/text/IDCJCM0035_086351.csv
    try {/*from   ww  w  .ja va2s  . co  m*/
        String[] data;
        while ((data = reader.readNext()) != null) {
            if (data.length > 0) {
                if (data[0].contains("Elevation")) {
                    Matcher m = numberPattern.matcher(data[0]);
                    if (m.find()) {
                        source.setElevation(SafeParse.parseDouble(m.group(1)));
                    }
                    continue;
                }
                if (data[0].contains("Latitude")) {
                    Matcher m = numberPattern.matcher(data[0]);
                    if (m.find()) {
                        source.setLatitude(-1 * SafeParse.parseDouble(m.group(1)));
                    }
                    continue;
                }
                if (data[0].contains("Longitude")) {
                    Matcher m = numberPattern.matcher(data[0]);
                    if (m.find()) {
                        source.setLongitude(SafeParse.parseDouble(m.group(1)));
                    }
                    continue;
                }
                if (data[0].contains("Commenced")) {
                    Matcher m = numberPattern.matcher(data[0]);
                    if (m.find()) {
                        Calendar c = Calendar.getInstance();
                        c.setTime(Time.getZeroDate());
                        c.set(Calendar.YEAR, SafeParse.parseInteger(m.group(1)));
                        source.setFirstRecord(c.getTime());
                    }
                    continue;
                }
                if (data[0].contains("Last Record")) {
                    Matcher m = numberPattern.matcher(data[0]);
                    if (m.find()) {
                        Calendar c = Calendar.getInstance();
                        c.setTime(Time.getZeroDate());
                        c.set(Calendar.YEAR, SafeParse.parseInteger(m.group(1)));
                        c.set(Calendar.DAY_OF_YEAR, c.getActualMaximum(Calendar.DAY_OF_YEAR));
                        source.setLastRecord(c.getTime());
                    }
                    continue;
                }
                if (data[0].contains("State")) {
                    Matcher m = wordPattern.matcher(data[0]);
                    if (m.find()) {
                        source.setState(m.group(1));
                    }
                    continue;
                }
                if (data[0].contains("Mean maximum temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setMaximumTemperature(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean minimum temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setMinimumTemperature(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean rainfall")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setAvgRainfall(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean number of days of rain >= 1 mm")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setRainfallDaysAbove1mm(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean daily sunshine")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setSunshineHours(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean daily solar exposure")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setSolarRadiation(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean daily evaporation")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        bomdata.setEvaporation(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean daily wind run")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        Double ws = SafeParse.parseDouble(data[i]);
                        if (ws != null) {
                            bomdata.setAverageWindSpeed(ws / 24);
                            bomdata.setWindSpeedHeight(10.0);
                        }
                        ++i;
                    }
                    continue;
                }

                /*
                      * Mean 3pm temperature (Degrees C) for years 1979 to 2002 Mean 3pm dew point temperature (Degrees C) for years 1979 to 2002 Mean 3pm
                 * relative humidity (%) for years 1979 to 2002 Mean 3pm wind speed (km/h) for years 1979 to 2002
                 */
                if (data[0].contains("Mean 3pm temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 15);
                        obs.setTemperature(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 3pm dew point temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 15);
                        obs.setDewPoint(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 3pm relative humidity")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 15);
                        obs.setHumidity(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 3pm wind speed")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 15);
                        obs.setWindSpeed(SafeParse.parseDouble(data[i]));
                        obs.setWindSpeedHeight(10.0);
                        ++i;
                    }
                    continue;
                }

                if (data[0].contains("Mean 9am temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 9);
                        obs.setTemperature(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 9am dew point temperature")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 9);
                        obs.setDewPoint(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 9am relative humidity")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 9);
                        obs.setHumidity(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
                if (data[0].contains("Mean 9am wind speed")) {
                    int i = 1;
                    for (WritableClimateData statdata : statData.values()) {
                        BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
                        WritableClimateObservation obs = getObservation(bomdata, 9);
                        obs.setWindSpeed(SafeParse.parseDouble(data[i]));
                        ++i;
                    }
                    continue;
                }
            }
        }
        for (WritableClimateData statdata : statData.values()) {
            BOMClimateStatisticalData bomdata = (BOMClimateStatisticalData) statdata;
            Calendar c = Calendar.getInstance();
            c.setTime(bomdata.getTime());
            int daysInMonth = c.getActualMaximum(Calendar.DAY_OF_MONTH);
            bomdata.setRainfall(bomdata.getAvgRainfall() / bomdata.getRainfallDaysAbove1mm());
            bomdata.setRainfallProbability((bomdata.getRainfallDaysAbove1mm() / daysInMonth) * 100);
        }
    } catch (Exception e) {
        //e.printStackTrace();
        // logger.error("Error reading statistic data", e);
        logger.error(
                "Error loading statistic data for station - " + getSource().getId() + " : " + e.getMessage());
    }
}

From source file:fr.aliasource.webmail.invitation.GetInvitationInfoAction.java

private Date clearDate(Date date) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(date);/*from w  ww .j ava2s  .c  om*/
    cal.set(Calendar.YEAR, 0);
    cal.set(Calendar.MONTH, 0);
    cal.set(Calendar.DAY_OF_YEAR, 0);
    return cal.getTime();
}

From source file:com.lm.lic.manager.controller.AbstractWithdrawLicController.java

/**
 * @param license//from  w  w  w .  ja v  a  2s.c  o m
 * @return
 */
protected Timestamp calcLicenseLife(License license) {
    Calendar cal = Calendar.getInstance();
    int nowDayOfyear = cal.get(Calendar.DAY_OF_YEAR);
    int licLife = nowDayOfyear + license.getLifeInDays();
    cal.set(Calendar.DAY_OF_YEAR, licLife);
    Timestamp dateExpires = new Timestamp(cal.getTimeInMillis());
    return dateExpires;
}

From source file:es.udc.fic.test.model.RegataTest.java

@Test
public void testDiaIniDiaFin() {

    //Creamos una sola regata con la instancia de todos los objetos en memoria
    Regata regata = new Regata();
    regata.setNombre("Mock Regata");
    regata.setDescripcion("Mock Desc");
    regataDao.save(regata);/*from   www . j a  v a  2 s  . c  om*/

    Tipo tipoCatamaran = new Tipo("Catamarn", "Desc Catamarn", false);
    tipoDao.save(tipoCatamaran);

    Tipo tipoCrucero = new Tipo("Crucero", "Desc Crucero", false);
    tipoDao.save(tipoCrucero);

    Tipo tipoLigero = new Tipo("Vela ligera", "Desc Vela ligera", true);
    tipoDao.save(tipoLigero);

    Barco b1 = new Barco(204566, "Juan Sebastian El Cano", tipoCatamaran, new Float(1.5), "Lagoon 421");
    inscripcionService.inscribir(regata, b1, "Iago Surez");
    Barco b2 = new Barco(199012, "El Holandes Errante", tipoCrucero, new Float(2.5), "SWAN 66 FD");
    inscripcionService.inscribir(regata, b2, "Samu Paredes");
    Barco b3 = new Barco(201402, "La Perla Negra", tipoCrucero, new Float(1.5), "X6");
    inscripcionService.inscribir(regata, b3, "Adrian Pallas");
    Barco b4 = new Barco(202102, "La Pinta", tipoCrucero, new Float(1.5), "X6");
    inscripcionService.inscribir(regata, b4, "Pedro Cabalar");
    Barco b5 = new Barco(182345, "Venus", tipoLigero, null, "Laser Standar");
    inscripcionService.inscribir(regata, b5, "Jesus Lopez");
    Barco b6 = new Barco(206745, "Apolo", tipoLigero, null, "Laser Radial");
    inscripcionService.inscribir(regata, b6, "Diego Bascoy");

    Calendar dia1 = Calendar.getInstance();
    dia1.add(Calendar.DAY_OF_YEAR, -18);

    Calendar dia2 = Calendar.getInstance();
    dia2.add(Calendar.DAY_OF_YEAR, -18);
    dia2.add(Calendar.HOUR, 2);

    Calendar dia3 = Calendar.getInstance();
    dia3.add(Calendar.DAY_OF_YEAR, -17);

    Manga manga1 = new Manga(dia1, regata, null, 100);
    Manga manga2 = new Manga(dia2, regata, null, 100);
    Manga manga3 = new Manga(dia3, regata, null, 100);

    List<Posicion> posManga1 = new ArrayList<Posicion>();

    posManga1.add(new Posicion(new Long(3600), Penalizacion.DNC, manga1, b1, (long) 0));
    posManga1.add(new Posicion(new Long(3700), Penalizacion.OCS, manga1, b2, (long) 0));
    posManga1.add(new Posicion(new Long(3750), Penalizacion.NAN, manga1, b3, (long) 0));
    posManga1.add(new Posicion(new Long(3900), Penalizacion.NAN, manga1, b4, (long) 0));
    posManga1.add(new Posicion(new Long(3400), Penalizacion.SCP, manga1, b5, (long) 0));
    posManga1.add(new Posicion(new Long(2400), Penalizacion.NAN, manga1, b6, (long) 0));
    manga1.setPosiciones(posManga1);
    mangaService.cerrarYGuardarManga(manga1);
    regata.addManga(manga1);

    List<Posicion> posManga2 = new ArrayList<Posicion>();

    posManga2.add(new Posicion(new Long(3400), Penalizacion.NAN, manga2, b1, (long) 0));
    posManga2.add(new Posicion(new Long(3600), Penalizacion.NAN, manga2, b2, (long) 0));
    posManga2.add(new Posicion(new Long(3950), Penalizacion.NAN, manga2, b3, (long) 0));
    posManga2.add(new Posicion(new Long(3200), Penalizacion.RDG, manga2, b4, (long) 0));
    posManga2.add(new Posicion(new Long(3100), Penalizacion.NAN, manga2, b5, (long) 0));
    posManga2.add(new Posicion(new Long(2800), Penalizacion.RET, manga2, b6, (long) 0));
    manga2.setPosiciones(posManga2);
    mangaService.cerrarYGuardarManga(manga2);
    regata.addManga(manga2);

    List<Posicion> posManga3 = new ArrayList<Posicion>();

    posManga3.add(new Posicion(new Long(13500), Penalizacion.RDG, manga3, b1, (long) 0));
    posManga3.add(new Posicion(new Long(13200), Penalizacion.NAN, manga3, b2, (long) 0));
    posManga3.add(new Posicion(new Long(13350), Penalizacion.DGM, manga3, b3, (long) 0));
    posManga3.add(new Posicion(new Long(13900), Penalizacion.NAN, manga3, b4, (long) 0));
    posManga3.add(new Posicion(new Long(14400), Penalizacion.DNE, manga3, b5, (long) 0));
    posManga3.add(new Posicion(new Long(15400), Penalizacion.NAN, manga3, b6, (long) 0));
    manga3.setPosiciones(posManga3);
    mangaService.cerrarYGuardarManga(manga3);
    regata.addManga(manga3);

    assertEquals(dia1, regata.getDiaIni());
    assertEquals(dia3, regata.getDiaFin());

    assertEquals(regata.getDiasManga().size(), 2);
    assertEquals(regata.getDiasManga().get(0), dia1);
    assertEquals(regata.getDiasManga().get(1), dia3);
}