Skip to content

Commit

Permalink
fix tests #1098
Browse files Browse the repository at this point in the history
  • Loading branch information
OsorioSaul committed Oct 20, 2024
1 parent f5a056e commit 8b80a97
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public void seedDatabase() {
new GunEntity(4, new BigDecimal("599.99"), "Remington 870", "Remington", Arrays.asList(accesories[4], accesories[2]), compatibleAmmos[4]),
new GunEntity(5, new BigDecimal("849.99"), "Beretta 92FS", "Beretta", Arrays.asList(accesories[0], accesories[1]), compatibleAmmos[0]),
new GunEntity(6, new BigDecimal("699.99"), "Mossberg 500", "Mossberg", Arrays.asList(accesories[4], accesories[3]), compatibleAmmos[4]),
new GunEntity(7, new BigDecimal("2999.99"), "FN SCAR 17", "FN Herstal", Arrays.asList(accesories[2], accesories[0]), compatibleAmmos[3])
new GunEntity(7, new BigDecimal("2999.99"), "FN SCAR 17", "FN Herstal", Arrays.asList(accesories[2], accesories[0]), compatibleAmmos[3]),
new GunEntity(8, new BigDecimal("2999.99"), "FN SCAR 17 - 2", "FN Herstal", Arrays.asList(accesories[2], accesories[0]), compatibleAmmos[3]),
new GunEntity(9, new BigDecimal("2999.99"), "FN SCAR 17 - 3", "FN Herstal", Arrays.asList(accesories[2], accesories[0]), compatibleAmmos[3]),
};
this.gunRepository.saveAll(Arrays.asList(guns));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public void testReadByName() {

@Test
public void testUpdate() {
Integer idOfUpdated = 0;
Integer idOfUpdated = 9;
Gun newGun = GunStoreSeederService.getNewDummyGun(idOfUpdated);
assertEquals(idOfUpdated, this.gunPersistenceMongodb.readByName("Glock 17").getGunId());
assertNotEquals(newGun, this.gunPersistenceMongodb.readByName("Glock 17"));
assertEquals(idOfUpdated, this.gunPersistenceMongodb.readByName("FN SCAR 17 - 3").getGunId());
assertNotEquals(newGun, this.gunPersistenceMongodb.readByName("FN SCAR 17 - 3"));
gunPersistenceMongodb.update(idOfUpdated, newGun);
assertEquals(idOfUpdated, this.gunPersistenceMongodb.readByName(newGun.getName()).getGunId());
assertEquals(newGun, this.gunPersistenceMongodb.readByName(newGun.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class GunServiceIT {

public static final String AK_47 = "AK-47";
public static final int ID_OF_UPDATED_GUN = 2;
public static final int ID_OF_UPDATED_GUN = 8;
@Autowired
GunService gunService;

Expand All @@ -37,6 +37,7 @@ public void testRead() {
@Test
public void testPUT() {
Gun newGun = GunStoreSeederService.getNewDummyGun(ID_OF_UPDATED_GUN);
newGun.setName("TestGun1");
this.gunService.update(ID_OF_UPDATED_GUN, newGun);
assertEquals(newGun, this.gunPersistence.readByName(newGun.getName()));
}
Expand Down

0 comments on commit 8b80a97

Please sign in to comment.