issue #333 review changes
This commit is contained in:
parent
6ab9b36d59
commit
cfd83b5753
@ -11,7 +11,7 @@ tags:
|
||||
---
|
||||
|
||||
## Intent
|
||||
Define factory of immutable content with separated builder and factory interfaces.
|
||||
Define a factory of immutable content with separated builder and factory interfaces.
|
||||
|
||||

|
||||
|
||||
|
@ -1,5 +1,18 @@
|
||||
package com.iluwatar.factorykit;
|
||||
|
||||
/**
|
||||
* Factory-kit is a creational pattern which defines a factory of immutable content
|
||||
* with separated builder and factory interfaces to deal with the problem of
|
||||
* creating one of the objects specified directly in the factory-kit instance.
|
||||
*
|
||||
* <p>
|
||||
* In the given example {@link WeaponFactory} represents the factory-kit, that contains
|
||||
* four {@link Builder}s for creating new objects of
|
||||
* the classes implementing {@link Weapon} interface.
|
||||
* <br>Each of them can be called with {@link WeaponFactory#create(WeaponType)} method, with
|
||||
* an input representing an instance of {@link WeaponType} that needs to
|
||||
* be mapped explicitly with desired class type in the factory instance.
|
||||
*/
|
||||
public class App {
|
||||
/**
|
||||
* Program entry point.
|
||||
|
@ -93,9 +93,9 @@ public class FactoryMethodTest {
|
||||
* @param expectedWeaponType expected WeaponType of the weapon
|
||||
* @param clazz expected class of the weapon
|
||||
*/
|
||||
private void verifyWeapon(Weapon weapon, WeaponType expectedWeaponType, Class clazz) {
|
||||
private void verifyWeapon(Weapon weapon, WeaponType expectedWeaponType, Class<?> clazz) {
|
||||
assertTrue("Weapon must be an object of: " + clazz.getName(), clazz.isInstance(weapon));
|
||||
assertEquals("Weapon must be of weaponType: " + clazz.getName(), expectedWeaponType,
|
||||
weapon.getWeaponType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user