Skip to content
Snippets Groups Projects
Commit 694e717c authored by Rhys Evans's avatar Rhys Evans
Browse files

Further debugging

parent e321e10b
No related branches found
No related tags found
1 merge request!34Resolve "As a user, I would like a town specific page which shows all trails for that town so that I can easily see my progress"
......@@ -34,6 +34,7 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework:spring-dao:2.0.8'
}
tasks.named('bootBuildImage') {
......@@ -43,3 +44,4 @@ tasks.named('bootBuildImage') {
tasks.named('test') {
useJUnitPlatform()
}
......@@ -55,7 +55,7 @@ insert into badgeprogress (userID, badgeID, progress) value ('1', '1', '40');
insert into badgeprogress (userID, badgeID, progress) value ('1', '2', '70');
insert into badgeprogress (userID, badgeID, progress) value ('2', '2', '70');
delete from stickerprogress;
insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true);
insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true);
insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
\ No newline at end of file
# delete from stickerprogress;
# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true);
# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true);
# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
\ No newline at end of file
......@@ -57,8 +57,8 @@ create table if not exists badgeProgress
create table if not exists stickerProgress
(
userID bigint,
stickerID bigint,
userID int,
stickerID int,
hasSticker boolean /*Has sticker or not*/
) engine=InnoDB;
......
......@@ -29,31 +29,31 @@ import static org.mockito.Mockito.mock;
@Sql({"schema.sql", "data.sql"})
class SmartTownsApplicationTests {
//
// private static TownController townController;
private static TownController townController;
private static Team5.SmartTowns.Data.Location location;
// private static Team5.SmartTowns.Data.Location location;
// @Mock
// private static JdbcTemplate jdbc;
@Autowired
private Team5.SmartTowns.Data.locationRepository locationRepo;
JdbcTemplate jdbc = Mockito.mock(JdbcTemplate.class);
@Autowired
private static Team5.SmartTowns.Data.TownRepository townRepository;
private static Team5.SmartTowns.Data.Location town;
private static RowMapper<Location> locationMapper;
// @Autowired
// private static Team5.SmartTowns.Data.TownRepository townRepository;
//
//
// private static Team5.SmartTowns.Data.Location town;
// private static RowMapper<Location> locationMapper;
@BeforeAll
public void before() {
// MockitoAnnotations.initMocks(this);
location = new Location();
// location = new Location();
locationRepo = mock(new locationRepositoryJDBC(jdbc));
townController = new TownController();
// townController = new TownController();
}
// @BeforeAll
// public static void before(){}
......@@ -67,18 +67,17 @@ class SmartTownsApplicationTests {
@Test
public void whenFilteringTownsByLocationsReturnOneTown() {
List<Location> allLocations = ( locationRepo.getAllLocation());
List<Town> allTowns = townRepository.getAllTowns();
int allLocationNumber=allLocations.size();
int allLocationNumberAfterFilter=0;
for (Town town : allTowns){
allLocationNumberAfterFilter+=townController.filterByLocationForTrails(allLocations,
town.getTownName()).size();
// List<Town> allTowns = townRepository.getAllTowns();
// int allLocationNumber=allLocations.size();
// int allLocationNumberAfterFilter=0;
// for (Town town : allTowns){
// allLocationNumberAfterFilter+=townController.filterByLocationForTrails(allLocations, town.getTownName() ).size();
}
assertSame(allLocationNumber,allLocationNumberAfterFilter);
/// list of all locations,
// assertSame(allLocationNumber,allLocationNumberAfterFilter);
// /// list of all locations,
// filter by all three towns
// add together size should be same
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment