1
+ /**
2
+ * Copyright 2016 Yurii Rashkovskii
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ */
15
+ package graphql .annotations ;
16
+
17
+ import graphql .schema .DataFetchingEnvironment ;
18
+ import org .testng .annotations .Test ;
19
+
20
+ import java .util .ArrayList ;
21
+ import java .util .HashMap ;
22
+
23
+ import static org .testng .Assert .*;
24
+
25
+ public class MethodDataFetcherTest {
26
+
27
+ public class TestException extends Exception {};
28
+
29
+ public String method () throws TestException {
30
+ throw new TestException ();
31
+ }
32
+ @ Test (expectedExceptions = RuntimeException .class )
33
+ public void exceptionRethrowing () {
34
+ try {
35
+ MethodDataFetcher methodDataFetcher = new MethodDataFetcher (getClass ().getMethod ("method" ));
36
+ methodDataFetcher .get (new DataFetchingEnvironment (this , new HashMap <>(), null , new ArrayList <>(), null , null , null ));
37
+ } catch (NoSuchMethodException e ) {
38
+ e .printStackTrace ();
39
+ }
40
+ }
41
+ }
0 commit comments