diff --git a/java/samples/DeprecatedMethod.java b/java/samples/DeprecatedMethod.java index 02ff159..3477320 100644 --- a/java/samples/DeprecatedMethod.java +++ b/java/samples/DeprecatedMethod.java @@ -55,8 +55,14 @@ public static void RunTest(ILog logger, TargetServer server) throws Exception first = entry; break; } - logln(first.getValue().toString()); - first.getKey().apply(connection); + + logln(first.getValue().toString()); + try { + first.getKey().apply(connection); + throw new Exception("Managed to use deprecated method HostPatch.apply()!"); + } catch (Types.MessageDeprecated e) { + logln("Caught expected MessageDeprecated exception. Do not fail."); + } } else { logln("There aren't any HostPatches to be applied...");