Exclude local bin and META-INF folders;Applied Ricky's suggestions

This commit is contained in:
SS007979
2019-07-25 20:55:23 -04:00
parent 0e60758671
commit 069aed2300
6 changed files with 21 additions and 37 deletions
-2
View File
@@ -1,2 +0,0 @@
Manifest-Version: 1.0
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="java-faker/bin/javaFaker_0.18.1.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/java-faker/META-INF/javaFaker.jardesc" exportErrors="false" exportWarnings="false" includeDirectoryEntries="true" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="false" manifestLocation="/java-faker/META-INF/MANIFEST.MF" manifestVersion="1.0" reuseManifest="true" saveManifest="true" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="false" exportJavaFiles="true" exportOutputFolder="true">
<javaElement handleIdentifier="=java-faker/src\/main\/resources"/>
<javaElement handleIdentifier="=java-faker/src\/main\/java"/>
</selectedElements>
</jardesc>
Binary file not shown.
@@ -2,9 +2,13 @@ package com.github.javafaker;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Logger;
import org.apache.commons.lang3.ArrayUtils;
public class Relationships {
private final Faker faker;
private static final Logger logger = Logger.getLogger("Relationships");
protected Relationships(final Faker faker) {
this.faker = faker;
@@ -18,7 +22,7 @@ public class Relationships {
return faker.resolve("relationship.familial.extended");
}
public String in_law() {
public String inLaw() {
return faker.resolve("relationship.in_law");
}
@@ -35,25 +39,24 @@ public class Relationships {
}
public String any() {
String[] relationships = new String[] {"direct", "extended", "in_law", "spouse",
"parent", "sibling"};
int idx = faker.random().nextInt(relationships.length);
String methodName = relationships[idx];
Method currentMethod = Relationships.class.getClass().getEnclosingMethod();
try {
Method m = Relationships.class.getMethod(methodName);
Relationships relInstance = new Relationships(faker);
return (String)m.invoke(relInstance);
} catch (NoSuchMethodException e) {
e.printStackTrace();
Method[] methods = Relationships.class.getDeclaredMethods();
methods = ArrayUtils.removeElement(methods, currentMethod);
int indx = faker.random().nextInt(methods.length);
Method runMethod = methods[indx];
Relationships relationships = new Relationships(faker);
return (String)runMethod.invoke(relationships);
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
throw new RuntimeException("SecurityException: " + e.getMessage());
} catch (IllegalArgumentException e) {
e.printStackTrace();
throw new RuntimeException("IllegalArgumentException: " + e.getMessage());
} catch (IllegalAccessException e) {
throw new RuntimeException("IllegalAccessException: " + e.getMessage());
} catch (InvocationTargetException e) {
e.printStackTrace();
throw new RuntimeException("InvocationTargetException: " + e.getMessage());
}
return null;
}
}
Executable → Regular
View File
@@ -24,8 +24,8 @@ public class RelationshipTest extends AbstractFakerTest {
}
@Test
public void in_lawTest() {
assertThat(faker.relationships().in_law(), not(isEmptyOrNullString()));
public void inLawTest() {
assertThat(faker.relationships().inLaw(), not(isEmptyOrNullString()));
}
@Test