Test-doubles: what is the name of a "fake" that can be controlled
===

I've been writing a lot of Java code that uses fakes, but those fakes have controllable behaviour. They tend to fake actual hardware, so an example might be a test where I tell the fake that it should behave as if it's lost comms, or reports a hardware failure. A trivial example:

    interface CommDevice {
        boolean isConnected();
    }

    class FakeCommDevice implements CommDevice {
        private boolean connected;
        public boolean isConnected() {return connected;}
        public void setConnected(boolean x) {connected=x;}
    }

Should I squirrel the controlling code away into a new interface? E.g.

    class FakeCommDevice implements CommDevice {
        private class Manager () {
            public void setConnected(boolean x) {connected=x;}
        }
        private boolean connected;
        public boolean isConnected() {return connected;}
        public Manager manager() {return new Manager();}
    }

