Klasa testująca kod.
This commit is contained in:
parent
91f0fab0da
commit
136cb90a1f
99
Testy.java
99
Testy.java
@ -1,50 +1,49 @@
|
||||
package wmiproject;
|
||||
import java.io.File;
|
||||
|
||||
public class Testy {
|
||||
|
||||
private String[] peselgood = {"60110353151","57041454875","73082572695","95111316474","61121094969"} ;
|
||||
|
||||
private String[] peselbad = {"99090303240","90931202030","20202020202","29023955555","57041454874"};
|
||||
|
||||
private String communicate = "";
|
||||
|
||||
|
||||
//test1 - Sprawdza czy działa tester peseli
|
||||
public String PrzetestujPeselValid() {
|
||||
var i = 0;
|
||||
while (i<5) {
|
||||
PeselValid sprawdzgood = new PeselValid(peselgood[i]);
|
||||
PeselValid sprawdzbad = new PeselValid(peselbad[i]);
|
||||
if(sprawdzgood.isValid() == true && sprawdzbad.isValid() == false) {
|
||||
i++;
|
||||
if(communicate.isEmpty()) {
|
||||
communicate = "Test sprawdzania peseli zdany.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
i=5;
|
||||
communicate = "Problem w mechanizmie validacji PESEL";
|
||||
}
|
||||
}
|
||||
return communicate;
|
||||
}
|
||||
//test2 - Sprawdza czy ścieżka istnieje lub jest poprawna.
|
||||
public void PrzetestujPliki(String filepath) {
|
||||
|
||||
File f = new File(filepath);
|
||||
|
||||
if(!f.isDirectory()){
|
||||
communicate = "Błędna ścieżka, lub katalog nie istnieje!";
|
||||
System.out.println(communicate);
|
||||
System.exit(0);
|
||||
}
|
||||
else if(f.isDirectory()){
|
||||
communicate = "Katalog istnieje! ";
|
||||
System.out.println(communicate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
package wmiproject;
|
||||
import java.io.File;
|
||||
|
||||
public class Testy {
|
||||
|
||||
private String[] peselgood = {"60110353151","57041454875","73082572695","95111316474","61121094969"} ;
|
||||
|
||||
private String[] peselbad = {"99090303240","90931202030","20202020202","29023955555","57041454874"};
|
||||
|
||||
private String communicate = "";
|
||||
|
||||
//test1 - Sprawdza czy działa tester peseli
|
||||
public String PrzetestujPeselValid() {
|
||||
var i = 0;
|
||||
while (i<5) {
|
||||
PeselValid sprawdzgood = new PeselValid(peselgood[i]);
|
||||
PeselValid sprawdzbad = new PeselValid(peselbad[i]);
|
||||
if(sprawdzgood.isValid() == true && sprawdzbad.isValid() == false) {
|
||||
i++;
|
||||
if(communicate.isEmpty()) {
|
||||
communicate = "Test sprawdzania peseli zdany.";
|
||||
}
|
||||
}
|
||||
else {
|
||||
i=5;
|
||||
communicate = "Problem w mechanizmie validacji PESEL";
|
||||
}
|
||||
}
|
||||
return communicate;
|
||||
}
|
||||
//test2 - Sprawdza czy ścieżka istnieje lub jest poprawna.
|
||||
public void PrzetestujPliki(String filepath) {
|
||||
|
||||
File f = new File(filepath);
|
||||
|
||||
if(!f.isDirectory()){
|
||||
communicate = "Błędna ścieżka, lub katalog nie istnieje!";
|
||||
System.out.println(communicate);
|
||||
System.exit(0);
|
||||
}
|
||||
else if(f.isDirectory()){
|
||||
communicate = "Katalog istnieje! ";
|
||||
System.out.println(communicate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user