Removed AvoidStarImport Rule

Added JavaDocType Rule
This commit is contained in:
Mudit Porwal
2017-03-22 01:16:01 +08:00
parent 175e9f58c1
commit 09585c3874
105 changed files with 577 additions and 284 deletions

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.objectmother;
/**
* Defines all attributes and behaviour related to the King
*/
public class King implements Royalty {
boolean isDrunk = false;
boolean isHappy = false;
@ -45,11 +48,11 @@ public class King implements Royalty {
public void makeUnhappy() {
isHappy = false;
}
public boolean isHappy() {
return isHappy;
}
/**
* Method to flirt to a queen.
* @param queen Queen which should be flirted.
@ -61,6 +64,6 @@ public class King implements Royalty {
} else {
this.makeHappy();
}
}
}

View File

@ -22,6 +22,9 @@
*/
package com.iluwatar.objectmother;
/**
* Defines all attributes and behaviour related to the Queen
*/
public class Queen implements Royalty {
private boolean isDrunk = false;
private boolean isHappy = false;
@ -46,7 +49,7 @@ public class Queen implements Royalty {
public void makeUnhappy() {
isHappy = false;
}
public boolean isFlirty() {
return isFlirty;
}
@ -54,7 +57,7 @@ public class Queen implements Royalty {
public void setFlirtiness(boolean flirtiness) {
this.isFlirty = flirtiness;
}
/**
* Method which is called when the king is flirting to a queen.
* @param king King who initialized the flirt.

View File

@ -22,12 +22,15 @@
*/
package com.iluwatar.objectmother;
/**
* Interface contracting Royalty Behaviour
*/
public interface Royalty {
void makeDrunk();
void makeSober();
void makeHappy();
void makeUnhappy();
}

View File

@ -22,8 +22,11 @@
*/
package com.iluwatar.objectmother;
/**
* Object Mother Pattern generating Royalty Types
*/
public final class RoyaltyObjectMother {
/**
* Method to create a sober and unhappy king. The standard paramters are set.
* @return An instance of {@link com.iluwatar.objectmother.King} with the standard properties.
@ -31,7 +34,7 @@ public final class RoyaltyObjectMother {
public static King createSoberUnhappyKing() {
return new King();
}
/**
* Method of the object mother to create a drunk king.
* @return A drunk {@link com.iluwatar.objectmother.King}.
@ -41,7 +44,7 @@ public final class RoyaltyObjectMother {
king.makeDrunk();
return king;
}
/**
* Method to create a happy king.
* @return A happy {@link com.iluwatar.objectmother.King}.
@ -51,7 +54,7 @@ public final class RoyaltyObjectMother {
king.makeHappy();
return king;
}
/**
* Method to create a happy and drunk king.
* @return A drunk and happy {@link com.iluwatar.objectmother.King}.
@ -62,7 +65,7 @@ public final class RoyaltyObjectMother {
king.makeDrunk();
return king;
}
/**
* Method to create a flirty queen.
* @return A flirty {@link com.iluwatar.objectmother.Queen}.
@ -72,7 +75,7 @@ public final class RoyaltyObjectMother {
queen.setFlirtiness(true);
return queen;
}
/**
* Method to create a not flirty queen.
* @return A not flirty {@link com.iluwatar.objectmother.Queen}.

View File

@ -33,8 +33,11 @@ import com.iluwatar.objectmother.Queen;
import com.iluwatar.objectmother.Royalty;
import com.iluwatar.objectmother.RoyaltyObjectMother;
/**
* Test Generation of Royalty Types using the object-mother
*/
public class RoyaltyObjectMotherTest {
@Test
public void unsuccessfulKingFlirt() {
King soberUnhappyKing = RoyaltyObjectMother.createSoberUnhappyKing();
@ -42,7 +45,7 @@ public class RoyaltyObjectMotherTest {
soberUnhappyKing.flirt(flirtyQueen);
assertFalse(soberUnhappyKing.isHappy());
}
@Test
public void queenIsBlockingFlirtCauseDrunkKing() {
King drunkUnhappyKing = RoyaltyObjectMother.createDrunkKing();
@ -50,7 +53,7 @@ public class RoyaltyObjectMotherTest {
drunkUnhappyKing.flirt(notFlirtyQueen);
assertFalse(drunkUnhappyKing.isHappy());
}
@Test
public void queenIsBlockingFlirt() {
King soberHappyKing = RoyaltyObjectMother.createHappyKing();
@ -58,7 +61,7 @@ public class RoyaltyObjectMotherTest {
soberHappyKing.flirt(notFlirtyQueen);
assertFalse(soberHappyKing.isHappy());
}
@Test
public void successfullKingFlirt() {
King soberHappyKing = RoyaltyObjectMother.createHappyKing();
@ -66,7 +69,7 @@ public class RoyaltyObjectMotherTest {
soberHappyKing.flirt(flirtyQueen);
assertTrue(soberHappyKing.isHappy());
}
@Test
public void testQueenType() {
Royalty flirtyQueen = RoyaltyObjectMother.createFlirtyQueen();
@ -74,7 +77,7 @@ public class RoyaltyObjectMotherTest {
assertEquals(flirtyQueen.getClass(), Queen.class);
assertEquals(notFlirtyQueen.getClass(), Queen.class);
}
@Test
public void testKingType() {
Royalty drunkKing = RoyaltyObjectMother.createDrunkKing();