This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | |
http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
<servers> | |
<server> | |
<id>sonatype-nexus-snapshots</id> | |
<username>your-sonatype-username</username> | |
<password>your-sonatype-password</password> | |
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
<groupId>io.lenar</groupId> | |
<artifactId>app-props</artifactId> | |
<version>0.9.3-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>AppProps</name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌───────────── minute (0 - 59) | |
│ ┌───────────── hour (0 - 23) | |
│ │ ┌───────────── day of month (1 - 31) | |
│ │ │ ┌───────────── month (1 - 12) | |
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday; | |
│ │ │ │ │ 7 is also Sunday on some systems) | |
│ │ │ │ │ | |
│ │ │ │ │ | |
* * * * * schedule command to execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Map<String, String> queryToMap(String query) throws UnsupportedEncodingException { | |
Map<String, String> parameters = new HashMap<>(); | |
String[] queryArray = query.split("&"); | |
for (String string : queryArray) { | |
int idx = string.indexOf("="); | |
parameters.put(decode(string.substring(0, idx), "UTF-8"), decode(string.substring(idx + 1), "UTF-8")); | |
} | |
return parameters; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String mapToQuery(Map<String, String> parameters) { | |
String query = ""; | |
if (parameters != null && !parameters.isEmpty()){ | |
query = "?" + | |
parameters.entrySet().stream() | |
.map(entry -> entry.getKey() + "=" + entry.getValue()) | |
.collect(Collectors.joining("&")); | |
} | |
return query; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RomanNumeral { | |
private final HashMap<Integer, String> map = new HashMap<Integer, String>() { | |
{ | |
put(1, "I"); | |
put(5, "V"); | |
put(10, "X"); | |
put(50, "L"); | |
put(100, "C"); | |
put(500, "D"); | |
put(1000, "M"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Map<String, List<String>> static final digitToLetterMap = new HashMap() {{ | |
map.put("0", Arrays.asList(" ")); | |
map.put("1", Arrays.asList("")); | |
map.put("2", Arrays.asList("a", "b", "c")); | |
map.put("3", Arrays.asList("d", "e", "f")); | |
map.put("4", Arrays.asList("g", "h", "i")); | |
map.put("5", Arrays.asList("j", "k", "l")); | |
map.put("6", Arrays.asList("m", "m", "o")); | |
map.put("7", Arrays.asList("p", "q", "r", "s")); | |
map.put("8", Arrays.asList("t", "u", "v")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.lenar.examples.spring.start; | |
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.testng.Assert; | |
import org.testng.annotations.Test; | |
@SpringBootTest(classes = TestNGWithSpringApplication.class) | |
public class TestNGTestsWithSpringBootIT extends AbstractTestNGSpringContextTests { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isWiderPrimitive(Object object) { | |
if (object == null) { | |
return false; | |
} | |
Class clazz = object.getClass(); | |
if (clazz == Boolean.class || clazz == Character.class || | |
clazz == Byte.class || clazz == Short.class || | |
clazz == Integer.class || clazz == Long.class || | |
clazz == Float.class || clazz == Double.class || | |
clazz == String.class || clazz == Void.class) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.lang.Character.toUpperCase; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.manipulation.Filter; | |
import org.junit.runner.manipulation.NoTestsRemainException; |