Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fc9c4d4

Browse files
committed
Fix BoundingBox.width return value.
We now return the correct value. Closes #2526
1 parent f6303b0 commit fc9c4d4

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

‎src/main/java/org/springframework/data/redis/domain/geo/BoundingBox.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public BoundingBox(double width, double height, Metric metric) {
7070
* @return will never be {@literal null}.
7171
*/
7272
public Distance getWidth() {
73-
return height;
73+
return width;
7474
}
7575

7676
/**
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2023 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.redis.domain.geo;
17+
18+
import static org.assertj.core.api.Assertions.*;
19+
20+
import org.junit.jupiter.api.Test;
21+
import org.springframework.data.geo.Distance;
22+
23+
/**
24+
* Unit tests for {@link BoundingBox}.
25+
*
26+
* @author Mark Paluch
27+
*/
28+
class BoundingBoxUnitTests {
29+
30+
@Test // GH-2526
31+
void shouldReturnCorrectValues() {
32+
33+
Distance w = new Distance(1);
34+
Distance h = new Distance(2);
35+
BoundingBox box = new BoundingBox(w, h);
36+
37+
assertThat(box.getWidth()).isEqualTo(w);
38+
assertThat(box.getHeight()).isEqualTo(h);
39+
}
40+
41+
@Test // GH-2526
42+
void shouldEqual() {
43+
44+
Distance w = new Distance(1);
45+
Distance h = new Distance(2);
46+
BoundingBox box1 = new BoundingBox(w, h);
47+
BoundingBox box2 = new BoundingBox(w, h);
48+
49+
assertThat(box1).isEqualTo(box2).hasSameHashCodeAs(box2);
50+
}
51+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /