46 |
46 |
47 to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage" }); |
47 to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage" }); |
48 assertNotNull(to_module, "Module should not be null"); |
48 assertNotNull(to_module, "Module should not be null"); |
49 ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage" }); |
49 ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage" }); |
50 |
50 |
51 // Null from_module argument, expect an NPE |
51 // Null from_module argument, expect NPE |
52 try { |
52 try { |
53 ModuleHelper.AddReadsModule(null, to_module); |
53 ModuleHelper.AddReadsModule(null, to_module); |
54 throw new RuntimeException("Failed to get the expected NPE"); |
54 throw new RuntimeException("Failed to get the expected NPE"); |
55 } catch(NullPointerException e) { |
55 } catch (NullPointerException e) { |
56 // Expected |
56 // Expected |
57 } |
57 } |
58 |
58 |
59 // Null to_module argument, do not expect an NPE |
59 // Null to_module argument, expect NPE |
60 try { |
60 try { |
61 ModuleHelper.AddReadsModule(from_module, null); |
61 ModuleHelper.AddReadsModule(from_module, null); |
62 } catch(NullPointerException e) { |
|
63 throw new RuntimeException("Unexpected NPE was thrown"); |
62 throw new RuntimeException("Unexpected NPE was thrown"); |
|
63 } catch (NullPointerException e) { |
|
64 // Expected |
64 } |
65 } |
65 |
66 |
66 // Null from_module and to_module arguments, expect an NPE |
67 // Null from_module and to_module arguments, expect NPE |
67 try { |
68 try { |
68 ModuleHelper.AddReadsModule(null, null); |
69 ModuleHelper.AddReadsModule(null, null); |
69 throw new RuntimeException("Failed to get the expected NPE"); |
70 throw new RuntimeException("Failed to get the expected NPE"); |
70 } catch(NullPointerException e) { |
71 } catch (NullPointerException e) { |
71 // Expected |
72 // Expected |
72 } |
73 } |
73 |
74 |
74 // Both modules are the same, should not throw an exception |
75 // Both modules are the same, should not throw an exception |
75 ModuleHelper.AddReadsModule(from_module, from_module); |
76 ModuleHelper.AddReadsModule(from_module, from_module); |