public void testHashPrintRequestAttributeSet() { startTest("HashPrintRequestAttributeSet class testing..."); Copies copies = new Copies(2); PrintRequestAttributeSet set1 = new HashPrintRequestAttributeSet(); PrintRequestAttributeSet set2 = new HashPrintRequestAttributeSet(copies); PrintRequestAttributeSet set3 = new HashPrintRequestAttributeSet(set2); PrintRequestAttribute [] arr = {copies, MediaName.NA_LETTER_WHITE}; PrintRequestAttributeSet set4 = new HashPrintRequestAttributeSet(arr); Attribute [] attrArr = set1.toArray(); assertTrue(set1.isEmpty()); assertFalse(set2.isEmpty()); assertTrue(set3.equals(set2)); assertFalse(set3.equals(set1)); set3.clear(); assertEquals(set3, set1); set3.add(copies); set3.add(MediaName.NA_LETTER_WHITE); assertTrue(set3.containsKey(copies.getClass())); assertFalse(set2.containsKey(MediaName.NA_LETTER_WHITE.getClass())); assertTrue(set3.containsValue(copies)); assertFalse(set3.containsValue(OrientationRequested.PORTRAIT)); assertFalse(set3.containsValue(PrintQuality.DRAFT)); assertEquals(set1.size(), 0); assertEquals(set2.size(), 1); assertEquals(set3.size(), 2); assertTrue(set4.equals(set3)); assertEquals(set3.get(copies.getClass()), copies); set1.addAll(set3); assertEquals(set3, set1); set1.remove(copies.getClass()); assertEquals(set1.size(), 1); attrArr = set1.toArray(); assertEquals(attrArr.length, 1); assertEquals(attrArr[0], MediaName.NA_LETTER_WHITE); }
public Class<? extends PrintRequestAttribute> getCategory() { return SunMinMaxPage.class; }