Having a hard time deciding what kind of project to go with, if someone could provide skeleton code for the pom.xml and the JUnit testers and JUnit Suite
Create your own project that utilizes Maven and JUnit Testing with your own classes. You will create the classes and tests. You do not have to have an interface for your class. In order to achieve a 50/50, your project should minimally demonstrate:
package junit;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import junit.framework.Assert;
public class Calculator {
@SuppressWarnings("deprecation")
@Test
public void AssertTestsJunit() {
// 'theString' should contain 'S' and 'r'
Calculator c = new Calculator();
Calculator c3 = new Calculator();
Assert.assertEquals(c, c3);
List<String> items = Arrays.asList("John", "James", "Julia", "Jim");
// items list should have James and Jim
Assert.assertTrue( items.contains("James"));
Assert.assertTrue(items.contains("Trump"));
String string1 = "Good Morning America";
String string2 = "Good Morning America";
Assert.assertEquals(string1, string2);
Assert.assertTrue(string1.startsWith("G"));
Assert.assertTrue(string2.startsWith("M"));
}
}
Folder Structure:
Pom.xml
<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>Junit</groupId>
<artifactId>junit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- ... -->
<archive>
<manifest>
<mainClass>paypal.billing.crypto.Controller</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>
Get Answers For Free
Most questions answered within 1 hours.