Skip to content

Commit 048f7f2

Browse files
author
Xiang Zhong
committed
Change exception handling
1 parent b63abe3 commit 048f7f2

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

ipp-v3-java-devkit/src/main/java/com/intuit/ipp/query/GenerateQuery.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private GenerateQuery() {
7474
* @return the proxified object
7575
*/
7676
@SuppressWarnings("unchecked")
77-
public static <T> T createQueryEntity(Class<T> cl) throws InstantiationException, IllegalAccessException {
77+
public static <T> T createQueryEntity(Class<T> cl) {
7878
Class<?> proxied = null;
7979
if (cl.isInterface()) {
8080
LOG.debug("The given class is interface");
@@ -87,7 +87,12 @@ public static <T> T createQueryEntity(Class<T> cl) throws InstantiationException
8787
.load(GenerateQuery.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER)
8888
.getLoaded();
8989
}
90-
return (T) proxied.newInstance();
90+
try {
91+
return (T) proxied.newInstance();
92+
} catch (InstantiationException | IllegalAccessException e) {
93+
LOG.error(e.getMessage());
94+
throw new RuntimeException(e);
95+
}
9196
}
9297

9398
/**
@@ -96,7 +101,7 @@ public static <T> T createQueryEntity(Class<T> cl) throws InstantiationException
96101
* @return the proxified object
97102
*/
98103
@SuppressWarnings("unchecked")
99-
public static <T> T createQueryEntity(T entity) throws InstantiationException, IllegalAccessException {
104+
public static <T> T createQueryEntity(T entity) {
100105
Class<?> cl = entity.getClass();
101106
return (T) createQueryEntity(cl);
102107
}

ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/DataServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void testFindAll() throws FMSException {
183183
}
184184

185185
@Test (enabled = false)
186-
public void testExecuteQuery_get() throws FMSException, InstantiationException, IllegalAccessException {
186+
public void testExecuteQuery_get() throws FMSException {
187187
Customer customer = GenerateQuery.createQueryEntity(Customer.class);
188188
String query = select($(customer.getId()), $(customer.getDisplayName())).where($(customer.getId()).eq(EntityCreator.customer.getId())).generate();
189189

@@ -197,7 +197,7 @@ public void testExecuteQuery_get() throws FMSException, InstantiationException,
197197
}
198198

199199
@Test(enabled = false)
200-
public void testExecuteQuery_post() throws FMSException, InstantiationException, IllegalAccessException {
200+
public void testExecuteQuery_post() throws FMSException {
201201
Customer customer = GenerateQuery.createQueryEntity(Customer.class);
202202
String query = select($(customer.getId()), $(customer.getDisplayName())).where($(customer.getId()).eq(EntityCreator.customer.getId())).generate();
203203
String newQuery = " ";
@@ -214,7 +214,7 @@ public void testExecuteQuery_post() throws FMSException, InstantiationException,
214214
}
215215

216216
@Test(enabled = false)
217-
public void testExecuteQuery_postCompression() throws FMSException, InstantiationException, IllegalAccessException {
217+
public void testExecuteQuery_postCompression() throws FMSException {
218218
Customer customer = GenerateQuery.createQueryEntity(Customer.class);
219219
String query = select($(customer.getId()), $(customer.getDisplayName())).where($(customer.getId()).eq(EntityCreator.customer.getId())).generate();
220220
String newQuery = " ";
@@ -249,7 +249,7 @@ public void testExecuteQuery_invalidQuery() {
249249
}
250250

251251
@Test(enabled = false)
252-
public void testExecuteBatch() throws FMSException, InstantiationException, IllegalAccessException {
252+
public void testExecuteBatch() throws FMSException {
253253
BatchOperation batchOperation = new BatchOperation();
254254

255255
Customer customer = new Customer();
@@ -296,7 +296,7 @@ public void testExecuteBatch_Entity() throws FMSException {
296296
}
297297

298298
@Test (enabled = false)
299-
public void testExecuteBatch_Query() throws FMSException, InstantiationException, IllegalAccessException {
299+
public void testExecuteBatch_Query() throws FMSException {
300300
BatchOperation batchOperation = new BatchOperation();
301301

302302
Customer c = GenerateQuery.createQueryEntity(Customer.class);

ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/QBODataServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public void testPurchaseQuery_JsonResponse() throws FMSException {
498498
}
499499

500500
@Test (enabled = false)
501-
public void testExecuteQuery_get() throws FMSException, InstantiationException, IllegalAccessException {
501+
public void testExecuteQuery_get() throws FMSException {
502502
Customer customerIn = getCustomer();
503503
Customer customer = GenerateQuery.createQueryEntity(Customer.class);
504504
String query = select($(customer.getId()), $(customer.getDisplayName())).where($(customer.getId()).eq(customerIn.getId())).generate();
@@ -513,7 +513,7 @@ public void testExecuteQuery_get() throws FMSException, InstantiationException,
513513
}
514514

515515
@Test(enabled=false)
516-
public void testExecuteQuery_post() throws FMSException, InstantiationException, IllegalAccessException {
516+
public void testExecuteQuery_post() throws FMSException {
517517
Customer customerIn = getCustomer();
518518
Customer customer = GenerateQuery.createQueryEntity(Customer.class);
519519
String query = select($(customer.getId()), $(customer.getDisplayName())).where($(customer.getId()).eq(customerIn.getId())).generate();

0 commit comments

Comments
 (0)