code: public <T> T mock(Class<T> typeToMock, String name) {
          if (mockNames.contains(name)) {
              throw new IllegalArgumentException("a mock with name " + name + " already exists");
          }
          
          final MockObject mock = new MockObject(typeToMock, name);
          mockNames.add(name);
          
          Invokable invokable =
              threadingPolicy.synchroniseAccessTo(
                  new ProxiedObjectIdentity(
                      new InvocationDiverter<CaptureControl>(
                          CaptureControl.class, mock, mock)));
          
          return imposteriser.imposterise(invokable, typeToMock, CaptureControl.class);
      }
docs: Creates a mock object of type <var>typeToMock</var> with the given name.
  @param <T> is the class of the mock
  @param typeToMock is the class of the mock
  @param name is the name of the mock object that will appear in failures
  @return the mock of typeToMock