summaryrefslogtreecommitdiffstats
path: root/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java
blob: f81c4ba7a96891039f46467358b2940a757ca08b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.utils.util;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class CertainlyCloneableTest {

    private class Foo extends CertainlyCloneable<Foo> {
        protected Foo callParentClone() throws CloneNotSupportedException {
            throw new CloneNotSupportedException("Foo");
        }
    }

    @Test
    public void testSimple() {
        try{
            Foo f = new Foo();
            f.clone();
            fail("Control should not get here");
        } catch (Error e) {
            assertEquals("Foo", e.getCause().getMessage());
        }
    }

}