Browse Source

Proper directory structure and Unit tests started.

Tankernn 8 năm trước cách đây
mục cha
commit
9faf2858a2

+ 6 - 1
pom.xml

@@ -25,11 +25,16 @@
 			<artifactId>mysql-connector-java</artifactId>
 			<version>5.1.39</version>
 		</dependency>
+		<!-- https://mvnrepository.com/artifact/junit/junit -->
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.12</version>
+		</dependency>
 	</dependencies>
 
 	<build>
 		<finalName>${project.artifactId}-${project.version}.${build.number}</finalName>
-		<sourceDirectory>src</sourceDirectory>
 		<plugins>
 			<plugin>
 				<artifactId>maven-assembly-plugin</artifactId>

+ 0 - 0
src/eu/tankernn/accounts/Account.java → src/main/java/eu/tankernn/accounts/Account.java


+ 0 - 0
src/eu/tankernn/accounts/AccountEvent.java → src/main/java/eu/tankernn/accounts/AccountEvent.java


+ 0 - 0
src/eu/tankernn/accounts/AccountManager.java → src/main/java/eu/tankernn/accounts/AccountManager.java


+ 0 - 0
src/eu/tankernn/accounts/DBManager.java → src/main/java/eu/tankernn/accounts/DBManager.java


+ 0 - 0
src/eu/tankernn/accounts/FileManager.java → src/main/java/eu/tankernn/accounts/FileManager.java


+ 0 - 0
src/eu/tankernn/accounts/frame/AccountPanel.java → src/main/java/eu/tankernn/accounts/frame/AccountPanel.java


+ 0 - 0
src/eu/tankernn/accounts/frame/MainFrame.java → src/main/java/eu/tankernn/accounts/frame/MainFrame.java


+ 0 - 0
src/eu/tankernn/accounts/frame/NewAccountDialog.java → src/main/java/eu/tankernn/accounts/frame/NewAccountDialog.java


+ 0 - 0
src/eu/tankernn/accounts/frame/PasswordDialog.java → src/main/java/eu/tankernn/accounts/frame/PasswordDialog.java


+ 0 - 0
src/eu/tankernn/accounts/frame/menu/MainMenuBar.java → src/main/java/eu/tankernn/accounts/frame/menu/MainMenuBar.java


+ 0 - 0
src/eu/tankernn/accounts/util/GUIUtils.java → src/main/java/eu/tankernn/accounts/util/GUIUtils.java


+ 0 - 0
src/eu/tankernn/accounts/util/encryption/EncryptedComplex.java → src/main/java/eu/tankernn/accounts/util/encryption/EncryptedComplex.java


+ 0 - 0
src/eu/tankernn/accounts/util/encryption/EncryptedComplexSerializer.java → src/main/java/eu/tankernn/accounts/util/encryption/EncryptedComplexSerializer.java


+ 0 - 0
src/eu/tankernn/accounts/util/encryption/Encryption.java → src/main/java/eu/tankernn/accounts/util/encryption/Encryption.java


+ 0 - 0
src/eu/tankernn/accounts/util/encryption/InvalidPasswordException.java → src/main/java/eu/tankernn/accounts/util/encryption/InvalidPasswordException.java


+ 22 - 0
src/test/java/eu/tankernn/accounts/util/encryption/test/EncryptionTest.java

@@ -0,0 +1,22 @@
+package eu.tankernn.accounts.util.encryption.test;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import eu.tankernn.accounts.util.encryption.Encryption;
+import eu.tankernn.accounts.util.encryption.InvalidPasswordException;
+
+public class EncryptionTest {
+	@Test
+	public void encryptDecrypt() {
+		char[] password = "Super safe and secret password.".toCharArray();
+		String original = "Very secret string with some more characters added to it just for the sake of it.";
+		String encrypted = null;
+		try {
+			encrypted = Encryption.decryptEncoded(Encryption.encryptEncoded(original, password), password);
+		} catch (InvalidPasswordException e) {
+			e.printStackTrace();
+		}
+		Assert.assertEquals(original, encrypted);
+	}
+}