Sonar fixes

add asserts to tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885321 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-01-09 23:20:13 +00:00
parent 2457ece51e
commit d6477fc14c
11 changed files with 175 additions and 176 deletions

View File

@ -80,15 +80,10 @@ import org.junit.jupiter.api.Test;
public final class TestOPCComplianceCoreProperties {
@Test
void testCorePropertiesPart() {
OPCPackage pkg;
try {
InputStream is = openComplianceSampleStream("OPCCompliance_CoreProperties_OnlyOneCorePropertiesPart.docx");
pkg = OPCPackage.open(is);
} catch (InvalidFormatException | IOException e) {
throw new RuntimeException(e);
void testCorePropertiesPart() throws IOException {
try (InputStream is = openComplianceSampleStream("OPCCompliance_CoreProperties_OnlyOneCorePropertiesPart.docx")) {
assertDoesNotThrow(() -> OPCPackage.open(is).close());
}
pkg.revert();
}
private static String extractInvalidFormatMessage(String sampleNameSuffix) throws IOException {

View File

@ -17,11 +17,15 @@
package org.apache.poi.openxml4j.opc.internal;
import static org.apache.poi.xssf.XSSFTestDataSamples.openSampleWorkbook;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.apache.poi.ooxml.util.POIXMLUnits;
@ -34,6 +38,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.Sheet;
@ -127,7 +132,6 @@ public final class TestContentTypeManager {
* Test the addition then removal of content types in a package.
*/
@Disabled
@Test
void testContentTypeRemovalPackage() {
// TODO
}
@ -145,48 +149,48 @@ public final class TestContentTypeManager {
void bug62629CombinePictures() throws Exception {
// this file has incorrect default content-types which caused problems in Apache POI
// we now handle this broken file more gracefully
XSSFWorkbook book = XSSFTestDataSamples.openSampleWorkbook("62629_target.xlsm");
XSSFWorkbook b = XSSFTestDataSamples.openSampleWorkbook("62629_toMerge.xlsx");
for (int i = 0; i < b.getNumberOfSheets(); i++) {
XSSFSheet sheet = book.createSheet(b.getSheetName(i));
copyPictures(sheet, b.getSheetAt(i));
}
try (XSSFWorkbook targetWB = openSampleWorkbook("62629_target.xlsm");
XSSFWorkbook mergeWB = openSampleWorkbook("62629_toMerge.xlsx")) {
for (Sheet b_sheet : mergeWB) {
XSSFSheet sheet = targetWB.createSheet(b_sheet.getSheetName());
XSSFWorkbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(book);
wbBack.close();
book.close();
b.close();
}
XSSFDrawing drawingOld = (XSSFDrawing)b_sheet.createDrawingPatriarch();
XSSFDrawing drawingNew = sheet.createDrawingPatriarch();
CreationHelper helper = sheet.getWorkbook().getCreationHelper();
List<XSSFShape> shapes = drawingOld.getShapes();
private static void copyPictures(Sheet newSheet, Sheet sheet) {
Drawing drawingOld = sheet.createDrawingPatriarch();
Drawing drawingNew = newSheet.createDrawingPatriarch();
CreationHelper helper = newSheet.getWorkbook().getCreationHelper();
if (drawingNew instanceof XSSFDrawing) {
List<XSSFShape> shapes = ((XSSFDrawing) drawingOld).getShapes();
for (int i = 0; i < shapes.size(); i++) {
if (shapes.get(i) instanceof XSSFPicture) {
XSSFPicture pic = (XSSFPicture) shapes.get(i);
for (XSSFShape shape : shapes) {
assertTrue(shape instanceof XSSFPicture);
XSSFPicture pic = (XSSFPicture)shape;
XSSFPictureData picData = pic.getPictureData();
int pictureIndex = newSheet.getWorkbook().addPicture(picData.getData(), picData.getPictureType());
XSSFClientAnchor anchor = null;
CTTwoCellAnchor oldAnchor = ((XSSFDrawing) drawingOld).getCTDrawing().getTwoCellAnchorArray(i);
if (oldAnchor != null) {
anchor = (XSSFClientAnchor) helper.createClientAnchor();
CTMarker markerFrom = oldAnchor.getFrom();
CTMarker markerTo = oldAnchor.getTo();
anchor.setDx1((int) POIXMLUnits.parseLength(markerFrom.xgetColOff()));
anchor.setDx2((int) POIXMLUnits.parseLength(markerTo.xgetColOff()));
anchor.setDy1((int) POIXMLUnits.parseLength(markerFrom.xgetRowOff()));
anchor.setDy2((int) POIXMLUnits.parseLength(markerTo.xgetRowOff()));
anchor.setCol1(markerFrom.getCol());
anchor.setCol2(markerTo.getCol());
anchor.setRow1(markerFrom.getRow());
anchor.setRow2(markerTo.getRow());
}
int pictureIndex = targetWB.addPicture(picData.getData(), picData.getPictureType());
ClientAnchor oldAnchor = pic.getClientAnchor();
assertNotNull(oldAnchor);
ClientAnchor anchor = helper.createClientAnchor();
anchor.setAnchorType(oldAnchor.getAnchorType());
anchor.setDx1(oldAnchor.getDx1());
anchor.setDx2(oldAnchor.getDx2());
anchor.setDy1(oldAnchor.getDy1());
anchor.setDy2(oldAnchor.getDy2());
anchor.setCol1(oldAnchor.getCol1());
anchor.setCol2(oldAnchor.getCol2());
anchor.setRow1(oldAnchor.getRow1());
anchor.setRow2(oldAnchor.getRow2());
drawingNew.createPicture(anchor, pictureIndex);
}
}
try (XSSFWorkbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(targetWB)) {
for (XSSFWorkbook wb : Arrays.asList(targetWB, mergeWB)) {
for (Sheet sheet : wb) {
XSSFSheet backSheet = wbBack.getSheet(sheet.getSheetName());
assertNotNull(backSheet);
XSSFDrawing origPat = (XSSFDrawing)sheet.createDrawingPatriarch();
XSSFDrawing backPat = backSheet.createDrawingPatriarch();
assertEquals(origPat.getShapes().size(), backPat.getShapes().size());
}
}
}
}
}
}

View File

@ -27,14 +27,18 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import javax.crypto.Cipher;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
import org.apache.poi.POIDataSamples;
import org.apache.poi.poifs.crypt.CryptoFunctions;
import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.IOUtils;
@ -158,7 +162,11 @@ public class TestDecryptor {
POIFSFileSystem pfs = new POIFSFileSystem(is)) {
EncryptionInfo info = new EncryptionInfo(pfs);
Decryptor dec = Decryptor.getInstance(info);
dec.getDataStream(pfs).close();
MessageDigest md = CryptoFunctions.getMessageDigest(HashAlgorithm.sha256);
try (InputStream is2 = dec.getDataStream(pfs)) {
md.update(IOUtils.toByteArray(is2));
}
assertEquals("L1vDQq2EuMSfU/FBfVQfM2zfOY5Jx9ZyVgIQhXPPVgs=", Base64.encodeBase64String(md.digest()));
}
}

View File

@ -17,8 +17,10 @@
package org.apache.poi.xddf.usermodel.chart;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@ -99,17 +101,7 @@ public class TestXDDFChartRemoveSeries {
* This method writes the workbook to resultDir/fileName.
*/
@AfterEach
void cleanup() {
if (workbook == null) {
System.out.println(String.format(Locale.ROOT, "%s: workbook==null", procName));
return;
}
if (fileName == null) {
System.out.println(String.format(Locale.ROOT, "%s: fileName==null", procName));
return;
}
void cleanup() throws IOException {
// Finish up
chart.plot(chartData);
final int index = workbook.getSheetIndex(sheet);
@ -120,18 +112,8 @@ public class TestXDDFChartRemoveSeries {
final File file = new File(resultDir, fileName);
try (OutputStream fileOut = new FileOutputStream(file)) {
workbook.write(fileOut);
System.out.println(
String.format(Locale.ROOT, "%s: test file written to %s", procName, file.getAbsolutePath()));
} catch (Exception e) {
System.err.println(e.getMessage());
} finally {
try {
workbook.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
workbook.close();
}
/**
@ -144,11 +126,8 @@ public class TestXDDFChartRemoveSeries {
procName = "testRemoveSeries0";
fileName = procName + ".xlsx";
try {
chartData.getSeries().remove(0);
} catch (UnsupportedOperationException uoe) {
assertEquals(2, chartData.getSeriesCount());
}
assertThrows(UnsupportedOperationException.class, () -> chartData.getSeries().remove(0));
assertEquals(2, chartData.getSeriesCount());
}
/**
@ -186,6 +165,10 @@ public class TestXDDFChartRemoveSeries {
void testDontRemoveSeries() {
procName = "testDontRemoveSeries";
fileName = procName + ".xlsx";
IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> chartData.removeSeries(2));
assertEquals("removeSeries(2): illegal index", e.getMessage());
assertEquals(2, chartData.getSeriesCount());
}
}

View File

@ -17,6 +17,7 @@
package org.apache.poi.xssf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -61,88 +62,91 @@ public class XSSFMemoryLeakTests {
@Test
void testWriteRow() throws IOException {
final XSSFWorkbook wb = new XSSFWorkbook();
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow row = sheet1.createRow(0);
final XSSFCell cell = row.createCell(0);
cell.setCellValue("hello");
try (XSSFWorkbook wb = new XSSFWorkbook()) {
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow row = sheet1.createRow(0);
final XSSFCell cell = row.createCell(0);
cell.setCellValue("hello");
// Cannot check the CTCell here as it is reused now and thus
// not freed until we free up the Cell itself
//verifier.addObject(ctCell);
// Cannot check the CTCell here as it is reused now and thus
// not freed until we free up the Cell itself
//verifier.addObject(ctCell);
try (OutputStream out = new ByteArrayOutputStream(8192)) {
wb.write(out);
try (OutputStream out = new ByteArrayOutputStream(8192)) {
wb.write(out);
}
CTCell ctCell = cell.getCTCell();
assertSame(cell.getCTCell(), ctCell, "The CTCell should not be replaced");
assertSame(row.getCTRow().getCArray(0), ctCell, "The CTCell in the row should not be replaced");
}
CTCell ctCell = cell.getCTCell();
assertSame(cell.getCTCell(), ctCell, "The CTCell should not be replaced");
assertSame(row.getCTRow().getCArray(0), ctCell, "The CTCell in the row should not be replaced");
wb.close();
}
@Test
void testRemoveCellFromRow() throws IOException {
final XSSFWorkbook wb = new XSSFWorkbook();
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow rowToCheck = sheet1.createRow(0);
references.add(rowToCheck);
try (XSSFWorkbook wb = new XSSFWorkbook()) {
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow rowToCheck = sheet1.createRow(0);
references.add(rowToCheck);
XSSFCell cell = rowToCheck.createCell(0);
cell.setCellValue("hello");
XSSFCell cell = rowToCheck.createCell(0);
cell.setCellValue("hello");
// previously the CTCell was still referenced in the CTRow, verify that it is freed
verifier.addObject(cell);
verifier.addObject(cell.getCTCell());
// previously the CTCell was still referenced in the CTRow, verify that it is freed
verifier.addObject(cell);
verifier.addObject(cell.getCTCell());
rowToCheck.removeCell(cell);
rowToCheck.removeCell(cell);
wb.close();
assertNull(rowToCheck.getCell(0));
}
}
@Test
void testRemove2CellsFromRow() throws IOException {
final XSSFWorkbook wb = new XSSFWorkbook();
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow rowToCheck = sheet1.createRow(0);
references.add(rowToCheck);
try (XSSFWorkbook wb = new XSSFWorkbook()) {
final XSSFSheet sheet1 = wb.createSheet("Sheet1");
final XSSFRow rowToCheck = sheet1.createRow(0);
references.add(rowToCheck);
XSSFCell cell1 = rowToCheck.createCell(0);
cell1.setCellValue("hello");
XSSFCell cell2 = rowToCheck.createCell(1);
cell2.setCellValue("world");
XSSFCell cell1 = rowToCheck.createCell(0);
cell1.setCellValue("hello");
XSSFCell cell2 = rowToCheck.createCell(1);
cell2.setCellValue("world");
// previously the CTCell was still referenced in the CTRow, verify that it is freed
verifier.addObject(cell1);
verifier.addObject(cell1.getCTCell());
verifier.addObject(cell2);
verifier.addObject(cell2.getCTCell());
// previously the CTCell was still referenced in the CTRow, verify that it is freed
verifier.addObject(cell1);
verifier.addObject(cell1.getCTCell());
verifier.addObject(cell2);
verifier.addObject(cell2.getCTCell());
rowToCheck.removeCell(cell2);
rowToCheck.removeCell(cell1);
rowToCheck.removeCell(cell2);
rowToCheck.removeCell(cell1);
wb.close();
assertNull(rowToCheck.getCell(0));
assertNull(rowToCheck.getCell(1));
}
}
@Test
void testRemoveRowFromSheet() throws IOException {
final XSSFWorkbook wb1 = new XSSFWorkbook();
final XSSFSheet sheetToCheck = wb1.createSheet("Sheet1");
references.add(sheetToCheck);
final XSSFRow row = sheetToCheck.createRow(0);
final XSSFCell cell = row.createCell(0);
cell.setCellValue(1);
try (XSSFWorkbook wb1 = new XSSFWorkbook()) {
final XSSFSheet sheetToCheck = wb1.createSheet("Sheet1");
references.add(sheetToCheck);
final XSSFRow row = sheetToCheck.createRow(0);
final XSSFCell cell = row.createCell(0);
cell.setCellValue(1);
// ensure that the row-data is not kept somewhere in another member
verifier.addObject(row.getCTRow());
verifier.addObject(row);
verifier.addObject(cell.getCTCell());
verifier.addObject(cell);
// ensure that the row-data is not kept somewhere in another member
verifier.addObject(row.getCTRow());
verifier.addObject(row);
verifier.addObject(cell.getCTCell());
verifier.addObject(cell);
sheetToCheck.removeRow(row);
sheetToCheck.removeRow(row);
wb1.close();
assertNull(sheetToCheck.getRow(0));
}
}
@Test

View File

@ -27,15 +27,21 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.commons.codec.binary.Base64;
import org.apache.poi.POIDataSamples;
import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.poifs.crypt.CryptoFunctions;
import org.apache.poi.poifs.crypt.HashAlgorithm;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
@ -187,12 +193,7 @@ public final class TestXSSFReader {
void test50119() throws Exception {
try (OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("WithChartSheet.xlsx")) {
XSSFReader r = new XSSFReader(pkg);
XSSFReader.SheetIterator it = (XSSFReader.SheetIterator) r.getSheetsData();
while (it.hasNext()) {
InputStream stream = it.next();
stream.close();
}
assertEquals("bxdf4aa1n9VLkn/4++RNhoygSelxWDM2Can1m9TLlTw=", hash(r));
}
}
@ -330,16 +331,24 @@ public final class TestXSSFReader {
void test64420() throws Exception {
try (OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("64420.xlsm"))) {
XSSFReader reader = new XSSFReader(pkg);
Iterator<InputStream> iter = reader.getSheetsData();
byte[] data = new byte[4096];
while (iter.hasNext()) {
InputStream stream = iter.next();
assertNotNull(stream);
int read = IOUtils.readFully(stream, data);
assertTrue(read > 0);
stream.close();
}
assertEquals("U/j5UN7LN8wH6Gw/gsn6pCMASz+Nb1euCsFtC8tAPm0=", hash(reader));
}
}
private static String hash(XSSFReader reader) throws IOException {
Iterable<InputStream> iter = () -> {
try {
return reader.getSheetsData();
} catch (IOException | InvalidFormatException e) {
throw new RuntimeException(e);
}
};
MessageDigest md = CryptoFunctions.getMessageDigest(HashAlgorithm.sha256);
for (InputStream is : iter) {
md.update(IOUtils.toByteArray(is));
}
return Base64.encodeBase64String(md.digest());
}
}

View File

@ -196,15 +196,11 @@ public final class TestStylesTable {
try (XSSFWorkbook wb = new XSSFWorkbook()) {
StylesTable styles = wb.getStylesSource();
for (int i = 0; i < styles.getMaxNumberOfDataFormats(); i++) {
wb.getStylesSource().putNumberFormat("\"test" + i + " \"0");
}
try {
wb.getStylesSource().putNumberFormat("\"anotherformat \"0");
} catch (final IllegalStateException e) {
if (!e.getMessage().startsWith("The maximum number of Data Formats was exceeded.")) {
throw e;
}
styles.putNumberFormat("\"test" + i + " \"0");
}
IllegalStateException e = assertThrows(IllegalStateException.class,
() -> styles.putNumberFormat("\"anotherformat \"0"));
assertTrue(e.getMessage().startsWith("The maximum number of Data Formats was exceeded."));
}
}

View File

@ -181,7 +181,6 @@ public final class TestSXSSFFormulaEvaluation extends BaseTestFormulaEvaluator
wb.close();
}
@Test
@Disabled(
"This test is disabled because it fails for SXSSF because " +
"handling of errors in formulas is slightly different than in XSSF, " +

View File

@ -41,13 +41,13 @@ public final class TestSXSSFRow extends BaseTestXRow {
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>")
protected void testCellShiftingRight(){
// Remove when SXSSFRow.shiftCellsRight() is implemented.
}
@Override
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>")
protected void testCellShiftingLeft(){
// Remove when SXSSFRow.shiftCellsLeft() is implemented.
}

View File

@ -16,6 +16,7 @@
==================================================================== */
package org.apache.poi.xssf.streaming;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -97,7 +98,8 @@ public class TestSXSSFSheetAutoSizeColumn {
sheet.trackAllColumnsForAutoSizing();
for (int i = 0; i < 10; i++) {
sheet.autoSizeColumn(i, useMergedCells);
int i2 = i;
assertDoesNotThrow(() -> sheet.autoSizeColumn(i2, useMergedCells));
}
}

View File

@ -21,6 +21,7 @@ package org.apache.poi.xssf.streaming;
import static org.apache.poi.POITestCase.assertEndsWith;
import static org.apache.poi.POITestCase.assertStartsWith;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -359,7 +360,6 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
@Disabled("Crashes the JVM because of documented JVM behavior with concurrent writing/reading of zip-files, "
+ "see http://www.oracle.com/technetwork/java/javase/documentation/overview-156328.html")
@Test
void bug53515a() throws Exception {
File out = new File("Test.xlsx");
assertTrue(!out.exists() || out.delete());
@ -382,7 +382,7 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
System.gc();
}
wb.write(outSteam);
wb.write(outSteam);
// assertTrue(wb.dispose());
outSteam.close();
} finally {
@ -456,26 +456,25 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook {
*/
@Test
void testZipBombNotTriggeredOnUselessContent() throws IOException {
SXSSFWorkbook swb = new SXSSFWorkbook(null, 1, true, true);
SXSSFSheet s = swb.createSheet();
char[] useless = new char[32767];
Arrays.fill(useless, ' ');
try (SXSSFWorkbook swb = new SXSSFWorkbook(null, 1, true, true)) {
SXSSFSheet s = swb.createSheet();
char[] useless = new char[32767];
Arrays.fill(useless, ' ');
for (int row=0; row<1; row++) {
Row r = s.createRow(row);
for (int col=0; col<10; col++) {
char[] prefix = Integer.toHexString(row * 1000 + col).toCharArray();
Arrays.fill(useless, 0, 10, ' ');
System.arraycopy(prefix, 0, useless, 0, prefix.length);
String ul = new String(useless);
r.createCell(col, CellType.STRING).setCellValue(ul);
for (int row = 0; row < 1; row++) {
Row r = s.createRow(row);
for (int col = 0; col < 10; col++) {
char[] prefix = Integer.toHexString(row * 1000 + col).toCharArray();
Arrays.fill(useless, 0, 10, ' ');
System.arraycopy(prefix, 0, useless, 0, prefix.length);
String ul = new String(useless);
r.createCell(col, CellType.STRING).setCellValue(ul);
}
}
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
swb.write(bos);
swb.dispose();
swb.close();
assertDoesNotThrow(() -> swb.write(new NullOutputStream()));
swb.dispose();
}
}
/**