MLink extends MAccountableEntity implements MClonable { @Override public MLink clone(boolean cloneWithValue) { if(cloneWithValue) { return new MLink(this); } else { return new MLink(connectorId, connectorLinkConfig.clone(false)); } } MLink(long connectorId, MLinkConfig linkConfig);  MLink(MLink other);  MLink(MLink other, MLinkConfig linkConfig); @Override String toString(); long getConnectorId(); MLinkConfig getConnectorLinkConfig(); MConfig getConnectorLinkConfig(String configName); @Override MLink clone(boolean cloneWithValue); @Override boolean equals(Object object);  }
@Test public void testClone() { MLink link = link(); MLink withoutLinkValue = link.clone(false); assertEquals(link, withoutLinkValue); assertEquals(MPersistableEntity.PERSISTANCE_ID_DEFAULT, withoutLinkValue.getPersistenceId()); assertNull(withoutLinkValue.getName()); assertNull(withoutLinkValue.getCreationUser()); assertEquals(linkConfig(), withoutLinkValue.getConnectorLinkConfig()); assertNull(withoutLinkValue.getConnectorLinkConfig().getConfig("CONFIGNAME").getInput("INTEGER-INPUT").getValue()); assertNull(withoutLinkValue.getConnectorLinkConfig().getConfig("CONFIGNAME").getInput("STRING-INPUT").getValue()); MLink withLinkValue = link.clone(true); assertEquals(link, withLinkValue); assertEquals(link.getPersistenceId(), withLinkValue.getPersistenceId()); assertEquals(link.getName(), withLinkValue.getName()); assertEquals(link.getCreationUser(), withLinkValue.getCreationUser()); assertEquals(linkConfig(), withLinkValue.getConnectorLinkConfig()); assertEquals(100, withLinkValue.getConnectorLinkConfig().getConfig("CONFIGNAME").getInput("INTEGER-INPUT").getValue()); assertEquals("TEST-VALUE", withLinkValue.getConnectorLinkConfig().getConfig("CONFIGNAME").getInput("STRING-INPUT").getValue()); }