Skip to content

[Design Pattern] Factory Pattern - Animal #51

@fengyuanyang

Description

@fengyuanyang

Description
Let get start with design patten !
Factory Pattern.
If you have no idea Factory Pattern is
Check here

package at
com.ordestiny.tdd.designpattern.factorypattern

Given A factory Object(AnimalFactory)
And an animal Enum (BIRD, TIGER, CHICKEN, MONKEY, ....so on)
And corresponding Animal Object (should extend from Animal)

When ask factory to create BIRD
Expect Animal(Bird) return 
And it barks like (?)

When ask factory to create MONKEY
Expect Animal(Monkey) return 
And it barks like (?)

When ask factory to create null(not exist in enum)
Expect exception throw

(you can imagine more if you like

Additional context

Add any other context, links references or screenshots about the feature request here.

Important Checklist

  • I have written unit test first, make it red(fail first).
  • I have then written logic code, make it green(success)
  • I have tried to refactor my code, make it understandable(document my code)

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions