BAEL-6813: Moved Magic Square code to core-java-lang-math-3 (#14587)
* BAEL-6813: Moved Magic Square code to core-java-lang-math-3 * Fix code to work below Java 11 * Fix unrelated broken test
This commit is contained in:
parent
4a11a82b66
commit
379992c84e
|
@ -3,10 +3,14 @@ package com.baeldung.jar;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class JarAppUnitTest {
|
public class JarAppUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void findClassTest(){
|
public void findClassTest(){
|
||||||
Assert.assertTrue(JarApp.findObjectMapperClass().endsWith("jackson-databind-2.13.3.jar"));
|
Pattern databindPattern = Pattern.compile(".*jackson-databind-(\\d)+\\.(\\d)+\\.(\\d)\\.jar$");
|
||||||
|
|
||||||
|
Assert.assertTrue(databindPattern.matcher(JarApp.findObjectMapperClass()).matches());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.leetcode.magicsquare;
|
package com.baeldung.magicsquare;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.leetcode.magicsquare;
|
package com.baeldung.magicsquare;
|
||||||
|
|
||||||
import org.junit.platform.commons.util.StringUtils;
|
import org.junit.platform.commons.util.StringUtils;
|
||||||
|
|
||||||
|
@ -172,7 +172,9 @@ public class MagicSquare {
|
||||||
int value = getCell(x, y);
|
int value = getCell(x, y);
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
sb.append(".".repeat(largestNumberLength));
|
for (int i = 0; i < largestNumberLength; ++i) {
|
||||||
|
sb.append(".");
|
||||||
|
}
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
} else {
|
} else {
|
||||||
sb.append(String.format(formatString, value));
|
sb.append(String.format(formatString, value));
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.leetcode.magicsquare;
|
package com.baeldung.magicsquare;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
<?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>
|
|
||||||
<artifactId>core-java-leetcode</artifactId>
|
|
||||||
<name>core-java-leetcode</name>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>parent-modules</artifactId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>${maven-compiler-plugin.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<source>${maven.compiler.source.version}</source>
|
|
||||||
<target>${maven.compiler.target.version}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source.version>11</maven.compiler.source.version>
|
|
||||||
<maven.compiler.target.version>11</maven.compiler.target.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -108,7 +108,6 @@
|
||||||
<module>core-java-lang-operators-2</module>
|
<module>core-java-lang-operators-2</module>
|
||||||
<module>core-java-lang-syntax</module>
|
<module>core-java-lang-syntax</module>
|
||||||
<module>core-java-lang-syntax-2</module>
|
<module>core-java-lang-syntax-2</module>
|
||||||
<module>core-java-leetcode</module>
|
|
||||||
<module>core-java-locale</module>
|
<module>core-java-locale</module>
|
||||||
<module>core-java-networking</module>
|
<module>core-java-networking</module>
|
||||||
<module>core-java-networking-2</module>
|
<module>core-java-networking-2</module>
|
||||||
|
|
Loading…
Reference in New Issue