Skip to content
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

Adding starting point with Maven #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ example3/build
*.iws
.idea/
out
target
35 changes: 35 additions & 0 deletions mastercrupt-maven/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>mastercrupt</groupId>
<artifactId>kata</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
<junit.jupiter.version>5.4.2</junit.jupiter.version>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
</plugins>
</build>
</project>

11 changes: 11 additions & 0 deletions mastercrupt-maven/src/main/java/mastercrupt/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package mastercrupt;

public class Application {
public void leet(String string, UI ui) {
ui.setLeeted(Leeter.leet(string));
}
public static void main(String[] args) {
UI ui = new UI();
System.out.println(ui.leetMessage(args[0]));
}
}
7 changes: 7 additions & 0 deletions mastercrupt-maven/src/main/java/mastercrupt/Leeter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package mastercrupt;

public class Leeter {
public static String leet(String message) {
return message.replace('e', '3');
}
}
15 changes: 15 additions & 0 deletions mastercrupt-maven/src/main/java/mastercrupt/UI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package mastercrupt;

public class UI {
private Application application = new Application();
private String leeted;

public String leetMessage(String unLeeted) {
application.leet(unLeeted, this);
return "Leeted: " + leeted;
}

public void setLeeted(String leeted) {
this.leeted = leeted;
}
}
12 changes: 12 additions & 0 deletions mastercrupt-maven/src/test/java/mastercrupt/AcceptanceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package mastercrupt;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
public class AcceptanceTest {
@Test
public void testLeeting() {
UI ui = new UI();
assertEquals("Leeted: S3cr3t", ui.leetMessage("Secret"));
}
}