### Question:
SpacewalkPackage extends RPMRepoPackage { public static SpacewalkPackage buildSpacewalkPackage(final Map<String, Object> packageMap, final Repository sourceRepository) throws IllegalArgumentException { if (null == packageMap) { throw new NullPointerException("packageMap is null"); } if (null == sourceRepository) { throw new NullPointerException("sourceRepository is null"); } String name = tryGet(packageMap, "name").toString(); String version = tryGet(packageMap, "version").toString(); String release = tryGet(packageMap, "release").toString(); String architecture = tryGet(packageMap, "arch_label").toString(); int spacewalkPackageId = (int) tryGet(packageMap, "id"); return new SpacewalkPackage(name, version, release, architecture, sourceRepository, spacewalkPackageId); } protected  SpacewalkPackage();  SpacewalkPackage(final String name, final String version, final String release,
                    final String architecture, final Repository sourceRepository,
                    final int spacewalkPackageId); static SpacewalkPackage buildSpacewalkPackage(final Map<String, Object> packageMap,
                    final Repository sourceRepository); int getSpacewalkPackageId();  }### Answer:
@Test( expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*packageMap.*null*") public void exceptionWithNullMap() { SpacewalkPackage.buildSpacewalkPackage(null, new TestRepository("zzz")); }
@Test( expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*sourceRepository.*null*") public void exceptionWithNullRepository() { SpacewalkPackage.buildSpacewalkPackage(validPackageMap, null); }
@Test( expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*version*") public void parseInvalidPackageMap() { Map<String, Object> insufficientMap = new HashMap<String, Object>(validPackageMap); insufficientMap.remove("version"); SpacewalkPackage.buildSpacewalkPackage(insufficientMap, new TestRepository("zzz")); }