Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java need help making test file: Only things Needed to do: A field storing the LPGS object being used for testing A before each lifecycle

Java need help making test file:

Only things Needed to do:

A field storing the LPGS object being used for testing

A before each lifecycle hook that initializes the LPGS object before each test

At least 2 tests that each have at least 1 assertion

The tests need to actually test something

The tests need to pass

starter code for the test file: LPGSTest.java:

package lpgs;

public class LPGS {

}

Code of the main file, LPGS.java:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

package lpgs; import java.io.File; import java.io.FileNotFoundException; import java.io. FileWriter; import java.io. I0Exception; import java.util. ArrayList; import java. util.Scanner; import java. util.regex.Matcher; import java. util. regex. Pattern; /** * Solver for the classic License Plate Game. * Used by students in CS3667 to practice writing Junit Tests. * * @author Willow Sapphire * aversion 01/22/2022 * */ public class LPGS \{ / * Tournament Scrabble Dictionary Text File. */ public static final String DEFAULT_DICT_FILE = "src/main/lpgs/dictionary.txt"; /** * Default destination file for the answers. */ public static final String DEFAULT_ANSWER_FILE = "answers.txt"; /** * Tournament Scrabble Dictionary Arraylist. * Constructed from file. */ private ArrayList dictionary; /** * The file for the current dictionary. */ private String dictionaryFile; / * The file for the answers. */ private String answersFileName; /*k * The file for the answers. */ private String answersFileName; Option variables /** * True requires that the first letter in the pattern not be * the first letter in the word. */ private boolean nostart; / * True requires that the last latter come before the end of the word. */ private boolean noEnd; / * True requires that the letters not appear next to each other */ private boolean spaceBetween; * in the pattern, as long as the word would still match the pattern with * those letters removed. * * Ex: "VANQUISHES" matches aqs even though it ends in an s since there is * another s before it. ie It would still match if the word was "VANQUISHE" / * No Arg Constructor * Reads in the default dictionary and initializes the ArrayList * Sets the answer file to the default answer file * Sets the option variables to false */ public LPGS() this.dictionaryFile = DEFAULT_DICT_FILE; readDictionary(); this.answersFileName = DEFAULT_ANSWER_FILE; this.noStart = this.noEnd = this.SpaceBetween = false; \} /** * Setter method for noEnd. * * aparam noEnd - whether or not to require no end */ public void setNoEnd(boolean noEnd) this.noEnd = noEnd; \} ** * Setter method for spaceBetween. * * @param spaceBetween - whether or not to require space between */ public void setSpaceBetween(boolean spaceBetween) \{ this.spaceBetween = spaceBetween; public void setanswersFileName(String answersFileName) \{ this.answersFileName = answersFileName; *

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

=+ (a) Show that if P( An B) Answered: 1 week ago

Answered: 1 week ago