Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Created by .ignore support plugin (hsz.mobi)
### Maven template
target/
test-output/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand Down
103 changes: 52 additions & 51 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.wakaleo.tutorials</groupId>
<artifactId>vet-clinic</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>com.wakaleo.tutorials</groupId>
<artifactId>vet-clinic</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>tutorials</name>
<url>http://maven.apache.org</url>
<name>tutorials</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/When*.java</include>
<include>**/*Test.java</include>
<include>**/*TestSuite.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/When*.java</include>
<include>**/*Test.java</include>
<include>**/*TestSuite.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package serenitylabs.tutorials.vetclinic.domain;
import java.time.LocalDate;

public class DogBreederEntityBuilder implements WithIBreedable,IwithColourable {

private String name;
private String breed;
private String favouriteColour;
private String optFldFavouriteFood;
private String optFldFavouriteToy;

public DogBreederEntityBuilder(String name) {
this.name=name;
System.out.println("DogBreederEntityBuilder - builders object initialized.");
}

public DogBreederEntityBuilder ofDogBreed(String breed) {
this.breed=breed;
return this;
}

public DogEntityImmutableType bornOn(LocalDate localDate) {
return new DogEntityImmutableType(name, breed, localDate,favouriteColour,optFldFavouriteFood,optFldFavouriteToy);
}


public DogEntity dgEntityBornOn(LocalDate localDate) {
return new DogEntity(name, breed, localDate,favouriteColour,optFldFavouriteFood,optFldFavouriteToy);
}

@Override
public IwithColourable ofBreed(String breed) {
return new DogBreederEntityBuilder(breed);
}

public DogBreederEntityBuilder ofDogColour(String strFavColour) {
this.favouriteColour=strFavColour;
return this;
}


public DogEntityImmutableType ofColour(String favColour) {
return new DogEntityImmutableType(favColour);
}

public DogBreederEntityBuilder setOptFldFavouriteFood(String strOptFavFood) {
this.optFldFavouriteFood=strOptFavFood;
return this;
}

public DogBreederEntityBuilder setOptFldFavouriteToy(String strOptFavToy) {
this.optFldFavouriteToy=strOptFavToy;
return this;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package serenitylabs.tutorials.vetclinic.domain;
import java.time.LocalDate;

/**
* Mutable DogEntity class as its fields values state can be modifyed with the
* help of setter methods.
*
*/

public class DogEntity {

private String dogName;
private String dogBreed;
private LocalDate birthDateTime;
private String favouriteColour;
private String optFldFavouriteFood;
private String optFldFavouriteToy;

DogEntity(String dogName, String dogBreed, LocalDate birthDateTime,String favColour,String strFavFood,String strFavToy) {
this.dogName = dogName;
this.dogBreed = dogBreed;
this.birthDateTime = birthDateTime;
this.favouriteColour=favColour;
this.optFldFavouriteFood=strFavFood;
this.optFldFavouriteToy=strFavToy;
}

public DogEntity(){
System.out.println("Default constructor of Mutable DogEntity class called.");
}

public String getDogName() {
return dogName;
}
public String getDogBreed() {
return dogBreed;
}
public LocalDate getBirthDateTime() {
return birthDateTime;
}

public String getFavouriteColour() {
return favouriteColour;
}

public String getOptFldFavouriteFood() {
return optFldFavouriteFood;
}

public String getOptFldFavouriteToy() {
return optFldFavouriteToy;
}

public static WithIBreedable called(String name)
{
return new DogBreederEntityBuilder(name);
}

public DogEntity dgEntityBornOn(LocalDate localDate) {
return new DogEntity(dogName, dogBreed, localDate,favouriteColour,optFldFavouriteFood,optFldFavouriteToy);
}

public void setDogName(String strDgName) {
this.dogName=strDgName;
}

public void setDogBreed(String strDgBreed) {
this.dogBreed=strDgBreed;
}

public void setBirthDateTime(LocalDate locDateTimeObj) {
this.birthDateTime=locDateTimeObj;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package serenitylabs.tutorials.vetclinic.domain;
import java.time.LocalDate;

/**
* Immutable DogEntityImmutableType class as its fields values state can not be
* modified.
*
*/

public class DogEntityImmutableType {

//marking fields with final soo that its state can not be change.
private String dogName;
private String dogBreed;
private LocalDate dateOfBirth;
private String favouriteColor;
private String optFldFavouriteFood;
private String optFldFavouriteToy;

public static DogEntityImmutableType getImmutableInstance() {
return new DogEntityImmutableType();
}

public DogEntityImmutableType(String dogName, String dogBreed, LocalDate birthDateTime) {
this(dogName, dogBreed, birthDateTime,null,null,null);
System.out.println("Parameterized constructor of Immutable DogEntityImmutableType class called.");
}

public DogEntityImmutableType(String dogName, String dogBreed, LocalDate birthDateTime, String favColour,String favFood,String favToys) {
this.dogName = dogName;
this.dogBreed = dogBreed;
this.dateOfBirth = birthDateTime;
this.favouriteColor = favColour;
this.optFldFavouriteFood=favFood;
this.optFldFavouriteToy=favToys;
System.out.println("Parameterized constructor with new field added.");
}

public DogEntityImmutableType() {

}

public DogEntityImmutableType(String name) {
this.dogName=name;
}

public String getDogName() {
return dogName;
}
public String getDogBreed() {
return dogBreed;
}
public LocalDate getBirthDate() {
return dateOfBirth;
}

public String getFavouriteColor() {
return favouriteColor;
}

public String getOptFldFavouriteFood() {
return optFldFavouriteFood;
}

public String getOptFldFavouriteToy() {
return optFldFavouriteToy;
}


public DogEntityImmutableType called(String name) {
this.dogName=name;
System.out.println("\nThis methode call is mandatory. called()");
return this;
}

public DogEntityImmutableType ofBreed(String breed) {
System.out.println("\nThis methode call is mandatory. ofBreed()");
this.dogBreed=breed;
return this;
}

public DogEntityImmutableType ofColour(String favColour) {
this.favouriteColor=favColour;
System.out.println("\nThis methode called. ofColour()");
return this;
}


public DogEntityImmutableType bornOn(LocalDate theFourthOfJuly) {
System.out.println("\nThis methode call is mandatory. bornOn()");
return new DogEntityImmutableType(dogName, dogBreed, theFourthOfJuly,favouriteColor,optFldFavouriteFood,optFldFavouriteToy);
}


public DogEntityImmutableType setOptFldFavouriteFood(String optFldFavouriteFood) {
this.optFldFavouriteFood = optFldFavouriteFood;
System.out.println("\nThis methode call is optional setOptFldFavouriteFood() ");
return this;
}

public DogEntityImmutableType setOptFldFavouriteToy(String optFldFavouriteToy) {
this.optFldFavouriteToy = optFldFavouriteToy;
System.out.println("\nThis methode call is optional setOptFldFavouriteToy() ");
return this;
}

public static DogEntityImmutableType aLargeDog() {
return getImmutableInstance().ofBreed("Labrador");
}

public static DogEntityImmutableType aSmallDog() {
return getImmutableInstance().ofBreed("Lasa");
}

public static DogEntityImmutableType aGuardDog() {
return getImmutableInstance().ofBreed("German Shepherd");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package serenitylabs.tutorials.vetclinic.domain;

public interface IwithColourable {

DogEntityImmutableType ofColour(String favColour);

DogBreederEntityBuilder ofDogColour(String strFavColour);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package serenitylabs.tutorials.vetclinic.domain;

public interface WithIBreedable {

IwithColourable ofBreed(String breed);

IwithColourable ofDogBreed(String breed);

}

This file was deleted.

File renamed without changes.
Loading