added TestAccount
This commit is contained in:
parent
526e01a80f
commit
5be306424a
12
.idea/ChareSWE.iml
generated
12
.idea/ChareSWE.iml
generated
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="jars" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -3,7 +3,7 @@
|
|||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="true" project-jdk-name="10" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$USER_HOME$/gitchareswe" />
|
<output url="file://$PROJECT_DIR$/../gitchareswe" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
2
.idea/modules.xml
generated
2
.idea/modules.xml
generated
@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/ChareSWE.iml" filepath="$PROJECT_DIR$/.idea/ChareSWE.iml" />
|
<module fileurl="file://$PROJECT_DIR$/ChareSWE.iml" filepath="$PROJECT_DIR$/ChareSWE.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -2,10 +2,14 @@ public class Account {
|
|||||||
public Person owner;
|
public Person owner;
|
||||||
public String email;
|
public String email;
|
||||||
|
|
||||||
|
Account(Person owner, String email){
|
||||||
|
this.owner = owner;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
public void accountErstellen(Person p, String e_email){
|
public void accountErstellen(Person p, String e_email){
|
||||||
|
|
||||||
|
this.owner = p;
|
||||||
|
this.email = e_email;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class CredentialsTest{
|
|||||||
public void testTwo(){
|
public void testTwo(){
|
||||||
|
|
||||||
Credentials c = new Credentials("hofmannol", "GERONIMO");
|
Credentials c = new Credentials("hofmannol", "GERONIMO");
|
||||||
assertTrue(c.valid());
|
assertEquals("hofmannol", c.login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -6,6 +6,7 @@ public class Person {
|
|||||||
public int age;
|
public int age;
|
||||||
|
|
||||||
Person(String name, String vname, int age){
|
Person(String name, String vname, int age){
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.vname = vname;
|
this.vname = vname;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
|
@ -3,17 +3,20 @@ public class Spender extends Person{
|
|||||||
private int amount;
|
private int amount;
|
||||||
|
|
||||||
public Spender (String fname, String lname, int age, int summe){
|
public Spender (String fname, String lname, int age, int summe){
|
||||||
|
|
||||||
super(fname, lname, age);
|
super(fname, lname, age);
|
||||||
this.amount = summe;
|
this.amount = summe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void betragSetzen(int summe){
|
public void betragSetzen(int summe){
|
||||||
|
|
||||||
if(summe > 0){
|
if(summe > 0){
|
||||||
amount = summe;
|
amount = summe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAmount(){
|
public int getAmount(){
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
52
src/TestAccount.java
Normal file
52
src/TestAccount.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import org.junit.Test;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class TestAccount {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test1(){
|
||||||
|
|
||||||
|
// Arrange
|
||||||
|
Person p = new Person("Hans","Georg", 12);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
Account a = new Account(p, "fdfdf");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertEquals("Georg", a.owner.vname);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testM2(){
|
||||||
|
// Arrange
|
||||||
|
Person p = new Person("Hans","Georg", 12);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
Account a = new Account(p, "fdfdf");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertEquals("Georg", a.owner.vname);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test3(){
|
||||||
|
// Arrange
|
||||||
|
Person p = new Person("Hans","Georg", 12);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
Account a = new Account(p, "fdfdf");
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
assertEquals(12, a.owner.age);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,4 +12,5 @@ public class TestKorndoerfer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user