Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.testutils.mockers;
|
---|
3 |
|
---|
4 | import java.awt.Frame;
|
---|
5 | import java.awt.GraphicsConfiguration;
|
---|
6 | import java.awt.Window;
|
---|
7 |
|
---|
8 | import mockit.Invocation;
|
---|
9 | import mockit.Mock;
|
---|
10 | import mockit.MockUp;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * MockUp for a {@link Window} which simply (and naively) makes its constructor(s) a no-op. This has
|
---|
14 | * the advantage of removing the isHeadless check. Though if course it also leaves you with
|
---|
15 | * uninitialized objects, and so of course they don't *necessarily* work properly. But often they
|
---|
16 | * work *just enough* to behave how a test needs them to. Exercise left to the reader to discover
|
---|
17 | * the limits here.
|
---|
18 | */
|
---|
19 | public class WindowMocker extends MockUp<Window> {
|
---|
20 | @Mock
|
---|
21 | private void $init(final Invocation invocation) {
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Mock
|
---|
25 | private void $init(final Invocation invocation, final Window window) {
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Mock
|
---|
29 | private void $init(final Invocation invocation, final Frame frame) {
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Mock
|
---|
33 | private void $init(final Invocation invocation, final GraphicsConfiguration gc) {
|
---|
34 | }
|
---|
35 |
|
---|
36 | @Mock
|
---|
37 | private void $init(final Invocation invocation, final Window window, final GraphicsConfiguration gc) {
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.