test fixes
This commit is contained in:
parent
d0d62b53c2
commit
8628a63d95
@ -1,10 +1,13 @@
|
|||||||
package com.baeldung.hexToAscii;
|
package com.baeldung.hexToAscii;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public class HexToAscii {
|
public class HexToAscii {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public static void whenHexToAscii() {
|
public static void whenHexToAscii() {
|
||||||
|
|
||||||
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
||||||
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
||||||
|
|
||||||
@ -13,15 +16,15 @@ public class HexToAscii {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public static void whenAsciiToHex() {
|
public static void whenAsciiToHex() {
|
||||||
|
|
||||||
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
||||||
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
||||||
|
|
||||||
assertEquals(hexEquivalent, asciiToHex(asciiString));
|
assertEquals(hexEquivalent, asciiToHex(asciiString));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String asciiToHex(String asciiStr) {
|
//
|
||||||
|
|
||||||
|
private static String asciiToHex(String asciiStr) {
|
||||||
char[] chars = asciiStr.toCharArray();
|
char[] chars = asciiStr.toCharArray();
|
||||||
StringBuilder hex = new StringBuilder();
|
StringBuilder hex = new StringBuilder();
|
||||||
for (char ch : chars) {
|
for (char ch : chars) {
|
||||||
@ -31,8 +34,7 @@ public class HexToAscii {
|
|||||||
return hex.toString();
|
return hex.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String hexToASCII(String hexStr) {
|
private static String hexToAscii(String hexStr) {
|
||||||
|
|
||||||
StringBuilder output = new StringBuilder("");
|
StringBuilder output = new StringBuilder("");
|
||||||
for (int i = 0; i < hexStr.length(); i += 2) {
|
for (int i = 0; i < hexStr.length(); i += 2) {
|
||||||
String str = hexStr.substring(i, i + 2);
|
String str = hexStr.substring(i, i + 2);
|
||||||
@ -40,4 +42,5 @@ public class HexToAscii {
|
|||||||
}
|
}
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -13,5 +13,12 @@
|
|||||||
- [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache)
|
- [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache)
|
||||||
- [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource)
|
- [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource)
|
||||||
|
|
||||||
To ignore "No persistence xml file found in project", you do:
|
### Eclipse Config
|
||||||
Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project"
|
After importing the project into Eclipse, you may see the following error:
|
||||||
|
"No persistence xml file found in project"
|
||||||
|
|
||||||
|
This can be ignored:
|
||||||
|
- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project"
|
||||||
|
Or:
|
||||||
|
- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator
|
||||||
|
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
## Spring Thymeleaf Example Project
|
## Spring Thymeleaf Example Project
|
||||||
|
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
- [Introduction to Using Thymeleaf in Spring](http://www.baeldung.com/thymeleaf-in-spring-mvc)
|
- [Introduction to Using Thymeleaf in Spring](http://www.baeldung.com/thymeleaf-in-spring-mvc)
|
||||||
- [CSRF Protection with Spring MVC and Thymeleaf](http://www.baeldung.com/csrf-thymeleaf-with-spring-security)
|
- [CSRF Protection with Spring MVC and Thymeleaf](http://www.baeldung.com/csrf-thymeleaf-with-spring-security)
|
||||||
|
|
||||||
|
|
||||||
### Build the Project
|
### Build the Project
|
||||||
|
|
||||||
mvn clean install
|
mvn clean install
|
||||||
|
|
||||||
|
|
||||||
### Run the Project
|
### Run the Project
|
||||||
mvn cargo:run
|
mvn cargo:run
|
||||||
- **note**: starts on port '8082'
|
- **note**: starts on port '8082'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user