blob: 5d3813f44da927cb1d45ad037c8e17ab6f84a1a4 (
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
|
// Copyright 2016 Yahoo Inc. 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 com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException;
import junit.framework.TestCase;
public class RequestTest extends TestCase {
public void testGetResultBeforeCompletion() {
Request<String> r = new Request<String>(Request.MasterState.MUST_BE_MASTER) {
@Override
public String calculateResult(Context context) throws StateRestApiException {
return "foo";
}
};
try{
r.getResult();
assertTrue(false);
} catch (InternalFailure e) {
} catch (Exception e) {
assertTrue(false);
}
r.notifyCompleted();
try{
r.getResult();
assertTrue(false);
} catch (InternalFailure e) {
} catch (Exception e) {
assertTrue(false);
}
}
}
|