Patterns implements Serializable { public void add(String pattern, MimeType type) throws MimeTypeException { this.add(pattern, false, type); } Patterns(MediaTypeRegistry registry); void add(String pattern, MimeType type); void add(String pattern, boolean isJavaRegex, MimeType type); MimeType matches(String name);  }
@Test public void testAdd() throws MimeTypeException { try { patterns.add(null, text); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { patterns.add("", null); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { patterns.add(null, null); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
@Test public void testExtension() throws MimeTypeException { MimeType doc = types.forName("application/vnd.ms-word"); patterns.add("*.doc", doc); assertEquals(".doc", doc.getExtension()); }