### Question:
OSGIResourceNamingConvention { public static Matcher getResourceNameMatcher( String path ) { Matcher matcher = RESOURCE_NAME_PATTERN.matcher( path ); boolean matches = matcher.matches(); if ( matches ) { return matcher; } else { throw new IllegalArgumentException( "Path must be of the form prefix/filename[_internationalization].properties[.priority]" ); } }  static Matcher getResourceNameMatcher( String path ); static int getPropertyPriority( String propertyName ); static List<String> getCandidateNames( String name, Locale locale ); static final String RESOURCES_ROOT_FOLDER; static final String RESOURCES_DEFAULT_EXTENSION; static final Pattern RESOURCE_NAME_PATTERN; }### Answer:
@Test( expected = NullPointerException.class ) public void testNullName() { String name = null; OSGIResourceNamingConvention.getResourceNameMatcher( name ); }
@Test( expected = IllegalArgumentException.class ) public void testEmptyName() { String name = ""; OSGIResourceNamingConvention.getResourceNameMatcher( name ); }
@Test public void testValidName() { String name = "i18n/messages.properties"; assertNotNull( OSGIResourceNamingConvention.getResourceNameMatcher( name ) ); name = "i18n/mesasages_fr.properties"; assertNotNull( OSGIResourceNamingConvention.getResourceNameMatcher( name ) ); name = "i18n/bundle/mesasages_fr.properties.3"; assertNotNull( OSGIResourceNamingConvention.getResourceNameMatcher( name ) ); }
@Test( expected = IllegalArgumentException.class ) public void testInvalidNameNoFolder() { String name = "messages.properties"; OSGIResourceNamingConvention.getResourceNameMatcher( name ); }
@Test( expected = IllegalArgumentException.class ) public void testInvalidNameDotDelimeter() { String name = "i18n.mesasages_fr.properties.3"; OSGIResourceNamingConvention.getResourceNameMatcher( name ); }