Skip to content

Commit

Permalink
all variables in NeodymiumTestSelfTest made to final
Browse files Browse the repository at this point in the history
  • Loading branch information
oomelianchuk committed Aug 28, 2020
1 parent e0ed3b7 commit 37d6b31
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ build
dev-*.properties
temp-*.properties
embeddedLocalProxySelfSignedRootCertificate.p12
/bin/
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class NeodymiumTestSelfTest extends NeodymiumTest
public void testCheckFailedOneFromOne() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
final String errorMessage = "This is RuntimeException 1";
Result result = createResult(1, 0, new HashMap<String, Throwable>()
final Result result = createResult(1, 0, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 1L;

Expand All @@ -37,7 +37,7 @@ public void testCheckFailedOneFromOne() throws NoSuchFieldException, SecurityExc
public void testCheckFailedOneFromTwo() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
final String errorMessage = "This is RuntimeException 1";
Result result = createResult(2, 0, new HashMap<String, Throwable>()
final Result result = createResult(2, 0, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 2L;

Expand All @@ -51,7 +51,7 @@ public void testCheckFailedOneFromTwo() throws NoSuchFieldException, SecurityExc
@Test
public void testCheckFailedTwoFromTwoNumber() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(2, 0, new HashMap<String, Throwable>()
final Result result = createResult(2, 0, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 3L;

Expand All @@ -68,7 +68,7 @@ public void testCheckFailedTwoFromTwoNumber() throws NoSuchFieldException, Secur
@Test
public void testCheckFailedTwoFromTwoOneFailureMessage() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(2, 0, new HashMap<String, Throwable>()
final Result result = createResult(2, 0, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 4L;

Expand All @@ -85,7 +85,7 @@ public void testCheckFailedTwoFromTwoOneFailureMessage() throws NoSuchFieldExcep
@Test
public void testCheckFailedTwoFromTwoTwoFailureMessages() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(2, 0, new HashMap<String, Throwable>()
final Result result = createResult(2, 0, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 5L;

Expand All @@ -94,7 +94,7 @@ public void testCheckFailedTwoFromTwoTwoFailureMessages() throws NoSuchFieldExce
this.put(name.getMethodName() + "2", new RuntimeException("This is RuntimeException 2"));
}
});
HashMap<String, String> expectedFailureMessages = new HashMap<String, String>()
final HashMap<String, String> expectedFailureMessages = new HashMap<String, String>()
{
private static final long serialVersionUID = 6L;

Expand All @@ -111,7 +111,7 @@ public void testCheckFailedTwoFromTwoTwoFailureMessages() throws NoSuchFieldExce
public void testCheckOneFailedOneIgnoredFromTwo() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
final String errorMessage = "This is RuntimeException 1";
Result result = createResult(2, 1, new HashMap<String, Throwable>()
final Result result = createResult(2, 1, new HashMap<String, Throwable>()
{
private static final long serialVersionUID = 7L;

Expand All @@ -126,31 +126,31 @@ public void testCheckOneFailedOneIgnoredFromTwo() throws NoSuchFieldException, S
@Test
public void testCheckPassedOneFromOne() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(1, 0, null);
final Result result = createResult(1, 0, null);
checkPass(result, 1, 0);
}

@Test
public void testCheckPassedTwoFromTwo() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(2, 0, null);
final Result result = createResult(2, 0, null);
checkPass(result, 2, 0);
}

@Test
public void testCheckOnePassedOneIgnoredFromTwo() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = createResult(2, 1, null);
final Result result = createResult(2, 1, null);
checkPass(result, 2, 1);
}

private Result createResult(int runCount, int ignoreCount, Map<String, Throwable> failureCauses)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException
{
Result result = new Result();
Field countField = Result.class.getDeclaredField("count");
Field ignoreCountField = Result.class.getDeclaredField("ignoreCount");
Field failuresField = Result.class.getDeclaredField("failures");
final Result result = new Result();
final Field countField = Result.class.getDeclaredField("count");
final Field ignoreCountField = Result.class.getDeclaredField("ignoreCount");
final Field failuresField = Result.class.getDeclaredField("failures");

countField.setAccessible(true);
ignoreCountField.setAccessible(true);
Expand All @@ -161,10 +161,10 @@ private Result createResult(int runCount, int ignoreCount, Map<String, Throwable

if (failureCauses != null)
{
CopyOnWriteArrayList<Failure> failures = new CopyOnWriteArrayList<>();
for (String testMethodName : failureCauses.keySet())
final CopyOnWriteArrayList<Failure> failures = new CopyOnWriteArrayList<>();
for (final String testMethodName : failureCauses.keySet())
{
Failure failure = new Failure(Description.createTestDescription(getClass(), testMethodName), failureCauses.get(testMethodName));
final Failure failure = new Failure(Description.createTestDescription(getClass(), testMethodName), failureCauses.get(testMethodName));
failures.add(failure);
}
failuresField.set(result, failures);
Expand Down

0 comments on commit 37d6b31

Please sign in to comment.