Skip to content

Commit

Permalink
Added missing unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Nov 29, 2011
1 parent 4525cbe commit 9119aa2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Expand Up @@ -91,6 +91,7 @@ public class AWTDrawVisitor extends AbstractAWTDrawVisitor {
*
* @return the current model
*/
@TestMethod("testGetRendererModel")
public RendererModel getRendererModel() {
return rendererModel;
}
Expand All @@ -100,6 +101,7 @@ public RendererModel getRendererModel() {
*
* @return a {@link Map} with Integer as keys and {@link BasicStroke}s.
*/
@TestMethod("testGetStrokeMap")
public Map<Integer, BasicStroke> getStrokeMap() {
return strokeMap;
}
Expand All @@ -114,6 +116,7 @@ public Map<Integer, BasicStroke> getStrokeMap() {
*
* @return the {@link Graphics2D} object
*/
@TestMethod("testGetGraphics")
public Graphics2D getGraphics() {
return graphics;
}
Expand Down
Expand Up @@ -72,7 +72,29 @@ public void testSetRendererModel() {
Assert.assertNotNull(visitor);
}

@Test
@Test
public void testGetRendererModel() {
Image image = new BufferedImage(
100, 100, BufferedImage.TYPE_INT_RGB
);
Graphics2D g2d = (Graphics2D)image.getGraphics();
AWTDrawVisitor visitor = new AWTDrawVisitor(g2d);
RendererModel model = new RendererModel();
visitor.setRendererModel(model);
Assert.assertEquals(model, visitor.getRendererModel());
}

@Test
public void testGetStrokeMap() {
Image image = new BufferedImage(
100, 100, BufferedImage.TYPE_INT_RGB
);
Graphics2D g2d = (Graphics2D)image.getGraphics();
AWTDrawVisitor visitor = new AWTDrawVisitor(g2d);
Assert.assertNotNull(visitor.getStrokeMap());
}

@Test
public void testVisit() {
Image image = new BufferedImage(
100, 100, BufferedImage.TYPE_INT_RGB
Expand All @@ -85,4 +107,14 @@ public void testVisit() {
// at least we now know it did not crash...
Assert.assertNotNull(visitor);
}

@Test
public void testGetGraphics() {
Image image = new BufferedImage(
100, 100, BufferedImage.TYPE_INT_RGB
);
Graphics2D g2d = (Graphics2D)image.getGraphics();
AWTDrawVisitor visitor = new AWTDrawVisitor(g2d);
Assert.assertEquals(g2d, visitor.getGraphics());
}
}

0 comments on commit 9119aa2

Please sign in to comment.