DATAGRAPH-783 - Argument type mismatch (int to Float) with derived finders.
This commit is contained in:
@@ -289,6 +289,21 @@ public class GalaxyServiceTest {
|
||||
assertEquals(0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAGRAPH-783
|
||||
*/
|
||||
@Test
|
||||
public void shouldFindWorldWithRadius() {
|
||||
galaxyService.deleteAll();
|
||||
World earth = new World("Earth",1);
|
||||
earth.setRadius(6371.0f);
|
||||
galaxyService.create(earth);
|
||||
|
||||
earth = galaxyService.findByName("Earth");
|
||||
assertEquals(Float.valueOf(6371.0f),earth.getRadius());
|
||||
|
||||
}
|
||||
|
||||
private String[] getNamesSorted(List<World> worlds) {
|
||||
List<String> names = new ArrayList();
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ public class World {
|
||||
|
||||
private int moons;
|
||||
|
||||
private Float radius;
|
||||
|
||||
private Long updated;
|
||||
|
||||
public Long getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
@@ -39,7 +43,6 @@ public class World {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
private Long updated;
|
||||
|
||||
private Set<World> reachableByRocket = new HashSet<>();
|
||||
|
||||
@@ -89,6 +92,14 @@ public class World {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(Float radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -31,4 +31,6 @@ public interface WorldRepository extends GraphRepository<World> {
|
||||
@Query("MATCH (n:World) SET n.updated=timestamp()")
|
||||
Result touchAllWorldsWithStatistics();
|
||||
|
||||
World findByName(String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ public class GalaxyService {
|
||||
return worldRepository.save(new World(name, moons));
|
||||
}
|
||||
|
||||
public World create(World world) {
|
||||
return worldRepository.save(world);
|
||||
}
|
||||
|
||||
public Iterable<World> getAllWorlds() {
|
||||
return worldRepository.findAll();
|
||||
}
|
||||
@@ -176,4 +180,8 @@ public class GalaxyService {
|
||||
public Iterable<World> findAllWorlds(Sort sort, int depth) {
|
||||
return worldRepository.findAll(sort, depth);
|
||||
}
|
||||
|
||||
public World findByName(String name) {
|
||||
return worldRepository.findByName(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user