public PrintServiceAttributeSet getAttributes() { PrintServiceAttributeSet attributes = new HashPrintServiceAttributeSet(); attributes.add(new PrinterName(serviceName, Locale.getDefault())); if (getColorSupported(serviceName)) { attributes.add(ColorSupported.SUPPORTED); int colorPPM = getPagesPerMinuteColor(serviceName); if (colorPPM > 0) { attributes.add(new PagesPerMinuteColor(colorPPM)); } } else { attributes.add(ColorSupported.NOT_SUPPORTED); } int pagesPerMinute = getPagesPerMinute(serviceName); if (pagesPerMinute > 0) { attributes.add(new PagesPerMinute(pagesPerMinute)); } String printerLocation = getPrinterLocation(serviceName); if (printerLocation != null) { attributes.add(new PrinterLocation(printerLocation, Locale.getDefault())); } int acceptingJobs = getPrinterIsAcceptingJobs(serviceName); if (acceptingJobs == 0) { attributes.add(PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS); } else if (acceptingJobs == 1) { attributes.add(PrinterIsAcceptingJobs.ACCEPTING_JOBS); } int jobCount = getQueuedJobCount(serviceName); if (jobCount >= 0) { attributes.add(new QueuedJobCount(jobCount)); } return attributes; }
public final void testGetValue() { is1 = new PagesPerMinute(30); assertTrue(is1.getValue() == 30); }