aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/util/CertainlyCloneableTest.java
blob: e14562d42c0772487b77631b1c0bcbc5897ac283 (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.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

public class CertainlyCloneableTest {

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

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

}