JAVA-12032 Move Mockito ebook articles code to common module - mockito-simple- Delete mockito-3 since it had only 1 article which was moved to mockito-simple
This commit is contained in:
-7
@@ -1,7 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public enum AuthenticationStatus {
|
||||
AUTHENTICATED,
|
||||
NOT_AUTHENTICATED,
|
||||
ERROR
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public class Credentials {
|
||||
private final String name;
|
||||
private final String password;
|
||||
private final String key;
|
||||
|
||||
public Credentials(String name, String password, String key) {
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public interface DeliveryPlatform {
|
||||
|
||||
void deliver(Email email);
|
||||
|
||||
String getServiceStatus();
|
||||
|
||||
AuthenticationStatus authenticate(Credentials credentials);
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public class Email {
|
||||
|
||||
private String address;
|
||||
private String subject;
|
||||
private String body;
|
||||
private Format format;
|
||||
|
||||
public Email(String address, String subject, String body) {
|
||||
this.address = address;
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public Format getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public void setFormat(Format format) {
|
||||
this.format = format;
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public class EmailService {
|
||||
|
||||
private DeliveryPlatform platform;
|
||||
|
||||
public EmailService(DeliveryPlatform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public void send(String to, String subject, String body, boolean html) {
|
||||
Format format = Format.TEXT_ONLY;
|
||||
if (html) {
|
||||
format = Format.HTML;
|
||||
}
|
||||
Email email = new Email(to, subject, body);
|
||||
email.setFormat(format);
|
||||
platform.deliver(email);
|
||||
}
|
||||
|
||||
public ServiceStatus checkServiceStatus() {
|
||||
if (platform.getServiceStatus().equals("OK")) {
|
||||
return ServiceStatus.UP;
|
||||
} else {
|
||||
return ServiceStatus.DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean authenticatedSuccessfully(Credentials credentials) {
|
||||
if (platform.authenticate(credentials).equals(AuthenticationStatus.AUTHENTICATED)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public enum Format {
|
||||
TEXT_ONLY,
|
||||
HTML
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package com.baeldung.mockito.argumentcaptor;
|
||||
|
||||
public enum ServiceStatus {
|
||||
UP,
|
||||
DOWN,
|
||||
AUTHENTICATED
|
||||
}
|
||||
Reference in New Issue
Block a user