77import java .io .FileWriter ;
88import java .io .IOException ;
99import java .util .HashMap ;
10- import java .util .HashSet ;
1110import java .util .List ;
12- import java .util .Map ;
1311import java .util .Set ;
1412
1513import org .json .simple .JSONObject ;
1614import org .json .simple .parser .JSONParser ;
1715
1816import edu .uniandes .tsdl .mutapk .detectors .MutationLocationDetector ;
1917import edu .uniandes .tsdl .mutapk .detectors .MutationLocationListBuilder ;
20- import edu .uniandes .tsdl .mutapk .hashfunction . sha3 . ApkHash ;
18+ import edu .uniandes .tsdl .mutapk .exception . MutAPKException ;
2119import edu .uniandes .tsdl .mutapk .hashfunction .sha3 .ApkHashOrder ;
2220import edu .uniandes .tsdl .mutapk .hashfunction .sha3 .ApkHashSeparator ;
23- import edu .uniandes .tsdl .mutapk .hashfunction .sha3 .Sha3 ;
2421import edu .uniandes .tsdl .mutapk .helper .APKToolWrapper ;
2522import edu .uniandes .tsdl .mutapk .helper .Helper ;
2623import edu .uniandes .tsdl .mutapk .model .MutationType ;
@@ -45,10 +42,11 @@ public static void main(String[] args) {
4542 // System.out.println(finalTime);
4643 // System.out.println(finalTime-initialTime);
4744
48- } catch (Exception e ) {
45+ }catch (MutAPKException e ) {
4946 System .out .println (e .getMessage ());
47+ } catch (Exception e ) {
5048 e .printStackTrace ();
51- }
49+ }
5250 }
5351
5452 public static void runMutAPK (String [] args ) throws NumberFormatException , Exception {
@@ -162,9 +160,10 @@ public static void runMutAPK(String[] args) throws NumberFormatException, Except
162160 // Read selected operators
163161 OperatorBundle operatorBundle = new OperatorBundle (operatorsDir );
164162 System .out .println (operatorBundle .printSelectedOperators ());
165-
163+
164+
166165 if (amountMutants > 0 && operatorBundle .getAmountOfSelectedOperators () > amountMutants ) {
167- throw new Exception ("you must select as many mutants as selected operators, right now you select "
166+ throw new MutAPKException ("you must select as many mutants as selected operators, right now you select "
168167 + operatorBundle .getAmountOfSelectedOperators () + " operators but only ask for " + amountMutants
169168 + " mutants" );
170169 }
@@ -210,6 +209,10 @@ public static void runMutAPK(String[] args) throws NumberFormatException, Except
210209 // }
211210 }
212211
212+ if (totalMutants < amountMutants ) {
213+ throw new MutAPKException ("The total of mutants need to be greater than the amount of mutants asked" );
214+ }
215+
213216 // 3. Build MutationLocation List
214217 List <MutationLocation > mutationLocationList = MutationLocationListBuilder .buildList (locations );
215218 printLocationList (mutationLocationList , mutantsFolder , appName );
0 commit comments