Merge pull request #9582 from j0rdanit0/BAEL-4300
BAEL-4300 jordan.simpson.dev@gmail.com
This commit is contained in:
commit
c7549ff638
@ -13,4 +13,4 @@ This module contains articles about core features in the Java language
|
|||||||
- [Comparing Long Values in Java](https://www.baeldung.com/java-compare-long-values)
|
- [Comparing Long Values in Java](https://www.baeldung.com/java-compare-long-values)
|
||||||
- [Comparing Objects in Java](https://www.baeldung.com/java-comparing-objects)
|
- [Comparing Objects in Java](https://www.baeldung.com/java-comparing-objects)
|
||||||
- [Casting int to Enum in Java](https://www.baeldung.com/java-cast-int-to-enum)
|
- [Casting int to Enum in Java](https://www.baeldung.com/java-cast-int-to-enum)
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-lang)
|
[[ <-- Prev]](/core-java-modules/core-java-lang)[[Next --> ]](/core-java-modules/core-java-lang-3)
|
||||||
|
@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
This module contains articles about core features in the Java language
|
This module contains articles about core features in the Java language
|
||||||
|
|
||||||
### Relevant Articles:
|
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-lang-2)
|
- [[<-- Prev]](/core-java-modules/core-java-lang-2)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<name>core-java-lang-3</name>
|
<name>core-java-lang-3</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung.core-java-modules</groupId>
|
<groupId>com.baeldung.core-java-modules</groupId>
|
||||||
<artifactId>core-java-modules</artifactId>
|
<artifactId>core-java-modules</artifactId>
|
||||||
@ -16,7 +17,12 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>${assertj.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -30,7 +36,7 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<assertj.version>3.12.2</assertj.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.baeldung.stringtoboolean;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class StringToBooleanUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenStringTrue_whenUsingParseBoolean_thenTrue() {
|
||||||
|
assertThat(Boolean.parseBoolean("true")).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenStringTrue_whenUsingValueOf_thenTrue() {
|
||||||
|
assertThat(Boolean.valueOf("true")).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenStringTrue_whenUsingGetBoolean_thenFalse() {
|
||||||
|
assertThat(Boolean.getBoolean("true")).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSystemProperty_whenUsingGetBoolean_thenTrue() {
|
||||||
|
System.setProperty("CODING_IS_FUN", "true");
|
||||||
|
|
||||||
|
assertThat(Boolean.getBoolean("CODING_IS_FUN")).isTrue();
|
||||||
|
}
|
||||||
|
}
|
@ -13,4 +13,5 @@ This module contains articles about core features in the Java language
|
|||||||
- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name)
|
- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name)
|
||||||
- [The Java continue and break Keywords](https://www.baeldung.com/java-continue-and-break)
|
- [The Java continue and break Keywords](https://www.baeldung.com/java-continue-and-break)
|
||||||
- [Infinite Loops in Java](https://www.baeldung.com/infinite-loops-java)
|
- [Infinite Loops in Java](https://www.baeldung.com/infinite-loops-java)
|
||||||
- [[More --> ]](/core-java-modules/core-java-lang-2)
|
|
||||||
|
[[Next --> ]](/core-java-modules/core-java-lang-2)
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
<module>core-java-lambdas</module>
|
<module>core-java-lambdas</module>
|
||||||
<module>core-java-lang</module>
|
<module>core-java-lang</module>
|
||||||
<module>core-java-lang-2</module>
|
<module>core-java-lang-2</module>
|
||||||
|
<module>core-java-lang-3</module>
|
||||||
<module>core-java-lang-math</module>
|
<module>core-java-lang-math</module>
|
||||||
<module>core-java-lang-math-2</module>
|
<module>core-java-lang-math-2</module>
|
||||||
<module>core-java-lang-oop-constructors</module>
|
<module>core-java-lang-oop-constructors</module>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user