Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/508848-MostrarPreciosCom…
Browse files Browse the repository at this point in the history
…bustibles' into develop
  • Loading branch information
HERRERA99 committed Nov 13, 2024
2 parents 3e37592 + e77995a commit ab9d376
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package es.unican.gasolineras.activities.puntoInteres;
package es.unican.gasolineras.activities.main;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
Expand All @@ -18,21 +18,17 @@
import androidx.test.espresso.Espresso;
import androidx.test.espresso.matcher.RootMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.hamcrest.Matcher;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import dagger.hilt.android.testing.BindValue;
import dagger.hilt.android.testing.HiltAndroidRule;
import dagger.hilt.android.testing.HiltAndroidTest;
import dagger.hilt.android.testing.UninstallModules;
import es.unican.gasolineras.R;
import es.unican.gasolineras.activities.main.MainView;
import es.unican.gasolineras.injection.RepositoriesModule;
import es.unican.gasolineras.repository.AppDatabase;
import es.unican.gasolineras.repository.DbFunctions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package es.unican.gasolineras.activities.common;
package es.unican.gasolineras.activities.main;

import static androidx.test.espresso.Espresso.onData;
import static androidx.test.espresso.Espresso.onView;
Expand Down Expand Up @@ -32,7 +32,6 @@
import dagger.hilt.android.testing.HiltAndroidTest;
import dagger.hilt.android.testing.UninstallModules;
import es.unican.gasolineras.R;
import es.unican.gasolineras.activities.main.MainView;
import es.unican.gasolineras.common.UtilsHorario;
import es.unican.gasolineras.injection.RepositoriesModule;
import es.unican.gasolineras.model.Gasolinera;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package es.unican.gasolineras.common;

import static es.unican.gasolineras.common.UtilsHorario.gasolineraAbierta;
import static es.unican.gasolineras.common.UtilsHorario.procesaHorario;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.time.LocalTime;

import es.unican.gasolineras.activities.main.GasolinerasArrayAdapter;

public class UtilsHorarioTest {

private GasolinerasArrayAdapter adapter;

@Before
public void setUp() throws Exception {
}

@Test
public void procesaHorarioTest() {
Assert.assertEquals(procesaHorario("L-D: 08:00-21:00", "L"), "08:00-21:00");
Assert.assertEquals(procesaHorario("L-D: 08:00-14:00 y 16:00-22:00", "L"), "08:00-14:00 y 16:00-22:00");
Assert.assertEquals(procesaHorario("M-V: 08:00-21:00", "L"), "Todo el día");
Assert.assertEquals(procesaHorario("L-D: 24H", "L"), "24H");
Assert.assertEquals(procesaHorario("", "L"), "Sin detalles de horario");
}

@Test
public void gasolineraAbiertaTest(){
Assert.assertEquals(gasolineraAbierta("08:00-14:00 y 16:00-20:00", LocalTime.of(10, 00)), true);
Assert.assertEquals(gasolineraAbierta("08:00-14:00 y 16:00-20:00", LocalTime.of(15, 00)), false);
Assert.assertEquals(gasolineraAbierta("08:00-14:00 y 16:00-20:00", LocalTime.of(8, 00)), true);
Assert.assertEquals(gasolineraAbierta("08:00-14:00 y 16:00-20:00", LocalTime.of(14, 00,00,1)), false);
Assert.assertEquals(gasolineraAbierta("24H", LocalTime.of(10, 00)), true);
Assert.assertEquals(gasolineraAbierta("Todo el día", LocalTime.of(10, 00)), false);
Assert.assertEquals(gasolineraAbierta("Sin detalles de horario", LocalTime.of(10, 00)), false);


}
}

0 comments on commit ab9d376

Please sign in to comment.