Skip to content

Commit

Permalink
Rename ClockView to HomeView and update package references
Browse files Browse the repository at this point in the history
Deleted package-info.java file from services package. Renamed ClockView.java to HomeView.java and adjusted all relevant references in tests and run configurations. These changes ensure proper routing and functionality within the updated package structure.
  • Loading branch information
LiveNathan committed Aug 16, 2024
1 parent 3f2545e commit f15fa42
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .run/ALL TESTS.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</extension>
<extension name="coverage">
<pattern>
<option name="PATTERN" value="dev.nathanlively.views.clock.*" />
<option name="PATTERN" value="dev.nathanlively.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
Expand Down
4 changes: 2 additions & 2 deletions .run/IO FREE.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</extension>
<extension name="coverage">
<pattern>
<option name="PATTERN" value="dev.nathanlively.views.clock.*" />
<option name="PATTERN" value="dev.nathanlively.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-21" />
<option name="PACKAGE_NAME" value="dev.nathanlively.views.clock" />
<option name="MAIN_CLASS_NAME" value="dev.nathanlively.views.clock.ClockMvcTest" />
<option name="MAIN_CLASS_NAME" value="dev.nathanlively.views.clock.HomeViewTest" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="tags" />
<tag value="!ui" />
Expand Down
4 changes: 2 additions & 2 deletions .run/UI.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
</extension>
<extension name="coverage">
<pattern>
<option name="PATTERN" value="dev.nathanlively.views.clock.*" />
<option name="PATTERN" value="dev.nathanlively.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="graalvm-21" />
<option name="PACKAGE_NAME" value="dev.nathanlively.views.clock" />
<option name="MAIN_CLASS_NAME" value="dev.nathanlively.views.clock.ClockMvcTest" />
<option name="MAIN_CLASS_NAME" value="dev.nathanlively.views.clock.HomeViewTest" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="tags" />
<tag value="ui" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.nathanlively.views.clock;
package dev.nathanlively;

import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.button.Button;
Expand All @@ -21,9 +21,9 @@
@Route(value = "")
@RouteAlias(value = "")
@Uses(Icon.class)
public class ClockView extends Composite<VerticalLayout> {
public class HomeView extends Composite<VerticalLayout> {

public ClockView() {
public HomeView() {
HorizontalLayout mainRow = new HorizontalLayout();
VerticalLayout column1 = new VerticalLayout();
VerticalLayout column2 = new VerticalLayout();
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/dev/nathanlively/services/package-info.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/test/java/dev/nathanlively/views/clock/ClockMvcTest.java

This file was deleted.

43 changes: 43 additions & 0 deletions src/test/java/dev/nathanlively/views/clock/HomeViewTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package dev.nathanlively.views.clock;

import com.vaadin.flow.component.UI;
import dev.nathanlively.HomeView;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static com.github.mvysny.kaributesting.v10.LocatorJ._get;
import static org.assertj.core.api.Assertions.assertThat;

@Tag("ui")
class HomeViewTest extends KaribuTest {

private HomeView view;

@BeforeEach
public void login() {
UI.getCurrent().navigate(HomeView.class);
view = _get(HomeView.class);
}

@Test
public void getRequestToIndex_returnsView() {
assertThat(view).isNotNull();
}

@Test
void viewIndex_returnsListOfClockEventViews() {
// Arrange: Mock the ClockEventService to return a list of ClockEvent views
// List<ClockEvent> mockEvents = List.of(
// new ClockEvent(LocalDateTime.now(), ClockEventType.IN),
// new ClockEvent(LocalDateTime.now(), ClockEventType.OUT)
// );

// Act: Initialize the View and check if the list is injected correctly.
// HomeView homeView = new HomeView(clockEventService);
// UnorderedList eventsList = homeView.getContent().getComponentAt(0, UnorderedList.class);

// Assert: Check if the list contains the expected items
// assertThat(eventsList.getComponentCount()).isEqualTo(mockEvents.size());
}
}
2 changes: 1 addition & 1 deletion src/test/java/dev/nathanlively/views/clock/KaribuTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class KaribuTest {
@BeforeAll
public static void discoverRoutes() {
Locale.setDefault(Locale.ENGLISH);
routes = new Routes().autoDiscoverViews("dev.nathanlively.views");
routes = new Routes().autoDiscoverViews("dev.nathanlively");
}

@BeforeEach
Expand Down

0 comments on commit f15fa42

Please sign in to comment.