Fixed wrong regex

This commit is contained in:
Michal Pawlaczyk 2020-04-04 23:29:20 +02:00
parent 1b1bb36bbe
commit 4cfc4ff7ab
12 changed files with 58 additions and 30 deletions

View File

@ -10,7 +10,7 @@
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
<module name="Project1Pesel" target="1.14" /> <module name="Project1Pesel" target="14" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>
</project> </project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,7 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="a81d195f-d729-4df8-820f-1992ec836829" name="Default Changelist" comment="" /> <list default="true" id="a81d195f-d729-4df8-820f-1992ec836829" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/log.log" beforeDir="false" afterPath="$PROJECT_DIR$/log.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/company/ReadParameters.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/company/ReadParameters.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/surefire-reports/TEST-junit.AddToFileTest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/surefire-reports/TEST-junit.AddToFileTest.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/surefire-reports/TEST-junit.VerifyPeselTest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/surefire-reports/TEST-junit.VerifyPeselTest.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/surefire-reports/junit.AddToFileTest.txt" beforeDir="false" afterPath="$PROJECT_DIR$/target/surefire-reports/junit.AddToFileTest.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/surefire-reports/junit.VerifyPeselTest.txt" beforeDir="false" afterPath="$PROJECT_DIR$/target/surefire-reports/junit.VerifyPeselTest.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/test-classes/META-INF/Project1Pesel.kotlin_module" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -14,6 +26,9 @@
</list> </list>
</option> </option>
</component> </component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MavenImportPreferences"> <component name="MavenImportPreferences">
<option name="importingSettings"> <option name="importingSettings">
<MavenImportingSettings> <MavenImportingSettings>
@ -28,6 +43,9 @@
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../Project1Pesel" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.0" /> <property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" /> <property name="project.structure.side.proportion" value="0.0" />
@ -79,26 +97,26 @@
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state x="683" y="244" key="#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585475922927" /> <state x="683" y="244" key="#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585475922927" />
<state x="740" y="310" key="FileChooserDialogImpl" timestamp="1585946148289"> <state x="740" y="310" key="FileChooserDialogImpl" timestamp="1586035073509">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state x="740" y="310" key="FileChooserDialogImpl/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585946148289" /> <state x="740" y="310" key="FileChooserDialogImpl/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1586035073509" />
<state width="1877" height="178" key="GridCell.Tab.0.bottom" timestamp="1585946921870"> <state width="1877" height="178" key="GridCell.Tab.0.bottom" timestamp="1586035684885">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state width="1877" height="178" key="GridCell.Tab.0.bottom/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585946921870" /> <state width="1877" height="178" key="GridCell.Tab.0.bottom/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1586035684885" />
<state width="1877" height="178" key="GridCell.Tab.0.center" timestamp="1585946921870"> <state width="1877" height="178" key="GridCell.Tab.0.center" timestamp="1586035684885">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state width="1877" height="178" key="GridCell.Tab.0.center/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585946921870" /> <state width="1877" height="178" key="GridCell.Tab.0.center/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1586035684885" />
<state width="1877" height="178" key="GridCell.Tab.0.left" timestamp="1585946921870"> <state width="1877" height="178" key="GridCell.Tab.0.left" timestamp="1586035684885">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state width="1877" height="178" key="GridCell.Tab.0.left/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585946921870" /> <state width="1877" height="178" key="GridCell.Tab.0.left/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1586035684885" />
<state width="1877" height="178" key="GridCell.Tab.0.right" timestamp="1585946921870"> <state width="1877" height="178" key="GridCell.Tab.0.right" timestamp="1586035684885">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>
<state width="1877" height="178" key="GridCell.Tab.0.right/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1585946921870" /> <state width="1877" height="178" key="GridCell.Tab.0.right/0.1110.1920.1050/0.30.1920.1050@0.30.1920.1050" timestamp="1586035684885" />
<state x="616" y="258" key="run.anything.popup" timestamp="1585564392260"> <state x="616" y="258" key="run.anything.popup" timestamp="1585564392260">
<screen x="0" y="30" width="1920" height="1050" /> <screen x="0" y="30" width="1920" height="1050" />
</state> </state>

View File

@ -21,3 +21,7 @@
2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest 2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest
2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest 2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest
2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest 2020-04-02 22:03:04 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest
2020-04-04 23:10:21 INFO AddToFile:19 - Running the test code in AddToFileTest
2020-04-04 23:10:22 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest
2020-04-04 23:10:22 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest
2020-04-04 23:10:22 INFO VerifyPesel:18 - Running the test code in VerifyPeselTest

View File

