Skip to content

completed intro #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

import com.bobocode.util.ExerciseNotCompletedException;

import java.util.Base64;

/**
* Welcome! This is an introduction exercise that will show you a simple example of Bobocode exercises.
* <p>
@@ -24,7 +26,8 @@ public class ExerciseIntroduction {
*/
public String getWelcomeMessage() {
// todo: implement a method and return a message according to javadoc
throw new ExerciseNotCompletedException();
//throw new ExerciseNotCompletedException();
return "The key to efficient learning is practice!";
}

/**
@@ -40,6 +43,8 @@ public String getWelcomeMessage() {
*/
public String encodeMessage(String message) {
// todo: switch to branch "completed" in order to see how it should be implemented
throw new ExerciseNotCompletedException();
//throw new ExerciseNotCompletedException();
return Base64.getEncoder().encodeToString(message.getBytes());

}
}
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import lombok.SneakyThrows;
import org.junit.jupiter.api.*;

import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;

import static org.assertj.core.api.Assertions.assertThat;
@@ -38,7 +39,7 @@ void getWelcomeMessage() {
@Order(2)
@DisplayName("encodeMessage returns correct encoded message")
@SneakyThrows
void encodeMessageReturnsCorrectPhrase() {
void encodeMessageReturnsCorrectPhrase() throws InvocationTargetException, IllegalAccessException {
var encodeMessageMethod = Arrays.stream(ExerciseIntroduction.class.getDeclaredMethods())
.filter(method -> method.getName().equals("encodeMessage"))
.findAny()