From 69613f8e536107d11e7aa17bd261b4c87b901153 Mon Sep 17 00:00:00 2001 From: Mansi Date: Thu, 23 Nov 2017 17:57:18 +0530 Subject: [PATCH] BAEL-1237 String Formatter (#3103) * Example Code For Evaluation Article This is an example code for the evaluation article on "Different Types of Bean Injection in Spring" * Added unit tests * Minor changes to application context * Removed code committed for evaluation article * BAEL-944 Demonstrating the problems with new Url pattern matching in Spring 5 * BAEL-944 Demonstrating the problems with new Url pattern matching in Spring 5 * BAEL-944 Exploring the Spring MVC URL Matching Improvements * BAEL-944 Exploring the Spring MVC URL Matching Improvements * BAEL-944 Exploring the Spring MVC URL Matching Improvements * BAEL-944 Code Formatting and solving build issue * BAEL-944 Resolving build issue due to change in Spring version * BAEL-944 Resolving build issue * BAEL-944 Formatting code * BAEL-944 Moving tests to correct package * BAEL-944 Moving tests to correct package * BAEL-944 Replacing @RequestMapping by @GetMapping * BAEL-944 Remove unnecessary attribute name, "value" in annotations * BAEL-79 Intro to Activiti with Spring * BAEL-79 Intro to Activiti with Spring * BAEL-79 Adding activiti module to the parent modules * BAEL-79 Using latest version * BAEL-79 Update Spring boot version that works with Activiti * BAEL-79 Replace RequestMapping with GetMapping * BAEL-79 Use Java 8 Syntax * BAEL-79 Formatting * BAEL-79 changed module name * BAEL-378 A Guide to Activiti with Java * BAEL-79 Fixed unit tests * BAEL-79 Simplified the process * BAEL-79 Fix test cases * BAEL-1045 Lambda Behave * BAEL-1045 Lambda Behave * BAEL-1045 Lambda Behave * BAEL-1090 Difference between compact and compressed strings in Java 9 * BAEL-1237 String Formatter * BAEL-1237 String Formatter * BAEL-1237 String Formatter * BAEL-1237 String Formatter * BAEL-1237 Guide to java.util.Formatter * BAEL-1237 String Formatter * BAEL-1237 Using platform dependent line separator in new line test --- .../formatter/StringFormatterExampleTests.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleTests.java b/core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleTests.java index 5e8d2c4455..ad4f5dce7e 100644 --- a/core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleTests.java +++ b/core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleTests.java @@ -14,7 +14,8 @@ public class StringFormatterExampleTests { public void givenString_whenFormatSpecifierForCalendar_thenGotExpected() { //Syntax of Format Specifiers for Date/Time Representation Calendar c = new GregorianCalendar(2017, 11, 10); - String s = String.format("The date is: %1$tm %1$te,%1$tY", c); + String s = String.format("The date is: %tm %1$te,%1$tY", c); + assertEquals("The date is: 12 10,2017", s); } @@ -84,7 +85,7 @@ public class StringFormatterExampleTests { public void givenString_whenLineSeparatorConversion_thenConvertedString() { //Line Separator Conversion String s = String.format("First Line %nSecond Line"); - assertEquals("First Line \n" + assertEquals("First Line " + System.getProperty("line.separator") + "Second Line", s); } @@ -114,10 +115,10 @@ public class StringFormatterExampleTests { public void givenString_whenSpecifyArgumentIndex_thenGotExpected() { Calendar c = new GregorianCalendar(2017, 11, 10); //Argument_Index - String s = String.format("The date is: %1$tm %1$te,%1$tY", c); + String s = String.format("The date is: %tm %1$te,%1$tY", c); assertEquals("The date is: 12 10,2017", s); - - s = String.format("The date is: %1$tm %