int actualResult = calculateResult(); int expectedResult = 5; assertNotEquals(expectedResult, actualResult);
String actualString = "Hello World"; String expectedString = "Goodbye World"; assertNotEquals(expectedString, actualString);In this example, the assertNotEquals method is used to compare two different strings. The expected string is "Goodbye World" and the actual string is "Hello World". Since they are not equal, the test passes. The org.junit.Assert class is part of the JUnit testing framework and is located in the junit package library.