Skip to content

Commit

Permalink
Merge pull request #1953 from persapiens/5.2.x
Browse files Browse the repository at this point in the history
fix assertThrows spotbugs issue
  • Loading branch information
persapiens committed Oct 17, 2023
2 parents 2054fdc + d3f8f57 commit 3f8100b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void isLoggedIn_foo() {

@Test
void setIsLoggedIn() {
assertThrows(UnsupportedOperationException.class, () -> this.adminSession.setIsLoggedIn(true));
assertThrows(UnsupportedOperationException.class, () -> this.adminSession.setIsLoggedIn(false));
assertThat(assertThrows(UnsupportedOperationException.class, () -> this.adminSession.setIsLoggedIn(true))).isNotNull();
assertThat(assertThrows(UnsupportedOperationException.class, () -> this.adminSession.setIsLoggedIn(false))).isNotNull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public void convertToString_Duration() {

@Test
public void convertToString_Duration_Invalid() {
Assertions.assertThrows(RuntimeException.class, () ->
InitParameterServletContextConfigurer.convertToString(Duration.ZERO, ChronoUnit.YEARS)
);
assertThat(Assertions.assertThrows(RuntimeException.class, () ->
InitParameterServletContextConfigurer.convertToString(Duration.ZERO, ChronoUnit.YEARS))
).isNotNull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,30 @@ public void testGetFacesContext() {

@Test
public void testGenerateUniqueId() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.generateUniqueId(null)
);
)).isNotNull();
}

@Test
public void testGetExpressionFactory() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.getExpressionFactory()
);
)).isNotNull();
}

@Test
public void testSetVariableMapper() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.setVariableMapper(mock(VariableMapper.class))
);
)).isNotNull();
}

@Test
public void testSetFunctionMapper() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.setFunctionMapper(mock(FunctionMapper.class))
);
)).isNotNull();
}

@Test
Expand All @@ -87,37 +87,37 @@ public void testAttributes() {

@Test
public void testIncludeFacelet_String() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.includeFacelet(null, (String) null)
);
)).isNotNull();
}

@Test
public void testIncludeFacelet_URL() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.includeFacelet(null, (URL) null)
);
)).isNotNull();
}

@Test
public void testGetELResolver() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.getELResolver()
);
)).isNotNull();
}

@Test
public void testGetFunctionMapper() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.getFunctionMapper()
);
)).isNotNull();
}

@Test
public void testGetVariableMapper() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockFaceletContext.getVariableMapper()
);
)).isNotNull();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,58 @@ public void setUp() {

@Test
public void testGetBoolean() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getBoolean(null)
);
)).isNotNull();
}

@Test
public void testGetInt() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getInt(null)
);
)).isNotNull();
}

@Test
public void testGetLocalName() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getLocalName()
);
)).isNotNull();
}

@Test
public void testGetLocation() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getLocation()
);
)).isNotNull();
}

@Test
public void testGetMethodExpression() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getMethodExpression(null, null, null)
);
)).isNotNull();
}

@Test
public void testGetNamespace() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getNamespace()
);
)).isNotNull();
}

@Test
public void testGetObject() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getObject(null)
);
)).isNotNull();
}

@Test
public void testGetQName() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getQName()
);
)).isNotNull();
}

@Test
Expand All @@ -105,9 +105,9 @@ public void testGetValue1() {

@Test
public void testGetObject1() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.getObject(null, null)
);
)).isNotNull();
}

@Test
Expand All @@ -120,9 +120,9 @@ public void testGetValueExpression() {

@Test
public void testIsLiteral() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttribute.isLiteral()
);
)).isNotNull();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public void setUp() {

@Test
public void testGetAll() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttributes.getAll()
);
)).isNotNull();
}

@Test
Expand All @@ -48,23 +48,23 @@ public void testGet() {

@Test
public void testGet1() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttributes.get(null, null)
);
)).isNotNull();
}

@Test
public void testGetAll1() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttributes.getAll(null)
);
)).isNotNull();
}

@Test
public void testGetNamespaces() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockTagAttributes.getNamespaces()
);
)).isNotNull();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,44 @@ public void testGetValue_mock() {

@Test
public void testSetValue() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.setValue(null, null)
);
)).isNotNull();
}

@Test
public void testIsReadOnly() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.isReadOnly(null)
);
)).isNotNull();
}

@Test
public void testGetType() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.getType(null)
);
)).isNotNull();
}

@Test
public void testGetExpectedType() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.getExpectedType()
);
)).isNotNull();
}

@Test
public void testGetExpressionString() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.getExpressionString()
);
)).isNotNull();
}

@Test
public void testIsLiteralText() {
Assertions.assertThrows(UnsupportedOperationException.class, () ->
assertThat(Assertions.assertThrows(UnsupportedOperationException.class, () ->
this.mockValueExpression.isLiteralText()
);
)).isNotNull();
}

}

0 comments on commit 3f8100b

Please sign in to comment.