< prev index next >

test/sun/security/smartcardio/TestDirect.java

Print this page
rev 13550 : imported patch 8059212-Modify-smartcardio-manual-regression-tests-so-that-they-do-not-just-fail-if-no-cardreader-found

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -38,14 +38,16 @@
 
 public class TestDirect {
     public static void main(String[] args) throws Exception {
         TerminalFactory terminalFactory = TerminalFactory.getDefault();
         List<CardTerminal> cardTerminals = terminalFactory.terminals().list();
-        System.out.println("Terminals: " + cardTerminals);
         if (cardTerminals.isEmpty()) {
-            throw new Exception("No card terminals available");
+            System.out.println("Skipping the test: " +
+                    "no card terminals available");
+            return;
         }
+        System.out.println("Terminals: " + cardTerminals);
         CardTerminal cardTerminal = cardTerminals.get(0);
         Card card = cardTerminal.connect("DIRECT");
         card.disconnect(true);
 
         System.out.println("OK.");
< prev index next >