unit testing - Best way to return "expected" Oracle exceptions to Java Groovy/Grails -
Background:
In my Oracle database, I have enough database Calls that can cause exceptions. I currently have exception handlers for all these, which are called an error package, to reduce a long story, raise_application_error for unexpected errors, eventually for errors expected, or increase < / Code> is picked up, and it is sent back to Java Groovy / Grails calling the application layer.
So, for example, if a user enters and clicks the ID, then I run a selected query from the database. If the ID is not present, then I have an NO_DATA_FOUND exception that performs a raise_application_error with a custom error message (i.e. "The ID can not be entered. ")
However, the application development team says that they are struggling with that they are trying to do unit tests in Groove and ideally want to return a variable. SQL exceptions I have failed because of the failure of all tests at present because this is an exception, their code looks like this:
zero nameoffprocessor () {string result = stored processing.culibprocor ( Connection type. MSCX, Val 1, Val2) log.info "SQL Process Query Result Value:" + Assessing Results ("1", result)} You can add:
@Test (expected I = SQLException.class) Question: P> What is the best solution to this issue? I am being pressed to return the variable from the exception block instead of the raise_application_errors - but I am very reluctant to do this because I have always been told that this is only a terrible practice. Alternatively, they can make changes at their end. But obviously they are reluctant.
What's the next step? Should I coding to change the "expected" errors in the form of variables against the exceptions? For example, if someone enters an ID that does not find the ID:
select the table ID from the id = Enter the episode when no data is received 'return ID 'can not be found; END
Or alternatively, are they following a guide that recommends using Hamsters' Matters to create their own Custom Exception Property, which they would like to test their JUNET Can check in. What is the best practice here?
You are right, this is a terrible practice, absolutely ''; They are getting lazy to do good work and you wish to spoil the design of the design to please them.
Generally, there should be something similar in the unit exam with the exception:
try {string result = call db processor (); Unsuccessful ("result instead of exception");} hold (OracleScluxation E) {estrequel (E.Terror CODE, RAISE_APPLICATION_ERROR_CODE);} Catch (throbable T) {failed ("unexpected error"); } They can upgrade it as they want. For example, they can develop the process 'Call the SP and change the exception to whatever you want' and use it in their tests. But they should not affect the application design outside of the test. never.
Comments
Post a Comment