Skip to content

Commit fb860ca

Browse files
committed
fix failing test case
1 parent e3ff968 commit fb860ca

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

kafka-webview-ui/src/test/java/org/sourcelab/kafka/webview/ui/controller/stream/StreamControllerTest.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,24 @@ public void testUrlsRequireAuthentication() throws Exception {
9898
@Transactional
9999
public void smokeTestStream() throws Exception {
100100

101-
final View view = viewTestTools.createView("TestView");
101+
final View view = viewTestTools.createView("TestView-" + System.currentTimeMillis());
102102

103-
// Hit the stream page for specified view.
104-
mockMvc
105-
.perform(get("/stream/" + view.getId())
106-
.with(user(adminUserDetails)))
107-
//.andDo(print())
108-
.andExpect(status().isOk())
109-
// Contains some basic text
110-
.andExpect(content().string(containsString(view.getName())))
111-
.andExpect(content().string(containsString(view.getTopic())))
112-
.andExpect(content().string(containsString("Switch to View")))
113-
.andExpect(content().string(containsString("href=\"/view/" + view.getId() + "\"")));
103+
try {
104+
// Hit the stream page for specified view.
105+
mockMvc
106+
.perform(get("/stream/" + view.getId())
107+
.with(user(adminUserDetails)))
108+
//.andDo(print())
109+
.andExpect(status().isOk())
110+
// Contains some basic text
111+
.andExpect(content().string(containsString(view.getName())))
112+
.andExpect(content().string(containsString(view.getTopic())))
113+
.andExpect(content().string(containsString("Switch to View")))
114+
.andExpect(content().string(containsString("href=\"/view/" + view.getId() + "\"")));
115+
} finally {
116+
// Cleanup.
117+
viewRepository.delete(view);
118+
}
114119
}
115120

116121
/**
@@ -137,7 +142,7 @@ public void shouldReceiveAMessageFromTheServer() throws Exception {
137142

138143
// Create view
139144
final View view = viewTestTools
140-
.createViewWithCluster("TestView", cluster);
145+
.createViewWithCluster("TestView-" + System.currentTimeMillis(), cluster);
141146

142147
// Sanity test, no enforced partitions
143148
assertEquals("Partitions Property should be empty string", "", view.getPartitions());

0 commit comments

Comments
 (0)