Skip to content
Snippets Groups Projects

📚🎬 SocialNetwork Java Application

This project implements a social network platform where users can review and consult books and films. It features a robust backend structure with custom exception handling and extensive testing for all core functionalities.


🏗️ Project Structure

├── opinion/ │ ├── SocialNetwork.java # Main class managing all functionality │ ├── ISocialNetwork.java # Interface defining public methods │ ├── Member.java # Represents a registered user │ ├── Item.java # Abstract base class for Book and Film │ ├── Book.java # Book implementation │ └── Film.java # Film implementation ├── tests/ │ ├── AddItemBookTest.java │ ├── AddItemFilmTest.java │ ├── ReviewItemBookTest.java │ ├── ReviewItemFilmTest.java │ ├── ConsultItemBookTest.java │ └── ConsultItemFilmTest.java


🚀 Main Functionalities

✅ Member Management

  • addMember(String login, String password, String profile)
    • Adds a new member to the network
    • Validates credentials (non-null, password ≥ 4 characters)

📘 Item Management

  • addItemBook(...) / addItemFilm(...)
    • Adds a book or film
    • Only members can add items
    • Rejects duplicate titles (case-insensitive and whitespace-trimmed)

✍️ Reviews

  • reviewItemBook(...) / reviewItemFilm(...)
    • Members can rate and review an item
    • Automatically updates the average rating if a review is updated

🔍 Item Consultation

  • consultItems(String keyword)
    • Searches items (books or films) by partial match
    • Case-insensitive
    • Returns a list of formatted strings containing item details

🧪 Testing

The project includes multiple unit tests covering all features:

🔎 Test Categories

  • Add book/film with valid and invalid inputs
  • Duplicate item handling
  • Review creation, update, and average calculation
  • Error handling for null/empty inputs
  • Case-insensitive search for item consultation

Each test:

  • Is labeled with a test ID (3.x for books, 4.x for films)
  • Prints clear OK / Err messages
  • Is grouped as nominal or non-nominal

📊 Sample Test Results Table

No Identification du test Résultat Gravité
4.1 Utilisation de addItemFilm avec un login null OK
4.6 Utilisation de addItemFilm pour créer un film déjà existant OK
4.13 Utilisation de reviewItemFilm par un deuxième utilisateur pour vérifier la mise à jour de la moyenne OK
4.18 Utilisation de consultItems avec un titre vide OK

🛠️ Running the Tests

To run the tests:

# Compile the source
javac opinion/*.java tests/*.java

# Run any test class
java tests.ReviewItemFilmTest
java tests.ConsultItemFilmTest

Authors and acknowledgment

  • Developed by : Maryam TENGKU (Developer), Neva MASSY (Developer)
  • Course : INF112
  • Institution : IMT Atlantique, France

License

This project is intended for academic and educational use.