| 1 | /* |
| 2 | * JTiger Unit Testing Framework for J2SE 1.5 |
| 3 | * Copyright (C) 2005 Tony Morris |
| 4 | * |
| 5 | * This software is licenced under the |
| 6 | * Common Public Licence version 1.0 |
| 7 | * http://www.opensource.org/licenses/cpl1.0.php |
| 8 | * |
| 9 | * You received a copy of this licence with this software. |
| 10 | */ |
| 11 | package org.jtiger.framework; |
| 12 | |
| 13 | final class FixtureDescriptionFactory |
| 14 | { |
| 15 | private FixtureDescriptionFactory() |
| 16 | { |
| 17 | |
| 18 | } |
| 19 | |
| 20 | static FixtureDescription newFixtureDescription() |
| 21 | { |
| 22 | return new FixtureDescriptionImpl(); |
| 23 | } |
| 24 | |
| 25 | private static final class FixtureDescriptionImpl implements FixtureDescription |
| 26 | { |
| 27 | FixtureDescriptionImpl() |
| 28 | { |
| 29 | |
| 30 | } |
| 31 | |
| 32 | public String getFixtureDescription(final Class<?> c) throws NullPointerException |
| 33 | { |
| 34 | if(c == null) |
| 35 | { |
| 36 | throw new NullPointerException(); |
| 37 | } |
| 38 | |
| 39 | final Fixture f = c.getAnnotation(Fixture.class); |
| 40 | |
| 41 | if(f == null) |
| 42 | { |
| 43 | return null; |
| 44 | } |
| 45 | |
| 46 | return f.description(); |
| 47 | } |
| 48 | } |
| 49 | } |