Skip to content

Commit

Permalink
Add javax.mail-1.5.1 replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
776styjsu committed Oct 13, 2024
1 parent 8cd0a63 commit 00f42ad
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 14 deletions.
Binary file added agent/replacecall/lib/javax.mail-1.5.1.jar
Binary file not shown.
1 change: 1 addition & 0 deletions agent/replacecall/replacecall.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ configurations {
}
dependencies {
compileOnly files('lib/jcommander-1.35.jar')
compileOnly files('lib/javax.mail-1.5.1.jar')
testImplementation 'junit:junit:4.+'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package randoop.grt_mock.javax.mail;

import javax.mail.MessagingException;

public abstract class Service extends javax.mail.Service {

public Service(javax.mail.Session session, javax.mail.URLName urlname) {
super(session, urlname);
}

@Override
public synchronized void connect() throws MessagingException {
throw new MessagingException("Network operations are disabled during testing.");
}

@Override
public synchronized void connect(String host, String user, String password) throws MessagingException {
throw new MessagingException("Network operations are disabled during testing.");
}

@Override
public synchronized void connect(String host, int port, String user, String password) throws MessagingException {
throw new MessagingException("Network operations are disabled during testing.");
}

// Implement other connect methods as needed
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package randoop.grt_mock.jcommander_1_35.com.beust.jcommander.internal;

public class DefaultConsole {

/**
* Mock of com.beust.jcommander.internal.DefaultConsole.readPassword(boolean).
* This method does nothing and returns an empty char array.
*
* @param instance The instance of DefaultConsole (ignored).
* @param echoInput The echoInput parameter (ignored).
* @return An empty char array.
*/
public static char[] readPassword(com.beust.jcommander.internal.Console instance, boolean echoInput) {
return new char[0];
}
}
25 changes: 11 additions & 14 deletions agent/replacecall/src/main/java/randoop/mock/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
@SuppressWarnings("JavaLangClash")
public class System {

// /* Do not replace {@code System#exit(int)}, for running Major mutation tests with replacement */
//
// /**
// * Default mock for {@code System.exit(status)}. Throws an exception to allow Randoop to generate
// * tests that acknowledge that exit occurs.
// *
// * @param status the exit status
// * @throws SystemExitCalledError with the status
// */
// @SuppressWarnings("DoNotCallSuggester")
// public static void exit(int status) {
// throw new SystemExitCalledError(status);
// }

/**
* Default mock for {@code System.exit(status)}. Throws an exception to allow Randoop to generate
* tests that acknowledge that exit occurs.
*
* @param status the exit status
* @throws SystemExitCalledError with the status
*/
// @SuppressWarnings("DoNotCallSuggester")
// public static void exit(int status) {
// throw new SystemExitCalledError(status);
// }
}

0 comments on commit 00f42ad

Please sign in to comment.