@ -10,14 +10,14 @@ import java.util.regex.Pattern;
public class ReadParameters { public class ReadParameters {
private boolean isInputWordsOnly(String input) { private boolean isInputWordsOnly(String input) {
Pattern wordsOnlyRegex = Pattern.compile("\\^[Aa-zZ]"); Pattern wordsOnlyRegex = Pattern.compile("^[a-zA-Z]+");
Matcher matcher = wordsOnlyRegex.matcher(input); Matcher matcher = wordsOnlyRegex.matcher(input);
return matcher.matches(); return matcher.matches();
} }
private boolean isInputDigitsOnly(String input) { private boolean isInputDigitsOnly(String input) {
Pattern digitsOnlyRegex = Pattern.compile("\\^[0-9]+"); Pattern digitsOnlyRegex = Pattern.compile("^[0-9]+");
Matcher matcher = digitsOnlyRegex.matcher(input); Matcher matcher = digitsOnlyRegex.matcher(input);
return matcher.matches(); return matcher.matches();

View File

@ -1,5 +1,5 @@
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\main\java\com\company\ReadParameters.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\main\java\com\company\Person.java
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\main\java\com\company\Main.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\main\java\com\company\AddToFile.java
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\main\java\com\company\Person.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\main\java\com\company\Main.java
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\main\java\com\company\VerifyPesel.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\main\java\com\company\VerifyPesel.java
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\main\java\com\company\AddToFile.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\main\java\com\company\ReadParameters.java

View File

@ -1,2 +1,2 @@
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\test\java\junit\AddToFileTest.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\test\java\junit\VerifyPeselTest.java
C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel\src\test\java\junit\VerifyPeselTest.java C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java\src\test\java\junit\AddToFileTest.java

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="junit.AddToFileTest" time="0.308" errors="0" skipped="0"> <testsuite tests="1" failures="0" name="junit.AddToFileTest" time="0.441" errors="0" skipped="0">
<properties> <properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/> <property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="14+36-1461"/> <property name="java.vm.version" value="14+36-1461"/>
<property name="sun.boot.library.path" value="C:\Program Files\OpenJDK\jdk-14\bin"/> <property name="sun.boot.library.path" value="C:\Program Files\OpenJDK\jdk-14\bin"/>
<property name="maven.multiModuleProjectDirectory" value="C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel"/> <property name="maven.multiModuleProjectDirectory" value="C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java"/>
<property name="java.vm.vendor" value="Oracle Corporation"/> <property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/> <property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/> <property name="guice.disable.misplaced.annotation.check" value="true"/>
@ -15,7 +15,7 @@
<property name="user.country" value="PL"/> <property name="user.country" value="PL"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/> <property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel"/> <property name="user.dir" value="C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/> <property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="14+36-1461"/> <property name="java.runtime.version" value="14+36-1461"/>
<property name="os.arch" value="amd64"/> <property name="os.arch" value="amd64"/>
@ -59,5 +59,5 @@
<property name="sun.cpu.endian" value="little"/> <property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value="amd64"/> <property name="sun.cpu.isalist" value="amd64"/>
</properties> </properties>
<testcase classname="junit.AddToFileTest" name="correctValueTest" time="0.308"/> <testcase classname="junit.AddToFileTest" name="correctValueTest" time="0.441"/>
</testsuite> </testsuite>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="3" failures="0" name="junit.VerifyPeselTest" time="0.001" errors="0" skipped="0"> <testsuite tests="3" failures="0" name="junit.VerifyPeselTest" time="0" errors="0" skipped="0">
<properties> <properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/> <property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="14+36-1461"/> <property name="java.vm.version" value="14+36-1461"/>
<property name="sun.boot.library.path" value="C:\Program Files\OpenJDK\jdk-14\bin"/> <property name="sun.boot.library.path" value="C:\Program Files\OpenJDK\jdk-14\bin"/>
<property name="maven.multiModuleProjectDirectory" value="C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel"/> <property name="maven.multiModuleProjectDirectory" value="C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java"/>
<property name="java.vm.vendor" value="Oracle Corporation"/> <property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/> <property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/> <property name="guice.disable.misplaced.annotation.check" value="true"/>
@ -15,7 +15,7 @@
<property name="user.country" value="PL"/> <property name="user.country" value="PL"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/> <property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="C:\Users\micha\dev\Studia\Java_JSON_XML\Project1Pesel"/> <property name="user.dir" value="C:\Users\micha\dev\Studia\Java_JSON_XML\test\Projekt_1_Java"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/> <property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="14+36-1461"/> <property name="java.runtime.version" value="14+36-1461"/>
<property name="os.arch" value="amd64"/> <property name="os.arch" value="amd64"/>
@ -61,5 +61,5 @@
</properties> </properties>
<testcase classname="junit.VerifyPeselTest" name="correctValueTest" time="0"/> <testcase classname="junit.VerifyPeselTest" name="correctValueTest" time="0"/>
<testcase classname="junit.VerifyPeselTest" name="stringValueTest" time="0"/> <testcase classname="junit.VerifyPeselTest" name="stringValueTest" time="0"/>
<testcase classname="junit.VerifyPeselTest" name="tooShortValueTest" time="0.001"/> <testcase classname="junit.VerifyPeselTest" name="tooShortValueTest" time="0"/>
</testsuite> </testsuite>

View File

@ -1,4 +1,4 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Test set: junit.AddToFileTest Test set: junit.AddToFileTest
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.515 sec Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.678 sec