/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
protected abstract AutoCloseable prepareMockedInstance() throws Exception;
- public AbstractMockedModule(DynamicMBeanWithInstance old, ModuleIdentifier id) {
- if(old!=null)
+ @SuppressWarnings("IllegalCatch")
+ public AbstractMockedModule(final DynamicMBeanWithInstance old, final ModuleIdentifier id) {
+ if (old != null) {
instance = old.getInstance();
- else
+ } else {
try {
instance = prepareMockedInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
}
+ }
- this.id = id==null ? new ModuleIdentifier(getClass().getCanonicalName(), "mock") : id;
+ this.id = id == null ? new ModuleIdentifier(getClass().getCanonicalName(), "mock") : id;
}
-
@Override
- public boolean canReuse(Module oldModule) {
- return instance!=null;
+ public boolean canReuse(final Module oldModule) {
+ return instance != null;
}
@Override
public ModuleIdentifier getIdentifier() {
return id;
}
-
}