### Question:
RegExCache extends Cache <RegExPattern, Pattern> { @Nonnull public static Pattern getPattern (@Nonnull @Nonempty @RegEx final String sRegEx) { return getInstance ().getFromCache (new RegExPattern (sRegEx)); } private  RegExCache(); static boolean isInstantiated(); @Nonnull static RegExCache getInstance(); @Nonnull static Pattern getPattern(@Nonnull @Nonempty @RegEx final String sRegEx); @Nonnull static Pattern getPattern(@Nonnull @Nonempty @RegEx final String sRegEx, @Nonnegative final int nOptions); static final int MAX_CACHE_SIZE; }### Answer:
@Test @SuppressFBWarnings (value = "NP_NONNULL_PARAM_VIOLATION") public void testGetPattern () { assertNotNull (RegExCache.getPattern ("xy")); assertSame (RegExCache.getPattern ("xy"), RegExCache.getPattern ("xy")); assertNotSame (RegExCache.getPattern ("xy"), RegExCache.getPattern ("yy")); try { RegExCache.getPattern (""); fail (); } catch (final IllegalArgumentException ex) {} try { RegExCache.getPattern (null); fail (); } catch (final NullPointerException ex) {} try { RegExCache.getPattern ("[a-z+"); fail (); } catch (final IllegalArgumentException ex) { assertNotNull (ex.getCause ()); assertTrue (ex.getCause () instanceof PatternSyntaxException); } }