Skip to content

Commit

Permalink
Add test confirming that method is protected or public.
Browse files Browse the repository at this point in the history
  • Loading branch information
midgleyc committed Jul 16, 2022
1 parent df129fd commit 851e832
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

package org.mozilla.javascript.tests.commonjs.module.provider;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URISyntaxException;;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileTime;
Expand Down Expand Up @@ -67,6 +70,14 @@ public void testModuleModified() throws Exception {
Assert.assertNotEquals("Modified", ModuleSourceProvider.NOT_MODIFIED, result);
}

@Test
public void getCharacterEncodingCanBeModifiedInSubclass() throws NoSuchMethodException {
Method method = UrlModuleSourceProvider.class
.getDeclaredMethod("getCharacterEncoding", new Class[] { URLConnection.class });
int mods = method.getModifiers();
Assert.assertTrue(Modifier.isPublic(mods) || Modifier.isProtected(mods));
}

private static URI getModuleURI(final Path filePath) throws URISyntaxException {
final String uriString = filePath.toUri().toASCIIString();
return new URI(uriString.substring(0, uriString.lastIndexOf('.')));
Expand Down

0 comments on commit 851e832

Please sign in to comment.