set variable player1 & player2 to final
deleted unnecessary import in Test classes added outputTieText to class Game
This commit is contained in:
		
							parent
							
								
									a7f7758eca
								
							
						
					
					
						commit
						acb204f551
					
				| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<project version="4">
 | 
				
			||||||
 | 
					  <component name="RunConfigurationProducerService">
 | 
				
			||||||
 | 
					    <option name="ignoredProducers">
 | 
				
			||||||
 | 
					      <set>
 | 
				
			||||||
 | 
					        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
 | 
				
			||||||
 | 
					      </set>
 | 
				
			||||||
 | 
					    </option>
 | 
				
			||||||
 | 
					  </component>
 | 
				
			||||||
 | 
					</project>
 | 
				
			||||||
| 
						 | 
					@ -60,5 +60,21 @@
 | 
				
			||||||
        <SOURCES />
 | 
					        <SOURCES />
 | 
				
			||||||
      </library>
 | 
					      </library>
 | 
				
			||||||
    </orderEntry>
 | 
					    </orderEntry>
 | 
				
			||||||
 | 
					    <orderEntry type="module-library" scope="TEST">
 | 
				
			||||||
 | 
					      <library name="JUnit5.7.0">
 | 
				
			||||||
 | 
					        <CLASSES>
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.7.0/junit-jupiter-5.7.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.7.0/junit-jupiter-api-5.7.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.0/apiguardian-api-1.1.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.7.0/junit-platform-commons-1.7.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.7.0/junit-jupiter-params-5.7.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.7.0/junit-jupiter-engine-5.7.0.jar!/" />
 | 
				
			||||||
 | 
					          <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.7.0/junit-platform-engine-1.7.0.jar!/" />
 | 
				
			||||||
 | 
					        </CLASSES>
 | 
				
			||||||
 | 
					        <JAVADOC />
 | 
				
			||||||
 | 
					        <SOURCES />
 | 
				
			||||||
 | 
					      </library>
 | 
				
			||||||
 | 
					    </orderEntry>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</module>
 | 
					</module>
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,8 @@ public class Game {
 | 
				
			||||||
    private Gamefield gamefield;
 | 
					    private Gamefield gamefield;
 | 
				
			||||||
    private Language language;
 | 
					    private Language language;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int player1 = 1;
 | 
					    private final int player1 = 1;
 | 
				
			||||||
    private int player2 = 2;
 | 
					    private final int player2 = 2;
 | 
				
			||||||
    private int playerPlaying = 1;
 | 
					    private int playerPlaying = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
| 
						 | 
					@ -52,6 +52,7 @@ public class Game {
 | 
				
			||||||
            language.outputWinnerText(playerPlaying);
 | 
					            language.outputWinnerText(playerPlaying);
 | 
				
			||||||
            gameFinished = true;
 | 
					            gameFinished = true;
 | 
				
			||||||
        } else if (checkForTie()) {
 | 
					        } else if (checkForTie()) {
 | 
				
			||||||
 | 
					            language.outputTieText();
 | 
				
			||||||
            language.outputGameOverText();
 | 
					            language.outputGameOverText();
 | 
				
			||||||
            gameFinished = true;
 | 
					            gameFinished = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ public class Language {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Methode: outputMove
 | 
					     * Methode: outputMove
 | 
				
			||||||
     * Diese Methode gibt die Anzahl Spielzüge aus, die im Spiel bereits gemacht worden sind, und
 | 
					     * Diese Methode gibt die Anzahl Spielzüge aus, die im Spiel bereits gemacht worden sind und
 | 
				
			||||||
     * welcher Spieler den Zug macht
 | 
					     * welcher Spieler den Zug macht
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void outputMoveText(int move, int player) {
 | 
					    public void outputMoveText(int move, int player) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,3 @@
 | 
				
			||||||
import org.junit.Assert;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.AfterEach;
 | 
					import org.junit.jupiter.api.AfterEach;
 | 
				
			||||||
import org.junit.jupiter.api.BeforeEach;
 | 
					import org.junit.jupiter.api.BeforeEach;
 | 
				
			||||||
import org.junit.jupiter.api.Test;
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
| 
						 | 
					@ -6,6 +5,8 @@ import org.junit.jupiter.api.Test;
 | 
				
			||||||
import java.io.ByteArrayOutputStream;
 | 
					import java.io.ByteArrayOutputStream;
 | 
				
			||||||
import java.io.PrintStream;
 | 
					import java.io.PrintStream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static org.junit.jupiter.api.Assertions.assertEquals;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Klasse GameTest
 | 
					 * Klasse GameTest
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					@ -67,7 +68,7 @@ class GameTest {
 | 
				
			||||||
        System.out.println("Hello Baeldung Readers!!");
 | 
					        System.out.println("Hello Baeldung Readers!!");
 | 
				
			||||||
        System.out.println("Hello Baeldung Readers!!");
 | 
					        System.out.println("Hello Baeldung Readers!!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Assert.assertEquals("Hello Baeldung Readers!!\n" +
 | 
					        assertEquals("Hello Baeldung Readers!!\n" +
 | 
				
			||||||
                "Hello Baeldung Readers!!\n" +
 | 
					                "Hello Baeldung Readers!!\n" +
 | 
				
			||||||
                "Hello Baeldung Readers!!\n" +
 | 
					                "Hello Baeldung Readers!!\n" +
 | 
				
			||||||
                "Hello Baeldung Readers!!", outputStreamCaptor.toString()
 | 
					                "Hello Baeldung Readers!!", outputStreamCaptor.toString()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,3 @@
 | 
				
			||||||
import org.junit.Before;
 | 
					 | 
				
			||||||
import org.junit.jupiter.api.Test;
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.junit.jupiter.api.Assertions.*;
 | 
					import static org.junit.jupiter.api.Assertions.*;
 | 
				
			||||||
| 
						 | 
					@ -32,5 +31,6 @@ class GamefieldTest {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Test
 | 
					    @Test
 | 
				
			||||||
    void outputField() {
 | 
					    void outputField() {
 | 
				
			||||||
 | 
					        gamefield.outputField();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue