diff --git a/README.md b/README.md index b15ef8f..caffc4c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,55 @@ # Exceptional -[![](https://img.shields.io/badge/License-MPL--2.0-blue)](./LICENSE "Project license: MPL-2.0") -[![](https://img.shields.io/badge/Java-11-orange)](# "This project targets Java 11") +[![](https://img.shields.io/maven-central/v/com.rezzedup.util/exceptional?color=ok&label=Maven%20Central)](https://search.maven.org/artifact/com.rezzedup.util/exceptional "Maven Central") +[![](https://img.shields.io/badge/License-MPL--2.0-blue)](./LICENSE "Project License: MPL-2.0") +[![](https://img.shields.io/badge/Java-11-orange)](# "Java Version: 11") +[![javadoc](https://javadoc.io/badge2/com.rezzedup.util/exceptional/javadoc.svg?label=Javadoc&color=%234D7A97)](https://javadoc.io/doc/com.rezzedup.util/exceptional "View Javadocs") Utilities for handling exceptions. +```java +List lines = Attempt.ignoring(() -> Files.readAllLines(Path.of("example.txt"))).orElseGet(List::of); +``` + ## Maven -*`Coming soon!`* +```xml + + com.rezzedup.util + exceptional + + +``` + +### Versions + +Find available versions on the releases page of this repository. + +Maven Central: https://search.maven.org/artifact/com.rezzedup.util/exceptional + +
+Note: Snapshot Versions + +> [ℹ️](#note-snapshot-versions) +> Snapshot releases are available at the following repository: +> +> ```xml +> +> +> ossrh-snapshots +> https://s01.oss.sonatype.org/content/repositories/snapshots +> +> +> ``` +
+ +### Documentation + +Javadoc: https://javadoc.io/doc/com.rezzedup.util/exceptional + +### Shading + +If you intend to shade this library, please consider **relocating** the packages +to avoid potential conflicts with other projects. This library also utilizes +nullness annotations, which may be undesirable in a shaded uber-jar. They can +safely be excluded, and you are encouraged to do so. diff --git a/pom.xml b/pom.xml index fef16b8..e7a0b36 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.rezzedup.util exceptional - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT Exceptional 2021 diff --git a/src/test/java/com/rezzedup/util/exceptional/AttemptTests.java b/src/test/java/com/rezzedup/util/exceptional/AttemptTests.java index beceabb..f1eceba 100644 --- a/src/test/java/com/rezzedup/util/exceptional/AttemptTests.java +++ b/src/test/java/com/rezzedup/util/exceptional/AttemptTests.java @@ -22,7 +22,7 @@ public class AttemptTests private void throwsChecked() throws Exception { throw new Exception(); } - private void expect(String message) { for (int i = 0; i < 3; i++) { System.err.println(message); } } + private void expect(String message){ for (int i = 0; i < 3; i++) { System.err.println("\n" + message + "\n"); } } @Test public void testIgnoring() @@ -41,6 +41,8 @@ public void testPrinting() Optional divided = assertDoesNotThrow(() -> Attempt.printing(this::divideByZero)); assertTrue(divided.isEmpty()); + expect("THESE STACKTRACES ARE EXPECTED."); + assertDoesNotThrow(() -> Attempt.printing(this::throwsChecked)); expect("NO MORE STACKTRACES ARE EXPECTED.");