#566 - Fix broken test by searching for the correct name.

Also polishing.
This commit is contained in:
Jens Schauder
2020-11-09 11:49:21 +01:00
parent 9f6b6f3cbd
commit 01b0a5674a
2 changed files with 4 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ interface LegoSetRepository extends CrudRepository<LegoSet, Integer> {
*/
@Query("select a.*, b.handbuch_id as manual_handbuch_id, b.author as manual_author, b.text as manual_text from lego_set a " +
"join handbuch b on a.id = b.handbuch_id " +
"where name = :name")
"where a.name = :name")
List<LegoSet> findByName(@Param("name") String name);
@Modifying

View File

@@ -23,7 +23,6 @@ import java.time.Period;
import java.util.Arrays;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.assertj.core.groups.Tuple;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -78,7 +77,8 @@ public class AggregateTests {
@Test
public void customQueries() {
LegoSet smallCars = createLegoSet("Small Car - 01", 5, 10);
String smallCarsSetName = "Small Car - 01";
LegoSet smallCars = createLegoSet(smallCarsSetName, 5, 10);
smallCars.setManual(new Manual("Just put all the pieces together in the right order", "Jens Schauder"));
smallCars.addModel("SUV", "SUV with sliding doors.");
@@ -86,7 +86,6 @@ public class AggregateTests {
LegoSet f1Racer = createLegoSet("F1 Racer", 6, 15);
f1Racer.setManual(new Manual("Build a helicopter or a plane", "M. Shoemaker"));
f1Racer.addModel("F1 Ferrari 2018", "A very fast red car.");
LegoSet constructionVehicles = createLegoSet("Construction Vehicles", 3, 6);
@@ -111,8 +110,7 @@ public class AggregateTests {
// SUV, F1 Ferrari 2018 and Muck get updated
assertThat(updated).isEqualTo(3);
final List<LegoSet> legoSetsByName = repository.findByName("Small Car 01");
final List<LegoSet> legoSetsByName = repository.findByName(smallCarsSetName);
assertThat(legoSetsByName).hasSize(1);
}