@Test
@Transactional
public void basicCopyTest() {

    final String originalViewName = "My Original View";
    final String partitions = "1,2,4";
    final String topic = "MyTopic";
    final String expectedCopyName = "My Copied View";
    final Cluster cluster = clusterTestTools.createCluster("Test Cluster");
    final MessageFormat keyMessageFormat = messageFormatTestTools.createMessageFormat("Key Message Format");
    final MessageFormat valueMessageFormat = messageFormatTestTools.createMessageFormat("Value Message Format");
    // Create source view
    final View sourceView = viewTestTools.createView(originalViewName, cluster, keyMessageFormat);
    sourceView.setKeyMessageFormat(keyMessageFormat);
    sourceView.setValueMessageFormat(valueMessageFormat);
    sourceView.setTopic(topic);
    sourceView.setPartitions(partitions);
    viewRepository.save(sourceView);
    // Attempt to copy
    final ViewCopyManager copyManager = new ViewCopyManager(viewRepository);
    final View copiedView = copyManager.copy(sourceView.getId(),expectedCopyName);
    // Validate properties
    assertNotNull("Should be non-null", copiedView);
    assertNotNull("Should have an id", copiedView.getId());
    assertNotEquals("Should have a new id", copiedView.getId(), sourceView.getId());
    assertEquals("Has new name", expectedCopyName, copiedView.getName());
    assertEquals("Has topic", topic, copiedView.getTopic());
    assertEquals("Has partitions", partitions, copiedView.getPartitions());
    assertEquals("Has cluster", cluster.getId(), copiedView.getCluster().getId());
    assertEquals("Has key format", keyMessageFormat.getId(), copiedView.getKeyMessageFormat().getId());
    assertEquals("Has value format", valueMessageFormat.getId(), copiedView.getValueMessageFormat().getId());
}