Add many new tests
This commit is contained in:
@@ -55,7 +55,7 @@ public class Hints {
|
||||
+ "utensils and napkins, it saves plastic and paper.");
|
||||
this.hints.add("It takes about 66 days to form a new habit, keep going!");
|
||||
this.hints.add("Get yourself a nice reusable water bottle! It's cheaper and better for "
|
||||
+ "the environment to refill than to buy a new one every time it's empty.");
|
||||
+ "the environment to refill than to buy a new one every time it's empty.");
|
||||
this.hints.add("Recycle glass bottles!"
|
||||
+ " A glass bottle made in our time will take more than 4,000 years"
|
||||
+ " to decompose.");
|
||||
@@ -75,3 +75,4 @@ public class Hints {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package greenify.client.controller;
|
||||
|
||||
import com.sun.javafx.scene.control.skin.ButtonSkin;
|
||||
import greenify.client.Application;
|
||||
import greenify.client.Friend;
|
||||
import greenify.client.Hints;
|
||||
@@ -21,6 +20,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.skin.ButtonSkin;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.shape.Line;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package greenify.client.controller;
|
||||
|
||||
import com.sun.javafx.scene.control.skin.ButtonSkin;
|
||||
import greenify.client.rest.UserService;
|
||||
import javafx.animation.ScaleTransition;
|
||||
import javafx.animation.TranslateTransition;
|
||||
@@ -12,6 +11,7 @@ import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.control.skin.ButtonSkin;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package greenify.client.controller;
|
||||
|
||||
import com.sun.javafx.scene.control.skin.ButtonSkin;
|
||||
import greenify.client.Application;
|
||||
import greenify.client.rest.UserService;
|
||||
import javafx.animation.FillTransition;
|
||||
import javafx.animation.ScaleTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Parent;
|
||||
@@ -13,10 +10,8 @@ import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
import javafx.util.Duration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
@@ -40,11 +35,6 @@ public class UserController {
|
||||
@FXML
|
||||
private Button signUpButton;
|
||||
|
||||
public void initialize() {
|
||||
loginButton.setSkin(new LoginButtonSkin(loginButton));
|
||||
signUpButton.setSkin(new LoginButtonSkin(signUpButton));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles when the user clicks on the login button.
|
||||
* it checks if the username and password fields are filled
|
||||
@@ -145,39 +135,11 @@ public class UserController {
|
||||
Parent registerWindow = Application.load(this.getClass().getClassLoader()
|
||||
.getResource("fxml/RegisterWindow.fxml"));
|
||||
Scene registerScene = new Scene(registerWindow);
|
||||
registerScene.getStylesheets().add(Application.class.getClassLoader()
|
||||
.getResource("stylesheets/registerWindowStyle.css").toExternalForm());
|
||||
Stage registerStage = new Stage();
|
||||
registerStage.setScene(registerScene);
|
||||
registerStage.setTitle("Enter register credentials");
|
||||
registerStage.show();
|
||||
}
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
private class LoginButtonSkin extends ButtonSkin {
|
||||
/**
|
||||
* button skin for the 'add activity' buttons.
|
||||
* adds scale animations on entering, clicking and extiting the button
|
||||
* @param button the button to set the skin of
|
||||
*/
|
||||
private LoginButtonSkin(Button button) {
|
||||
super(button);
|
||||
|
||||
//transition to scale up on hover
|
||||
final ScaleTransition scaleUp = new ScaleTransition(Duration.millis(85));
|
||||
//add the node and the position to scale to
|
||||
scaleUp.setNode(button);
|
||||
scaleUp.setToX(1.1);
|
||||
scaleUp.setToY(1.1);
|
||||
//play the transition when hovered over the button
|
||||
button.setOnMouseEntered(e -> scaleUp.playFromStart());
|
||||
|
||||
final ScaleTransition scaleDown = new ScaleTransition(Duration.millis(85));
|
||||
scaleDown.setNode(button);
|
||||
scaleDown.setToX(1.0);
|
||||
scaleDown.setToY(1.0);
|
||||
button.setOnMouseExited(e -> scaleDown.playFromStart());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,4 @@
|
||||
-fx-background-color: #005e07;
|
||||
-fx-text-fill: #c4eec9;
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
-fx-background-color: #11911b;
|
||||
}
|
||||
|
||||
.button:pressed {
|
||||
-fx-background-color: #1a8c23;
|
||||
}
|
||||
@@ -47,16 +47,6 @@
|
||||
#friendsButton:pressed {
|
||||
-fx-background-color: #b7e2c2;
|
||||
}
|
||||
#logOutButton {
|
||||
-fx-background-color: #5a635c;
|
||||
-fx-text-fill: #b8bcb9;
|
||||
}
|
||||
#logOutButton:hover {
|
||||
-fx-background-color: #c64b4b;
|
||||
}
|
||||
#logOutButton:pressed {
|
||||
-fx-background-color: #c9a9a9;
|
||||
}
|
||||
|
||||
|
||||
#addNewActivityButton:pressed {
|
||||
|
||||
16
src/Client/src/test/java/FriendTest.java
Normal file
16
src/Client/src/test/java/FriendTest.java
Normal file
@@ -0,0 +1,16 @@
|
||||
import greenify.client.Friend;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class FriendTest {
|
||||
@Test
|
||||
public void setAndGetTest() {
|
||||
Friend test = new Friend("ceren", 10.0);
|
||||
test.setFriend("greenify");
|
||||
test.setScore(15.0);
|
||||
assertEquals(test.getFriend(), "greenify");
|
||||
Assertions.assertEquals(test.getScore(), 15.0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user