Skip to content

Commit

Permalink
Resueltos todos los conflictos, Corregido el problema del duplicado d…
Browse files Browse the repository at this point in the history
…e la clase DAO
  • Loading branch information
HERRERA99 committed Oct 23, 2024
1 parent 8ada526 commit b3eff7a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
import android.database.sqlite.SQLiteException;

import es.unican.gasolineras.model.PuntoInteres;
import es.unican.gasolineras.repository.IPuntosInteresDao;
import es.unican.gasolineras.repository.IPuntosInteresDAO;


/**
* El presenter que controla la actividad añadir punto interés.
*/
public class AnhadirPuntoInteresPresenter implements IAnhadirPuntoInteresContract.Presenter {

private IAnhadirPuntoInteresContract.View vista;
private IPuntosInteresDao puntosInteresDao;
private IPuntosInteresDAO puntosInteresDao;

/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import es.unican.gasolineras.R;
import es.unican.gasolineras.repository.AppDatabase;
import es.unican.gasolineras.repository.DbFunctions;
import es.unican.gasolineras.repository.IPuntosInteresDao;
import es.unican.gasolineras.repository.IPuntosInteresDAO;


/**
* Actividad que representa la vista para añadir un nuevo punto de interés.
Expand Down Expand Up @@ -117,7 +118,7 @@ public void cerrarVista() {
* @return El DAO de puntos de interés.
*/
@Override
public IPuntosInteresDao getPuntosInteresDAO() {
public IPuntosInteresDAO getPuntosInteresDAO() {
AppDatabase db = DbFunctions.generaBaseDatosPuntosInteres(getApplicationContext());
return db.puntosInteresDao();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package es.unican.gasolineras.activities.puntoInteres;

import es.unican.gasolineras.repository.IPuntosInteresDao;
import es.unican.gasolineras.repository.IPuntosInteresDAO;


/**
* Interfaz que define la vista para la funcionalidad de añadir un punto de interés.
Expand Down Expand Up @@ -55,7 +56,7 @@ public interface View {
*
* @return El DAO de puntos de interés.
*/
public IPuntosInteresDao getPuntosInteresDAO();
public IPuntosInteresDAO getPuntosInteresDAO();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Setter
@Entity(indices = {@Index(value = {"nombre"}, unique = true)})
public class PuntoInteres {
@PrimaryKey
@PrimaryKey(autoGenerate = true)
public int idPuntoInteres;

@ColumnInfo(name = "nombre")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ public interface IPuntosInteresDAO {

@Delete
void delete(PuntoInteres puntoInteres);

@Query("DELETE FROM PuntoInteres")
void deleteAll();
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,20 @@
import static org.mockito.Mockito.when;

import android.content.Context;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteException;

import androidx.test.core.app.ApplicationProvider;

import org.junit.Before;
import org.junit.Test;
import org.junit.function.ThrowingRunnable;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.robolectric.RobolectricTestRunner;

import es.unican.gasolineras.activities.puntoInteres.AnhadirPuntoInteresPresenter;
import es.unican.gasolineras.activities.puntoInteres.IAnhadirPuntoInteresContract;
import es.unican.gasolineras.activities.puntoInteres.IAnhadirPuntoInteresContract.View;
import es.unican.gasolineras.model.GasolinerasResponse;
import es.unican.gasolineras.model.PuntoInteres;
import es.unican.gasolineras.repository.AppDatabase;
import es.unican.gasolineras.repository.DbFunctions;
import es.unican.gasolineras.repository.IPuntosInteresDao;
import es.unican.gasolineras.repository.IPuntosInteresDAO;

@RunWith(RobolectricTestRunner.class)
public class AnhadirPuntoInteresPresenterTest {
Expand All @@ -39,7 +33,7 @@ public class AnhadirPuntoInteresPresenterTest {
Context context = ApplicationProvider.getApplicationContext();

private IAnhadirPuntoInteresContract.View vistaMock;
private IPuntosInteresDao puntosInteresDao;
private IPuntosInteresDAO puntosInteresDao;
private AnhadirPuntoInteresPresenter presenter;

String nombreStr = "casa";
Expand Down

0 comments on commit b3eff7a

Please sign in to comment.