Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8285
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Robert Klemme <shortcutter@googlemail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Check of java annotation data |
| Date | Sun, 25 Sep 2011 11:08:14 +0200 |
| Lines | 67 |
| Message-ID | <9e89bvFbsdU1@mid.individual.net> (permalink) |
| References | <713a419e-c152-482e-a0af-68ba487acd4d@1g2000vbu.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net j5BFhfLRXinQWAsPTlLXzwV7RmQnScPP0GYc2+geTwmy+ftuc= |
| Cancel-Lock | sha1:9E94iSWYMpqv9wX0yKdPyc0Wu60= |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13 |
| In-Reply-To | <713a419e-c152-482e-a0af-68ba487acd4d@1g2000vbu.googlegroups.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8285 |
Show key headers only | View raw
On 09/22/2011 01:49 PM, mike wrote:
> Hi,
>
>
> Today we have an annotation for each test called Info. I need to check
> this information. Information is different depending if it is a
> create, get, set, update operation.
>
> @Info(
> time = Time.ISO9600,
> attr = {
> AREA,
> SERVICE,
> ROUTING,
> }, type = TestCaseType.CREATE, positive = false,
> description = ""
> )
>
> Then I have a testsummary class that access to all this information
> for each test case using a HashMap containing "TestCaseName",Info.
> <String, Info>
>
> What I want to do is to check information in @Info -tag depending if
> it is a create, get, set, update test case type.
>
> The idea I have is to have an abstract base class like:
>
> public abstract AbstractInfoChecker{
> public abstract boolean checkInfo(Info info);
> }
>
>
> and impl classes for each operation tests:
>
> public class Create extends AbstractInfoChecker{
>
> public boolean checkInfo(Info info){
> if(info.time().equalsIngoreCase("ISO9600"){
> //check other
> return true;
> }
> return false;
> }
>
> Q: How do a create an instance of right type depending on
> TestCaseType.nnn e.g. CREATE --> instance of
> Create.
> I have my Info stored in testsummary like this: Info info =
> (Info) entry.getValue();
> I can access the different values Info object.
>
> All comments and hints are much appreciated.
One way to do it: define a factory interface (or abstract class) which
creates AbstractInfoChecker. Create an enum map for TestCaseType as key
and the factory type as value. Initialize the map with the proper
factory instances (could even be anonymous classes).
Another way to do it: just create a factory method which returns
AbstractInfoChecker; implement it with a switch over TestCaseType.
Yet another way: put the specific logic into enum TestCaseType and use
it from there.
Kind regards
robert
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
Check of java annotation data mike <mikaelpetterson@hotmail.com> - 2011-09-22 04:49 -0700 Re: Check of java annotation data Robert Klemme <shortcutter@googlemail.com> - 2011-09-25 11:08 +0200
csiph-web