1 package com.atlassian.selenium.junit4;
2
3 import org.junit.Before;
4 import org.junit.Test;
5 import org.junit.runner.Description;
6
7 import static org.junit.Assert.assertEquals;
8
9 public class TestCaptureScreenshotListener
10 {
11 private CaptureScreenshotListener captureScreenshotListener;
12
13 @Before
14 public void setUp() throws Exception
15 {
16 captureScreenshotListener = new CaptureScreenshotListener();
17 }
18
19 @Test
20 public void testCreateFileName() throws Exception
21 {
22 final Description desc = Description.createTestDescription(TestCaptureScreenshotListener.class, "testAnotherTest");
23 final String screenshotFileName = captureScreenshotListener.createSreenshotFileName(desc);
24 assertEquals("com.atlassian.selenium.junit4.TestCaptureScreenshotListener_testAnotherTest.png", screenshotFileName);
25 }
26
27
28 @Test
29 public void testCreateFileNameTestNameMissing() throws Exception
30 {
31 final Description desc = Description.createTestDescription(TestCaptureScreenshotListener.class, "");
32 final String screenshotFileName = captureScreenshotListener.createSreenshotFileName(desc);
33 assertEquals("com.atlassian.selenium.junit4.TestCaptureScreenshotListener.png", screenshotFileName);
34 }
35
36
37 }