Question

Having a hard time deciding what kind of project to go with, if someone could provide...

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:

  • Maven support with a pom.xml and appropriate dependency/dependencies
  • A Java class or two to test
  • Two (2) JUnit Test cases
  • One (1) JUnit Test Suite
  • At least three (3) different assertion methods used

Homework Answers

Answer #1

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>

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What are your top 3 take aways from this article? Technology is no longer just for...
What are your top 3 take aways from this article? Technology is no longer just for geeks. The internet has changed everything, including marketing. Be they small, medium or large, social media grants all companies an equal playing field on which to organically reach new customers. However, success will always ride on the marketing strategy employed. Obviously, larger companies have the advantage of bigger budgets and more resources. But that doesn’t mean social media for small business owners can’t compete...
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...
In narrative essay format, I want you to address a business/organization case study using multiple concepts...
In narrative essay format, I want you to address a business/organization case study using multiple concepts from class. The case question and case text begin on page 5 of this document. You need to demonstrate their best understanding of management and organizational behavior theory, and the application of those ideas to improve the understanding of various issues. You need to clearly identify at least 3 distinct, substantive issues. For each issue you need to 1), identify evidence from the case...
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...