Browse Source

added TestAccount

master
Danial Eshete 5 years ago
parent
commit
5be306424a
9 changed files with 67 additions and 18 deletions
  1. 0
    12
      .idea/ChareSWE.iml
  2. 2
    2
      .idea/misc.xml
  3. 1
    1
      .idea/modules.xml
  4. 6
    2
      src/Account.java
  5. 1
    1
      src/CredentialsTest.java
  6. 1
    0
      src/Person.java
  7. 3
    0
      src/Spender.java
  8. 52
    0
      src/TestAccount.java
  9. 1
    0
      src/TestKorndoerfer.java

+ 0
- 12
.idea/ChareSWE.iml View File

@@ -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>

+ 2
- 2
.idea/misc.xml View File

@@ -3,7 +3,7 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$USER_HOME$/gitchareswe" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="true" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/../gitchareswe" />
</component>
</project>

+ 1
- 1
.idea/modules.xml View File

@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<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>
</component>
</project>

+ 6
- 2
src/Account.java View File

@@ -2,10 +2,14 @@ public class Account {
public Person owner;
public String email;


Account(Person owner, String email){
this.owner = owner;
this.email = email;
}
public void accountErstellen(Person p, String e_email){


this.owner = p;
this.email = e_email;

}


+ 1
- 1
src/CredentialsTest.java View File

@@ -16,7 +16,7 @@ public class CredentialsTest{
public void testTwo(){

Credentials c = new Credentials("hofmannol", "GERONIMO");
assertTrue(c.valid());
assertEquals("hofmannol", c.login);
}

@Test

+ 1
- 0
src/Person.java View File

@@ -6,6 +6,7 @@ public class Person {
public int age;

Person(String name, String vname, int age){

this.name = name;
this.vname = vname;
this.age = age;

+ 3
- 0
src/Spender.java View File

@@ -3,17 +3,20 @@ public class Spender extends Person{
private int amount;

public Spender (String fname, String lname, int age, int summe){

super(fname, lname, age);
this.amount = summe;
}

public void betragSetzen(int summe){

if(summe > 0){
amount = summe;
}
}

public int getAmount(){

return amount;
}


+ 52
- 0
src/TestAccount.java View 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);

}
}

+ 1
- 0
src/TestKorndoerfer.java View File

@@ -12,4 +12,5 @@ public class TestKorndoerfer {

}


}

Loading…
Cancel
Save