osu-atri / osu-al1s

A simple osu! bot framework written in Java
Apache License 2.0
2 stars 0 forks source link

[Bug] Test failed on parent tasks #1

Closed CloneWith closed 3 months ago

CloneWith commented 3 months ago

I'm just new to Java servers, so feel free to point out potential operational issues.

Using branch dev.

Involved Tasks

on *-parent:

Error

I tried to make this project running in terms of jar packages, so I launched the package target, and then tests seems to fail with the following log:

[ERROR] moe.orangemc.osu.al1s.auth.AuthenticationAPITest -- Time elapsed: 0.055 s <<< ERROR!
java.lang.NullPointerException: Cannot invoke "moe.orangemc.osu.al1s.user.UserRequestAPI.getSelfMetadata()" because "this.api" is null
    at moe.orangemc.osu.al1s.user.UserImpl.<init>(UserImpl.java:39)
    at moe.orangemc.osu.al1s.bot.OsuBotImpl.<init>(OsuBotImpl.java:53)
    at moe.orangemc.osu.al1s.auth.AuthenticationAPITest.setUp(AuthenticationAPITest.java:41)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)

Following this, I've found a reference without arguments in OsuBotImpl, line 53:

    private final User botUser = new UserImpl();

Seemingly this initialized a bot user object with api null.


I really wanna try this bot out, and ping me if you've found out something improper on any side.

astro-angelfish commented 3 months ago

The test did not initiate the project with dependency injection for now. It was de-synced after dependency injection module involved.

I'm trying to figure out how to solve this problem, but for now I only have an idea with delegating classes.

A temporary workaround is append -Dmaven.test.skip=true as a maven parameter.

astro-angelfish commented 3 months ago

btw it will not do anything on its own as a framework. you still need to write your own logical code base on this framework.