18 | All Content in this distribution is made available by Mountainminds GmbH & Co.
19 | KG, Munich. Unless otherwise indicated below, the Content is provided to you
20 | under the terms and conditions of the Eclipse Public License Version 2.0
21 | ("EPL"). A copy of the EPL is available at
22 | https://www.eclipse.org/legal/epl-2.0/.
23 | For purposes of the EPL, "Program" will mean the Content.
24 |
25 |
26 |
Third Party Content
27 |
28 |
29 | The Content includes items that have been sourced from third parties as set
30 | out below.
31 |
32 |
33 |
ASM
34 |
35 |
36 | ASM 7.2 is subject to the terms and
37 | conditions of the following license:
38 |
39 |
40 |
41 | ASM: a very small and fast Java bytecode manipulation framework
42 | Copyright (c) 2000-2011 INRIA, France Telecom
43 | All rights reserved.
44 |
45 | Redistribution and use in source and binary forms, with or without
46 | modification, are permitted provided that the following conditions
47 | are met:
48 | 1. Redistributions of source code must retain the above copyright
49 | notice, this list of conditions and the following disclaimer.
50 | 2. Redistributions in binary form must reproduce the above copyright
51 | notice, this list of conditions and the following disclaimer in the
52 | documentation and/or other materials provided with the distribution.
53 | 3. Neither the name of the copyright holders nor the names of its
54 | contributors may be used to endorse or promote products derived from
55 | this software without specific prior written permission.
56 |
57 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
58 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
61 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
67 | THE POSSIBILITY OF SUCH DAMAGE.
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/org/jacoco/agent/AgentJar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/org/jacoco/agent/AgentJar.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/build/tmp/jar/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Assign/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/guide.md:
--------------------------------------------------------------------------------
1 | ## Guide
2 |
3 | ### Measures
4 | This file lists important measures taken during project execution:
5 | - Since the project requires Java 8, apply a '-D' flag to all gradle commands
6 | ```
7 | gradle build -D/path/to/java/8
8 | ```
9 |
10 | - Delete initial gradle files and generate new gradle wrapper using
11 | ```
12 | gradle wrapper -D/path/to/java/8
13 | ```
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/3.5/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'CoffeeMaker_JUnit_Assign'
19 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/CoffeeMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | import edu.ncsu.csc326.coffeemaker.exceptions.InventoryException;
17 |
18 | /**
19 | * @author Sarah Heckman
20 | */
21 | public class CoffeeMaker {
22 | /** Array of recipes in coffee maker */
23 | private static RecipeBook recipeBook;
24 | /** Inventory of the coffee maker */
25 | private static Inventory inventory;
26 |
27 | /**
28 | * Constructor for the coffee maker
29 | *
30 | */
31 | public CoffeeMaker() {
32 | recipeBook = new RecipeBook();
33 | inventory = new Inventory();
34 | }
35 |
36 | /**
37 | * Returns true if the recipe is added to the
38 | * list of recipes in the CoffeeMaker and false
39 | * otherwise.
40 | * @param r
41 | * @return boolean
42 | */
43 | public boolean addRecipe(Recipe r) {
44 | return recipeBook.addRecipe(r);
45 | }
46 |
47 | /**
48 | * Returns the name of the successfully deleted recipe
49 | * or null if the recipe cannot be deleted.
50 | *
51 | * @param recipeToDelete
52 | * @return String
53 | */
54 | public String deleteRecipe(int recipeToDelete) {
55 | return recipeBook.deleteRecipe(recipeToDelete);
56 | }
57 |
58 | /**
59 | * Returns the name of the successfully edited recipe
60 | * or null if the recipe cannot be edited.
61 | * @param recipeToEdit
62 | * @param r
63 | * @return String
64 | */
65 | public String editRecipe(int recipeToEdit, Recipe r) {
66 | return recipeBook.editRecipe(recipeToEdit, r);
67 | }
68 |
69 | /**
70 | * Returns true if inventory was successfully added
71 | * @param amtCoffee
72 | * @param amtMilk
73 | * @param amtSugar
74 | * @param amtChocolate
75 | * @return boolean
76 | */
77 | public synchronized void addInventory(String amtCoffee, String amtMilk, String amtSugar, String amtChocolate) throws InventoryException {
78 | inventory.addCoffee(amtCoffee);
79 | inventory.addMilk(amtMilk);
80 | inventory.addSugar(amtSugar);
81 | inventory.addChocolate(amtChocolate);
82 | }
83 |
84 | /**
85 | * Returns the inventory of the coffee maker
86 | * @return Inventory
87 | */
88 | public synchronized String checkInventory() {
89 | return inventory.toString();
90 | }
91 |
92 | /**
93 | * Returns the change of a user's beverage purchase, or
94 | * the user's money if the beverage cannot be made
95 | * @param r
96 | * @param amtPaid
97 | * @return int
98 | */
99 | public synchronized int makeCoffee(int recipeToPurchase, int amtPaid) {
100 | int change = 0;
101 |
102 | if (getRecipes()[recipeToPurchase] == null) {
103 | change = amtPaid;
104 | } else if (getRecipes()[recipeToPurchase].getPrice() <= amtPaid) {
105 | if (inventory.useIngredients(getRecipes()[recipeToPurchase])) {
106 | change = amtPaid - getRecipes()[recipeToPurchase].getPrice();
107 | } else {
108 | change = amtPaid;
109 | }
110 | } else {
111 | change = amtPaid;
112 | }
113 |
114 | return change;
115 | }
116 |
117 | /**
118 | * Returns the list of Recipes in the RecipeBook.
119 | * @return Recipe []
120 | */
121 | public synchronized Recipe[] getRecipes() {
122 | return recipeBook.getRecipes();
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/RecipeBook.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | public class RecipeBook {
17 |
18 | /** Array of recipes in coffee maker*/
19 | private Recipe [] recipeArray;
20 | /** Number of recipes in coffee maker */
21 | private final int NUM_RECIPES = 4;
22 |
23 | /**
24 | * Default constructor for a RecipeBook.
25 | */
26 | public RecipeBook() {
27 | recipeArray = new Recipe[NUM_RECIPES];
28 | }
29 |
30 | /**
31 | * Returns the recipe array.
32 | * @param r
33 | * @return Recipe[]
34 | */
35 | public synchronized Recipe[] getRecipes() {
36 | return recipeArray;
37 | }
38 |
39 | public synchronized boolean addRecipe(Recipe r) {
40 | //Assume recipe doesn't exist in the array until
41 | //find out otherwise
42 | boolean exists = false;
43 | //Check that recipe doesn't already exist in array
44 | for (int i = 0; i < recipeArray.length; i++ ) {
45 | if (r.equals(recipeArray[i])) {
46 | exists = true;
47 | }
48 | }
49 | //Assume recipe cannot be added until find an empty
50 | //spot
51 | boolean added = false;
52 | //Check for first empty spot in array
53 | if (!exists) {
54 | for (int i = 0; i < recipeArray.length && !added; i++) {
55 | if (recipeArray[i] == null) {
56 | recipeArray[i] = r;
57 | added = true;
58 | }
59 | }
60 | }
61 | return added;
62 | }
63 |
64 | /**
65 | * Returns the name of the recipe deleted at the position specified
66 | * and null if the recipe does not exist.
67 | * @param recipeToDelete
68 | * @return String
69 | */
70 | public synchronized String deleteRecipe(int recipeToDelete) {
71 | if (recipeArray[recipeToDelete] != null) {
72 | String recipeName = recipeArray[recipeToDelete].getName();
73 | recipeArray[recipeToDelete] = new Recipe();
74 | return recipeName;
75 | } else {
76 | return null;
77 | }
78 | }
79 |
80 | /**
81 | * Returns the name of the recipe edited at the position specified
82 | * and null if the recipe does not exist.
83 | * @param recipeToEdit
84 | * @param newRecipe
85 | * @return String
86 | */
87 | public synchronized String editRecipe(int recipeToEdit, Recipe newRecipe) {
88 | if (recipeArray[recipeToEdit] != null) {
89 | String recipeName = recipeArray[recipeToEdit].getName();
90 | newRecipe.setName("");
91 | recipeArray[recipeToEdit] = newRecipe;
92 | return recipeName;
93 | } else {
94 | return null;
95 | }
96 | }
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class InventoryException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public InventoryException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class RecipeException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public RecipeException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Inventory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Inventory.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Main.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Recipe.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/Recipe.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/bin/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This build file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java Library project to get you started.
5 | * For more details take a look at the Java Libraries chapter in the Gradle
6 | * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
7 | */
8 |
9 | // Apply the java-library plugin to add support for Java Library
10 | apply plugin: 'java-library'
11 | apply plugin: "jacoco"
12 |
13 |
14 | // Make sure we are using Java 8.
15 | if(JavaVersion.current() != JavaVersion.VERSION_1_8)
16 | throw new GradleException("This project requires Java 8, but it's running on "+JavaVersion.current())
17 |
18 | sourceCompatibility = JavaVersion.VERSION_1_8
19 | targetCompatibility = JavaVersion.VERSION_1_8
20 |
21 |
22 | // In this section you declare where to find the dependencies of your project
23 | repositories {
24 | // Use jcenter for resolving your dependencies.
25 | // You can declare any Maven/Ivy/file repository here.
26 | jcenter()
27 | mavenCentral()
28 | }
29 |
30 | test {
31 | testLogging.showStandardStreams = true
32 | }
33 |
34 | dependencies {
35 | // Use JUnit test framework
36 | testImplementation 'junit:junit:4.12'
37 |
38 | // Deprecated. Use testImplementation.
39 | // testCompile 'junit:junit:4.12'
40 | }
41 |
42 | check.dependsOn jacocoTestReport
43 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Inventory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Inventory.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Main.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Recipe.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Recipe.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/classes/java/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/jacoco/test.exec:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/jacoco/test.exec
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/libs/CoffeeMaker_JUnit_Golden.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/libs/CoffeeMaker_JUnit_Golden.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/reports/jacoco/test/html/edu.ncsu.csc326.coffeemaker.exceptions/InventoryException.html:
--------------------------------------------------------------------------------
1 | InventoryException
/*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class InventoryException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public InventoryException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
/*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class RecipeException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public RecipeException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
18 | All Content in this distribution is made available by Mountainminds GmbH & Co.
19 | KG, Munich. Unless otherwise indicated below, the Content is provided to you
20 | under the terms and conditions of the Eclipse Public License Version 2.0
21 | ("EPL"). A copy of the EPL is available at
22 | https://www.eclipse.org/legal/epl-2.0/.
23 | For purposes of the EPL, "Program" will mean the Content.
24 |
25 |
26 |
Third Party Content
27 |
28 |
29 | The Content includes items that have been sourced from third parties as set
30 | out below.
31 |
32 |
33 |
ASM
34 |
35 |
36 | ASM 7.2 is subject to the terms and
37 | conditions of the following license:
38 |
39 |
40 |
41 | ASM: a very small and fast Java bytecode manipulation framework
42 | Copyright (c) 2000-2011 INRIA, France Telecom
43 | All rights reserved.
44 |
45 | Redistribution and use in source and binary forms, with or without
46 | modification, are permitted provided that the following conditions
47 | are met:
48 | 1. Redistributions of source code must retain the above copyright
49 | notice, this list of conditions and the following disclaimer.
50 | 2. Redistributions in binary form must reproduce the above copyright
51 | notice, this list of conditions and the following disclaimer in the
52 | documentation and/or other materials provided with the distribution.
53 | 3. Neither the name of the copyright holders nor the names of its
54 | contributors may be used to endorse or promote products derived from
55 | this software without specific prior written permission.
56 |
57 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
58 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
61 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
67 | THE POSSIBILITY OF SUCH DAMAGE.
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/jacocoagent.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/org/jacoco/agent/AgentJar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/tmp/expandedArchives/org.jacoco.agent-0.8.5.jar_6a2df60c47de373ea127d14406367999/org/jacoco/agent/AgentJar.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/build/tmp/jar/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_JUnit_Golden/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/3.5/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'CoffeeMaker_JUnit_Golden'
19 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/src/main/java/edu/ncsu/csc326/coffeemaker/CoffeeMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | import edu.ncsu.csc326.coffeemaker.exceptions.InventoryException;
17 |
18 | /**
19 | * @author Sarah Heckman
20 | */
21 | public class CoffeeMaker {
22 | /** Array of recipes in coffee maker */
23 | private RecipeBook recipeBook;
24 | /** Inventory of the coffee maker */
25 | private Inventory inventory;
26 |
27 | /**
28 | * Constructor for the coffee maker
29 | *
30 | */
31 | public CoffeeMaker() {
32 | recipeBook = new RecipeBook();
33 | inventory = new Inventory();
34 | }
35 |
36 | /**
37 | * Returns true if the recipe is added to the
38 | * list of recipes in the CoffeeMaker and false
39 | * otherwise.
40 | * @param r
41 | * @return boolean
42 | */
43 | public boolean addRecipe(Recipe r) {
44 | return recipeBook.addRecipe(r);
45 | }
46 |
47 | /**
48 | * Returns the name of the successfully deleted recipe
49 | * or null if the recipe cannot be deleted.
50 | *
51 | * @param recipeToDelete
52 | * @return String
53 | */
54 | public String deleteRecipe(int recipeToDelete) {
55 | return recipeBook.deleteRecipe(recipeToDelete);
56 | }
57 |
58 | /**
59 | * Returns the name of the successfully edited recipe
60 | * or null if the recipe cannot be edited.
61 | * @param recipeToEdit
62 | * @param r
63 | * @return String
64 | */
65 | public String editRecipe(int recipeToEdit, Recipe r) {
66 | return recipeBook.editRecipe(recipeToEdit, r);
67 | }
68 |
69 | /**
70 | * Returns true if inventory was successfully added
71 | * @param amtCoffee
72 | * @param amtMilk
73 | * @param amtSugar
74 | * @param amtChocolate
75 | * @return boolean
76 | */
77 | public synchronized void addInventory(String amtCoffee, String amtMilk, String amtSugar, String amtChocolate) throws InventoryException {
78 | inventory.addCoffee(amtCoffee);
79 | inventory.addMilk(amtMilk);
80 | inventory.addSugar(amtSugar);
81 | inventory.addChocolate(amtChocolate);
82 | }
83 |
84 | /**
85 | * Returns the inventory of the coffee maker
86 | * @return Inventory
87 | */
88 | public synchronized String checkInventory() {
89 | return inventory.toString();
90 | }
91 |
92 | /**
93 | * Returns the change of a user's beverage purchase, or
94 | * the user's money if the beverage cannot be made
95 | * @param r
96 | * @param amtPaid
97 | * @return int
98 | */
99 | public synchronized int makeCoffee(int recipeToPurchase, int amtPaid) {
100 | int change = 0;
101 |
102 | if (recipeToPurchase < 0 ||
103 | recipeToPurchase >= getRecipes().length ||
104 | getRecipes()[recipeToPurchase] == null) {
105 | change = amtPaid;
106 | }
107 | else if (getRecipes()[recipeToPurchase].getPrice() <= amtPaid) {
108 | if (inventory.useIngredients(getRecipes()[recipeToPurchase])) {
109 | change = amtPaid - getRecipes()[recipeToPurchase].getPrice();
110 | } else {
111 | change = amtPaid;
112 | }
113 | } else {
114 | change = amtPaid;
115 | }
116 |
117 | return change;
118 | }
119 |
120 | /**
121 | * Returns the list of Recipes in the RecipeBook.
122 | * @return Recipe []
123 | */
124 | public synchronized Recipe[] getRecipes() {
125 | return recipeBook.getRecipes();
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/src/main/java/edu/ncsu/csc326/coffeemaker/RecipeBook.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | public class RecipeBook {
17 |
18 | /** Array of recipes in coffee maker*/
19 | private Recipe [] recipeArray;
20 | /** Number of recipes in coffee maker */
21 | private final int NUM_RECIPES = 3;
22 |
23 | /**
24 | * Default constructor for a RecipeBook.
25 | */
26 | public RecipeBook() {
27 | recipeArray = new Recipe[NUM_RECIPES];
28 | }
29 |
30 | /**
31 | * Returns the recipe array.
32 | * @param r
33 | * @return Recipe[]
34 | */
35 | public synchronized Recipe[] getRecipes() {
36 | return recipeArray;
37 | }
38 |
39 | public synchronized boolean addRecipe(Recipe r) {
40 | //Assume recipe doesn't exist in the array until
41 | //find out otherwise
42 | boolean exists = false;
43 | //Check that recipe doesn't already exist in array
44 | for (int i = 0; i < recipeArray.length; i++ ) {
45 | if (r.equals(recipeArray[i])) {
46 | exists = true;
47 | }
48 | }
49 | //Assume recipe cannot be added until find an empty
50 | //spot
51 | boolean added = false;
52 | //Check for first empty spot in array
53 | if (!exists) {
54 | for (int i = 0; i < recipeArray.length && !added; i++) {
55 | if (recipeArray[i] == null) {
56 | recipeArray[i] = r;
57 | added = true;
58 | }
59 | }
60 | }
61 | return added;
62 | }
63 |
64 | /**
65 | * Returns the name of the recipe deleted at the position specified
66 | * and null if the recipe does not exist.
67 | * @param recipeToDelete
68 | * @return String
69 | */
70 | public synchronized String deleteRecipe(int recipeToDelete) {
71 | if (recipeToDelete < 0 || recipeToDelete >= recipeArray.length) {
72 | return null;
73 | }
74 | if (recipeArray[recipeToDelete] != null) {
75 | String recipeName = recipeArray[recipeToDelete].getName();
76 | recipeArray[recipeToDelete] = null;
77 | return recipeName;
78 | } else {
79 | return null;
80 | }
81 | }
82 |
83 | /**
84 | * Returns the name of the recipe edited at the position specified
85 | * and null if the recipe does not exist.
86 | * @param recipeToEdit
87 | * @param newRecipe
88 | * @return String
89 | */
90 | public synchronized String editRecipe(int recipeToEdit, Recipe newRecipe) {
91 | if (recipeToEdit < 0 || recipeToEdit >= recipeArray.length) {
92 | return null;
93 | }
94 | if (recipeArray[recipeToEdit] != null) {
95 | String recipeName = recipeArray[recipeToEdit].getName();
96 | recipeArray[recipeToEdit] = newRecipe;
97 | newRecipe.setName(recipeName);
98 | return recipeName;
99 | } else {
100 | return null;
101 | }
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class InventoryException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public InventoryException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_JUnit_Golden/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class RecipeException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public RecipeException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This build file was generated by the Gradle 'init' task.
3 | *
4 | * This generated file contains a sample Java Library project to get you started.
5 | * For more details take a look at the Java Libraries chapter in the Gradle
6 | * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
7 | *
8 | * Extended by Mike Whalen for Coursera "Introduction to Software Testing" course.
9 | * 8/2/2017
10 | */
11 |
12 |
13 | // Apply the java-library plugin to add support for Java Library
14 | apply plugin: 'java-library'
15 | apply plugin: 'jacoco'
16 |
17 |
18 | // Make sure we are using Java 8.
19 | if(JavaVersion.current() != JavaVersion.VERSION_1_8)
20 | throw new GradleException("This project requires Java 8 (Java 1.8), but it's running on "+JavaVersion.current())
21 |
22 | sourceCompatibility = JavaVersion.VERSION_1_8
23 | targetCompatibility = JavaVersion.VERSION_1_8
24 |
25 |
26 | // In this section you declare where to find the dependencies of your project
27 | repositories {
28 | // Use jcenter for resolving your dependencies.
29 | // You can declare any Maven/Ivy/file repository here.
30 | jcenter()
31 | mavenCentral()
32 | }
33 |
34 | project.ext {
35 | junitVersion = '4.12'
36 | }
37 |
38 |
39 | dependencies {
40 | // Use JUnit test framework
41 | testImplementation 'junit:junit:4.12'
42 |
43 | // also use Mockito
44 | testImplementation "org.mockito:mockito-core:2.12.0"
45 | }
46 |
47 | jacoco {
48 | toolVersion = "0.7.6.201602180812"
49 | }
50 |
51 | check.dependsOn jacocoTestReport
52 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/Demo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/Demo.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/CoffeeMaker.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Inventory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Inventory.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Recipe.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/Recipe.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/RecipeBook.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/main/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/classes/java/test/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/jacoco/test.exec:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/jacoco/test.exec
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/libs/CoffeeMaker_Mock_initial.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/libs/CoffeeMaker_Mock_initial.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchfc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchfc.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchnc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchnc.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchpc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/branchpc.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/bundle.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/bundle.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/class.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/class.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/down.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/down.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/greenbar.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/greenbar.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/group.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/group.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/method.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/method.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/package.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/package.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/prettify.css:
--------------------------------------------------------------------------------
1 | /* Pretty printing styles. Used with prettify.js. */
2 |
3 | .str { color: #2A00FF; }
4 | .kwd { color: #7F0055; font-weight:bold; }
5 | .com { color: #3F5FBF; }
6 | .typ { color: #606; }
7 | .lit { color: #066; }
8 | .pun { color: #660; }
9 | .pln { color: #000; }
10 | .tag { color: #008; }
11 | .atn { color: #606; }
12 | .atv { color: #080; }
13 | .dec { color: #606; }
14 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/redbar.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/redbar.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/report.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/report.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/session.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/session.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/sort.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/sort.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/source.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/source.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/up.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/.resources/up.gif
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/reports/jacoco/test/html/default/Demo.html:
--------------------------------------------------------------------------------
1 | Demo
/*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class InventoryException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public InventoryException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
/*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class RecipeException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public RecipeException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
18 | All Content in this plug-in is made available by Mountainminds GmbH & Co.
19 | KG, Munich. Unless otherwise indicated below, the Content is provided to you
20 | under the terms and conditions of the Eclipse Public License Version 1.0
21 | ("EPL"). A copy of the EPL is available at
22 | http://www.eclipse.org/legal/epl-v10.html.
23 | For purposes of the EPL, "Program" will mean the Content.
24 |
25 |
26 |
Third Party Content
27 |
28 |
29 | The Content includes items that have been sourced from third parties as set
30 | out below.
31 |
32 |
33 |
ASM
34 |
35 |
36 | This plug-in contains the ASM library
37 | which is subject to the terms and conditions of the following license:
38 |
39 |
40 |
41 | Copyright (c) 2012 France Télécom
42 | All rights reserved.
43 |
44 | Redistribution and use in source and binary forms, with or without
45 | modification, are permitted provided that the following conditions
46 | are met:
47 |
48 | 1. Redistributions of source code must retain the above copyright
49 | notice, this list of conditions and the following disclaimer.
50 |
51 | 2. Redistributions in binary form must reproduce the above copyright
52 | notice, this list of conditions and the following disclaimer in the
53 | documentation and/or other materials provided with the distribution.
54 |
55 | 3. Neither the name of the copyright holders nor the names of its
56 | contributors may be used to endorse or promote products derived from
57 | this software without specific prior written permission.
58 |
59 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
60 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
63 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
64 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
65 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
66 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
67 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
68 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
69 | THE POSSIBILITY OF SUCH DAMAGE.
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_9b0d429e1eb66481a569272f44a19ac3/jacocoagent.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_9b0d429e1eb66481a569272f44a19ac3/jacocoagent.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_9b0d429e1eb66481a569272f44a19ac3/org/jacoco/agent/AgentJar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/build/tmp/expandedArchives/org.jacoco.agent-0.7.6.201602180812.jar_9b0d429e1eb66481a569272f44a19ac3/org/jacoco/agent/AgentJar.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/build/tmp/jar/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
6 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/3.5/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'CoffeeMaker_Mock_initial'
19 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/CoffeeMaker.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | import edu.ncsu.csc326.coffeemaker.exceptions.InventoryException;
17 |
18 | /**
19 | * @author Sarah Heckman
20 | */
21 | public class CoffeeMaker {
22 | /** Array of recipes in coffee maker */
23 | private RecipeBook recipeBook;
24 | /** Inventory of the coffee maker */
25 | private Inventory inventory;
26 |
27 | /**
28 | * Constructor for the coffee maker
29 | *
30 | */
31 | public CoffeeMaker(RecipeBook recipeBook, Inventory inventory) {
32 | this.recipeBook = recipeBook;
33 | this.inventory = inventory;
34 | }
35 |
36 | /**
37 | * Returns true if the recipe is added to the
38 | * list of recipes in the CoffeeMaker and false
39 | * otherwise.
40 | * @param r
41 | * @return boolean
42 | */
43 | public boolean addRecipe(Recipe r) {
44 | return recipeBook.addRecipe(r);
45 | }
46 |
47 | /**
48 | * Returns the name of the successfully deleted recipe
49 | * or null if the recipe cannot be deleted.
50 | *
51 | * @param recipeToDelete
52 | * @return String
53 | */
54 | public String deleteRecipe(int recipeToDelete) {
55 | return recipeBook.deleteRecipe(recipeToDelete);
56 | }
57 |
58 | /**
59 | * Returns the name of the successfully edited recipe
60 | * or null if the recipe cannot be edited.
61 | * @param recipeToEdit
62 | * @param r
63 | * @return String
64 | */
65 | public String editRecipe(int recipeToEdit, Recipe r) {
66 | return recipeBook.editRecipe(recipeToEdit, r);
67 | }
68 |
69 | /**
70 | * Returns true if inventory was successfully added
71 | * @param amtCoffee
72 | * @param amtMilk
73 | * @param amtSugar
74 | * @param amtChocolate
75 | * @return boolean
76 | */
77 | public synchronized void addInventory(String amtCoffee, String amtMilk, String amtSugar, String amtChocolate) throws InventoryException {
78 | inventory.addCoffee(amtCoffee);
79 | inventory.addMilk(amtMilk);
80 | inventory.addSugar(amtSugar);
81 | inventory.addChocolate(amtChocolate);
82 | }
83 |
84 | /**
85 | * Returns the inventory of the coffee maker
86 | * @return Inventory
87 | */
88 | public synchronized String checkInventory() {
89 | return inventory.toString();
90 | }
91 |
92 | /**
93 | * Returns the change of a user's beverage purchase, or
94 | * the user's money if the beverage cannot be made
95 | * @param r
96 | * @param amtPaid
97 | * @return int
98 | */
99 | public synchronized int makeCoffee(int recipeToPurchase, int amtPaid) {
100 | int change = 0;
101 |
102 | if (getRecipes()[recipeToPurchase] == null) {
103 | change = amtPaid;
104 | } else if (getRecipes()[recipeToPurchase].getPrice() <= amtPaid) {
105 | if (inventory.useIngredients(getRecipes()[recipeToPurchase])) {
106 | change = amtPaid - getRecipes()[recipeToPurchase].getPrice();
107 | } else {
108 | change = amtPaid;
109 | }
110 | } else {
111 | change = amtPaid;
112 | }
113 |
114 | return change;
115 | }
116 |
117 | /**
118 | * Returns the list of Recipes in the RecipeBook.
119 | * @return Recipe []
120 | */
121 | public synchronized Recipe[] getRecipes() {
122 | return recipeBook.getRecipes();
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/Demo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/Demo.class
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/Demo.java:
--------------------------------------------------------------------------------
1 | public class Demo {
2 |
3 | public static void main(String[] args){
4 | int[] myInt= {1, 2, 3};
5 |
6 | System.out.println(myInt[0]);
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/RecipeBook.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017, Michael W. Whalen
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker;
15 |
16 | public interface RecipeBook {
17 |
18 |
19 | /**
20 | * Returns the recipe array.
21 | * @param r
22 | * @return Recipe[]
23 | */
24 | public Recipe[] getRecipes();
25 |
26 | public boolean addRecipe(Recipe r);
27 |
28 | /**
29 | * Returns the name of the recipe deleted at the position specified
30 | * and null if the recipe does not exist.
31 | * @param recipeToDelete
32 | * @return String
33 | */
34 | public String deleteRecipe(int recipeToDelete);
35 |
36 | /**
37 | * Returns the name of the recipe edited at the position specified
38 | * and null if the recipe does not exist.
39 | * @param recipeToEdit
40 | * @param newRecipe
41 | * @return String
42 | */
43 | public String editRecipe(int recipeToEdit, Recipe newRecipe);
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/InventoryException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class InventoryException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public InventoryException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/CoffeeMaker_Mock_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/exceptions/RecipeException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009, Sarah Heckman, Laurie Williams, Dright Ho
3 | * All Rights Reserved.
4 | *
5 | * Permission has been explicitly granted to the University of Minnesota
6 | * Software Engineering Center to use and distribute this source for
7 | * educational purposes, including delivering online education through
8 | * Coursera or other entities.
9 | *
10 | * No warranty is given regarding this software, including warranties as
11 | * to the correctness or completeness of this software, including
12 | * fitness for purpose.
13 | */
14 | package edu.ncsu.csc326.coffeemaker.exceptions;
15 |
16 | public class RecipeException extends Exception {
17 |
18 | private static final long serialVersionUID = 1L;
19 |
20 | public RecipeException(String msg) {
21 | super(msg);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/CoffeeMaker/README.md:
--------------------------------------------------------------------------------
1 | # Efficient Unit Testing with JUnit and Code Coverage with JaCoCo & Mocking with Mockito
2 |
3 | The task is to write a test suite (CoffeeMakerTest.java) that effectively tests the [CoffeeMaker class](./Assign/CoffeeMaker_JUnit_Assign/src/main/java/edu/ncsu/csc326/coffeemaker/CoffeeMaker.java). The test suite must also ensure a high level of coverage.
4 |
5 | The second task is to mock the behaviour of the RecipeBook class (using Mockito) while testing the rest of the application.
6 |
7 | A good implementation of the coffee maker on which all tests should pass is given in *./CoffeeMaker_JUnitGolden*.
8 |
9 | A "not-so-good" implementation of the coffee maker on which bugs should be detected is given in *./CoffeeMaker_JUnitGolden*.
10 |
11 |
12 | ## Solution
13 | Task 1: Developed test suite can be found in [CoffeeMakerTest.java](./CoffeeMaker_JUnit_Assign/src/test/java/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.java).
14 |
15 | Task 2: Developed test suite can be found in [CoffeeMakerTest.java](./CoffeeMaker_Mock_Assign/src/test/java/edu/ncsu/csc326/coffeemaker/CoffeeMakerTest.java).
16 |
--------------------------------------------------------------------------------
/CoffeeMaker/Requirements-CoffeeMaker.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/Requirements-CoffeeMaker.pdf
--------------------------------------------------------------------------------
/CoffeeMaker/SequenceDiagram-CoffeeMaker.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/CoffeeMaker/SequenceDiagram-CoffeeMaker.pdf
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Introduction to Software Testing- University of Minnesota via Coursera
2 | Exercises from "Introduction to Software Testing" course by the University of Minnesota via Coursera.
3 |
4 | - [Building Unit Tests with JUnit](./BuildingUnitTests/README.md)
5 | - [Building a Test Plan](./TestPlan/README.md)
6 | - [Efficient Unit Testing with JUnit and Code Coverage with JaCoCo](./CoffeeMaker/README.md)
7 | - [Test Doubles with Mockito](./TestDoubles/README.md)
8 |
--------------------------------------------------------------------------------
/TestPlan/README.md:
--------------------------------------------------------------------------------
1 | # Building a Test Plan
2 |
3 | The task is to develop a test plan for a software product with it's requirements specified in [SRS.pdf](./SRS.pdf).
4 |
5 | ## Solution
6 | Developed test plan can be found in [TestPlan.pdf](./TestPlan.pdf).
--------------------------------------------------------------------------------
/TestPlan/SRS.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/TestPlan/SRS.pdf
--------------------------------------------------------------------------------
/TestPlan/TestPlan.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Faaizz/introduction_to_software_testing/db83731be86e4031576d543f94f2ba481dfae9fa/TestPlan/TestPlan.pdf
--------------------------------------------------------------------------------
/commit-guide.md:
--------------------------------------------------------------------------------
1 | # Semantic Commit Messages
2 |
3 | See how a minor change to your commit message style can make you a better programmer.
4 |
5 | Format: `(): `
6 |
7 | `` is optional
8 |
9 | ## Example
10 |
11 | ```
12 | feat: add hat wobble
13 | ^--^ ^------------^
14 | | |
15 | | +-> Summary in present tense.
16 | |
17 | +-------> Type: chore, docs, feat, fix, refactor, style, or test.
18 | ```
19 |
20 | More Examples:
21 |
22 | - `feat`: (new feature for the user, not a new feature for build script)
23 | - `fix`: (bug fix for the user, not a fix to a build script)
24 | - `docs`: (changes to the documentation)
25 | - `refactor`: (refactoring production code, eg. renaming a variable)
26 | - `test`: (adding missing tests, refactoring tests; no production code change)
27 | - `chore`: (updating grunt tasks etc; no production code change)
28 |
29 | References:
30 |
31 | - https://www.conventionalcommits.org/
32 | - https://seesparkbox.com/foundry/semantic_commit_messages
33 | - http://karma-runner.github.io/1.0/dev/git-commit-msg.html
34 | - https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716
--------------------------------------------------------------------------------