Skip to content
This repository was archived by the owner on Oct 28, 2020. It is now read-only.

Commit b68b46a

Browse files
author
Nicolai Parlog
committed
Improve graphics bounds code
1 parent 02f7a7d commit b68b46a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

graphics-bounds/src/main/java/wtf/java9/graphics_bounds/GraphicsBounds.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package wtf.java9.graphics_bounds;
22

3-
import java.awt.*;
4-
import java.awt.image.*;
5-
import java.lang.reflect.Constructor;
3+
import java.awt.Rectangle;
4+
import java.awt.image.BufferedImage;
65

76
public class GraphicsBounds {
87

@@ -15,6 +14,8 @@ public static void main(String[] args) {
1514
*/
1615
public static Rectangle createBounds() {
1716
return new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR)
18-
.createGraphics().getDeviceConfiguration().getBounds();
17+
.createGraphics()
18+
.getDeviceConfiguration()
19+
.getBounds();
1920
}
2021
}

graphics-bounds/src/test/java/wtf/java9/graphics_bounds/GraphicsBoundsTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.Test;
55

6-
import java.awt.*;
6+
import java.awt.Rectangle;
7+
8+
import static org.assertj.core.api.Assertions.assertThat;
79

810
class GraphicsBoundsTest {
911

1012
@Test
1113
void createBounds() throws Exception {
12-
Assertions.assertEquals(
13-
new Rectangle(0, 0, 800, 600),
14-
GraphicsBounds.createBounds());
14+
assertThat(GraphicsBounds.createBounds())
15+
.isEqualTo(new Rectangle(0, 0, 800, 600));
1516
}
1617
}

0 commit comments

Comments
 (0)