删除编译错误
This commit is contained in:
parent
e2820ab2e3
commit
48d168a628
|
@ -1,7 +0,0 @@
|
|||
## Java 数字(Number)
|
||||
|
||||
本模块中包含有关 Java 数字(Number)有关的文章。
|
||||
|
||||
### 相关文章
|
||||
- [理解 Java 中的 NumberFormatException 异常](https://www.ossez.com/t/java-numberformatexception/13986)
|
||||
-
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>core-java-numbers</artifactId>
|
||||
<name>core-java-strings</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.ossez.core-java-modules</groupId>
|
||||
<artifactId>core-java-modules</artifactId>
|
||||
<version>0.0.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-core</artifactId>
|
||||
<version>${jmh-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-generator-annprocess</artifactId>
|
||||
<version>${jmh-generator.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>${icu4j.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>core-java-strings</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<icu4j.version>61.1</icu4j.version>
|
||||
<maven.compiler.release>11</maven.compiler.release>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
|
@ -1,50 +0,0 @@
|
|||
package com.ossez.number.foramt;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
|
||||
/**
|
||||
* String format to number with NumberFormatException
|
||||
*
|
||||
* <p><a href="https://www.ossez.com/t/java-numberformatexception/13986">https://www.ossez.com/t/java-numberformatexception/13986</a></p>
|
||||
*
|
||||
* @author YuCheng
|
||||
*/
|
||||
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
|
||||
public class NumberFormatExceptionTest {
|
||||
|
||||
@Test
|
||||
public void ConstructorNumberFormatException() {
|
||||
|
||||
// JUNIT 5 Assert
|
||||
Exception exception = assertThrows(NumberFormatException.class, () -> {
|
||||
new Integer("one");
|
||||
});
|
||||
System.out.println(exception);
|
||||
|
||||
// AssertJ assertThatThrownBy
|
||||
assertThatThrownBy(() -> {
|
||||
new Integer("one");
|
||||
}).isInstanceOf(NumberFormatException.class).hasMessageStartingWith("For input string");
|
||||
|
||||
// AssertJ assertThatExceptionOfType
|
||||
assertThatExceptionOfType(NumberFormatException.class).isThrownBy(() -> {
|
||||
new Integer("one");
|
||||
});
|
||||
|
||||
|
||||
// Integer aIntegerObj = new Integer("one");
|
||||
// Double doubleDecimalObj = new Double("two.2");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
one
|
Loading…
Reference in New Issue