BAEL-1171 String.lang.String API (#2742)

* Evaluation article: Different Types of Bean Injection in Spring

* added tests & changed configuration to Java-based config

* removed xml config files

* rename unit tests

* BAEL-972 - Apache Commons Text

* remove code from evaluation article

* remove code from evaluation article

* BAEL-972 - Apache Commons Text - added another example

* BAEL-972 - Apache Commons Text - just indentation

* BAEL-994 - TemporalAdjuster in Java

* BAEL-994 - TemporalAdjuster in Java

* BAEL-994 - TemporalAdjuster in Java

* BAEL-994 - TemporalAdjuster in Java

* BAEL-994 - TemporalAdjuster in Java - fix problems

* BAEL-1033 Introduction to StreamUtils

* BAEL-1033 Introduction to StreamUtils

* BAEL-1033 Introduction to StreamUtils

* fix formatting

* BAEL-1033 minor refactor

* BAEL-1035 Introduction to Eclipse Collections

* format

* BAEL-1035 Introduction to Eclipse Collections

* BAEL-1035 Introduction to Eclipse Collections

* BAEL-1035 Introduction to Eclipse Collections

* cleanup

* cleanup

* BAEL-1109 Introduction to JCache

* BAEL-1109 Introduction to JCache

* remove unneeded property in pom.xml

* fix formatting

* close cache instances properly

* remove latest commit

* BAEL-1057 Introduction to rxjava-jdbc

* refactor rxjava-jdbc

* Refactor rxjava-jdbc

* Refactoring rxjava-jdbc

* BAEL-1171 java.lang.String API

* refactor rxjava-jdbc

* refactor String

* String API - move multiple classes into a single class

* move class into test package

* BAEL-1171 String.lang.String API

* BAEL-1171 java.lang.String API
This commit is contained in:
Ahmed Tawila 2017-10-15 13:37:47 +02:00 committed by Grzegorz Piwowarek
parent b85bb1ae1e
commit c3a45d072a
1 changed files with 9 additions and 3 deletions

View File

@ -2,10 +2,9 @@ package com.baeldung.string;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.IllegalFormatException;
import java.util.regex.PatternSyntaxException;
@ -38,7 +37,7 @@ public class StringTest {
}
@Test
public void whenGetBytesUsingUTF16_thenCorrect() {
public void whenGetBytesUsingASCII_thenCorrect() {
byte[] byteArray = "efgh".getBytes(StandardCharsets.US_ASCII);
byte[] expected = new byte[] { 101, 102, 103, 104 };
@ -156,6 +155,13 @@ public class StringTest {
String[] result = s.split("*");
}
@Test
public void whenCallSubSequence_thenCorrect() {
String s = "Welcome to Baeldung";
assertEquals("Welcome", s.subSequence(0, 7));
}
@Test
public void whenCallSubstring_thenCorrect() {
String s = "Welcome to Baeldung";