/* * printerStateReasonSet(Severity severity) method testing. */ public final void testPrinterStateReasonSet() { reasons = new PrinterStateReasons(); reasons.put(PrinterStateReason.MEDIA_LOW, Severity.ERROR); HashSet set = new HashSet(); set.add(PrinterStateReason.MEDIA_LOW); assertEquals(set, reasons.printerStateReasonSet(Severity.ERROR)); set = new HashSet(); assertEquals(set, reasons.printerStateReasonSet(Severity.REPORT)); }
/* * printerStateReasonSet(Severity severity) method testing. */ public final void testPrinterStateReasonSet1() { reasons = new PrinterStateReasons(); reasons.put(PrinterStateReason.COVER_OPEN, Severity.ERROR); reasons.put(PrinterStateReason.MEDIA_LOW, Severity.WARNING); reasons.put(PrinterStateReason.DOOR_OPEN, Severity.ERROR); reasons.put(PrinterStateReason.INPUT_TRAY_MISSING, Severity.ERROR); Set set = reasons.printerStateReasonSet(Severity.ERROR); try { set.iterator().remove(); fail("Unmodifiable set was changed"); } catch (UnsupportedOperationException e) { } try { set.add(PrinterStateReason.COVER_OPEN); fail("Unmodifiable set was changed"); } catch (UnsupportedOperationException e) { } }