From 10eb27c5d8fa6f4dd564cc9a18e4611ab0bbd3ae Mon Sep 17 00:00:00 2001 From: Adah Boukhari Date: Sun, 9 Feb 2020 12:50:47 +0100 Subject: [PATCH] Commit_46 Methode setBenutzername() bearbeitet und wieder getestet --- .../bin/MeinBudgetView/LoginFrame.class | Bin 4382 -> 4429 bytes .../bin/MeinBudgetView/MyTest.class | Bin 2479 -> 2115 bytes .../src/MeinBudgetView/LoginFrame.java | 27 ++++++++++-------- Budget Projekt/src/MeinBudgetView/MyTest.java | 27 +++++++++++------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Budget Projekt/bin/MeinBudgetView/LoginFrame.class b/Budget Projekt/bin/MeinBudgetView/LoginFrame.class index e2944f3e909aa9625cb52f760206b2fb53c863d9..1b54685c457116efc6ee6934b8f31e9cf6bfa6d4 100644 GIT binary patch delta 634 zcmaKo%WG3n5XOHe?_95VY0*WZ^q~m#Rq8@fmjzu|q}qyfd7B(U+U5pwZ`!0NQE(-= zy89Y8BDk>?Ls9S#5PZL?RqMOj`dSJF@!XRlt~`r5GxN=S^UX|k-sv=M|Gsex*u&3h z<8m@A*y@XD${e$uT=#%i$~(CO{;%ZbwggWFQ9E16I|fIXGkH#05O<|FC@Y?yHilwv zco*lbKWS{Nz2~OD$Vu<8to9bO(%>VDaXtyG5qsS3Zt_=MPZmr*(O5QUNESW5G zU9f3bI%RKCmK?hvk2~3Z+jS?3rEH&+C8b*q2HO7AUdV1q6c)VUZ?DflI?loh;QEk@llL|9>&?F|E-Lg;Wj`nB z@QkdTF?J;n(vAy#E(Bs9gyz; delta 588 zcma)&%}Z2a6vlt=jC#AT15OP|iz2m>rYLbyQZ9uO6a-sH%WED7$LU7noyoCipjFWF z?#*^V8>h&I1pk1bFZh|b(fTt%Dnyytn(d7g)JziqnB-uroX0XWQ$ioNb0 zv)tiHf~Pz)I7Kg4kbzM{``-SnSM)k^o}cL$7|zP6pgX;RIuYc@{7ko@Aukh!To5k1 zyTTpzWW!tDJG=`o*zMasFmJFK3Hqeeb7n*=pICMH9M0OU2fnb=P$!dPfuV6+N`sOU zZ$d^4TZY9i1XGgtz0=Y!k{AD0qH#}M+2t{}F{Ctom!eU0Z!%P6v2Wk3HZi8PT15~X zM!Bl5gbq5&J?DjXE-(LIB&&<#e?^iTR1B|J3U4&Ebe)a9nX)HU5Tb@ LcQvd<%in(i*(rWL diff --git a/Budget Projekt/bin/MeinBudgetView/MyTest.class b/Budget Projekt/bin/MeinBudgetView/MyTest.class index c42fa33bf26dd962efe7bbc8b1fca2312741bdaf..a9549810292ecc1e3cd603a0e7150efc3d370663 100644 GIT binary patch literal 2115 zcmZvcT~ixX7{~tyLb8OVz&52)fg)BCD3I{lLa>I{77Z`*61CRKCOL+sVK;0xP|&N+ z=oj!_FTL?Xr!zI41N~hIN#%CCxie)=aGJ@$BVjIh;L<&c+O!6E*PfaJYr~$4QChv%T}I; z(Tr9VEeJAnqz#jAR*tjW-qW*1&Y-2OoL_YsgLU7cU42Rosy=25iF3Di(#}s7@v?7A; z5N{;Z8`t9s1E*zXG+y&5CouZBswy3icUV^!%}5hVcnL3*l2L;%kMM zwhD&1X47^RPw}~gtoOn&R9_HYRW&Fy1z%9O#g&cqO$A?yu86EaXMlp7ToWi9g%G~F za=oQj6^BBmHpkj8mAJjEm+Ahtdvd2ax4E0h3l&ANuP>OV+#M9Fz-?DMxpKc+=bx$`)Ej?B=4pA>omJ~wE$Zt@7 zrA`yV)QV-HTN|~i+(5RSMpV1B+Jp{oS0`EF=!E9PKk*2=Ek zjc>Oh-?tv$vbLw~Rgn>F&$MS=@40s1_M)`<-0K~9`=VO*4f5`QEdA$W$|Iejikc<) z9*}qs33v{Z^aw8DQ61iL4bNzZ_sYYY7a&Ih?%1_a?cfcp9}o)sgg|o@<;&SWuTKf8 tX1BJxsr-QrI^Inxu`MdFZDQJ~qnY<;&S{^5KyQk5rNlM4pm7tv{ttGfz99er literal 2479 zcmai#`%@EF6vw|8kX^ze5D~SaqO}B62q0K_r~&0+4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View/LoginFrame.java index 8b973fb..2e256db 100644 --- a/Budget Projekt/src/MeinBudgetView/LoginFrame.java +++ b/Budget Projekt/src/MeinBudgetView/LoginFrame.java @@ -97,14 +97,12 @@ public class LoginFrame extends JFrame implements ActionListener, KeyListener { } - public static String setBenutzername() { - String result = String.valueOf(benutzername); - return result; + protected static String setBenutzername(String benutzername) { + return benutzername; } - public static String setPassword() { - String result = String.valueOf(benutzername); - return result; + protected static void setPassword() { + passwordField.setText("admin"); } @Override @@ -114,10 +112,10 @@ public class LoginFrame extends JFrame implements ActionListener, KeyListener { @Override public void keyPressed(KeyEvent e) { - + if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (benutzername.getText().length() > 0 && passwordField.getText().length() > 0) { - MeinGui run = new MeinGui(); + MeinGui run = new MeinGui(); run.setVisible(true); } else { JOptionPane.showMessageDialog(this.anmelden, "Bitte geben Sie die richtigen Daten ein!"); @@ -126,16 +124,21 @@ public class LoginFrame extends JFrame implements ActionListener, KeyListener { if (e.getKeyCode() == KeyEvent.VK_F5) { System.exit(0); } - + if (e.getKeyCode() == KeyEvent.VK_L) { + benutzername.setText(benutzernameUndPasswordLeeren()); + passwordField.setText(benutzernameUndPasswordLeeren()); + } + } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub - + } - public static String benutzernameLeeren() { - return ""; + public static String benutzernameUndPasswordLeeren() { + return ""; } + } diff --git a/Budget Projekt/src/MeinBudgetView/MyTest.java b/Budget Projekt/src/MeinBudgetView/MyTest.java index 54817c2..c77cf52 100644 --- a/Budget Projekt/src/MeinBudgetView/MyTest.java +++ b/Budget Projekt/src/MeinBudgetView/MyTest.java @@ -1,5 +1,6 @@ package MeinBudgetView; +import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; @@ -48,13 +49,19 @@ class MyTest { @Test public void testSetBenutzername() { - String result = String.valueOf(LoginFrame.benutzername); - assertEquals(result, LoginFrame.setBenutzername()); - assertNotEquals(result + " ", LoginFrame.setBenutzername()); - assertNotEquals(null, LoginFrame.setBenutzername()); - + + assertEquals("admin", LoginFrame.setBenutzername("admin")); + assertEquals("ADMIN", LoginFrame.setBenutzername("ADMIN")); + assertNotEquals("Admin", LoginFrame.setBenutzername("")); + assertNotEquals("admin", LoginFrame.setBenutzername("Admin")); + assertNotEquals("", LoginFrame.setBenutzername("admin")); + assertEquals("ADMin".toUpperCase(), LoginFrame.setBenutzername("admin").toUpperCase()); + + + } + /** @Test public void testSetPassword() { String result = String.valueOf(LoginFrame.passwordField); @@ -63,14 +70,14 @@ class MyTest { assertNotEquals(null, LoginFrame.setPassword()); } - + */ @Test public void testSetLeeren() { - assertEquals("", LoginFrame.benutzernameLeeren()); - assertNotEquals(" ", LoginFrame.benutzernameLeeren()); - assertNotEquals("".length() > 0 , LoginFrame.benutzernameLeeren()); - assertNotEquals(""==null, LoginFrame.benutzernameLeeren()); + assertEquals("", LoginFrame.benutzernameUndPasswordLeeren()); + assertNotEquals(" ", LoginFrame.benutzernameUndPasswordLeeren()); + assertNotEquals("".length() > 0 , LoginFrame.benutzernameUndPasswordLeeren()); + assertNotEquals(""==null, LoginFrame.benutzernameUndPasswordLeeren()); }