blob: ec8e7855db6c14702d33252e59ef51a04401a5db (
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
29
30
31
32
33
34
35
36
37
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.restapiv2;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class RequestTest {
@Test
public void testGetResultBeforeCompletion() {
Request<String> r = new Request<>(Request.MasterState.MUST_BE_MASTER) {
@Override
public String calculateResult(Context context) {
return "foo";
}
};
try{
r.getResult();
fail();
} catch (InternalFailure e) {
} catch (Exception e) {
fail();
}
r.notifyCompleted();
try{
r.getResult();
fail();
} catch (InternalFailure e) {
} catch (Exception e) {
fail();
}
}
}
|