下面列出了java.time.OffsetDateTime#compareTo ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public int compareTo(@Nonnull Role r)
{
if (this == r)
return 0;
if (!(r instanceof RoleImpl))
throw new IllegalArgumentException("Cannot compare different role implementations");
RoleImpl impl = (RoleImpl) r;
if (this.guild.getIdLong() != impl.guild.getIdLong())
throw new IllegalArgumentException("Cannot compare roles that aren't from the same guild!");
if (this.getPositionRaw() != r.getPositionRaw())
return this.getPositionRaw() - r.getPositionRaw();
OffsetDateTime thisTime = this.getTimeCreated();
OffsetDateTime rTime = r.getTimeCreated();
//We compare the provided role's time to this's time instead of the reverse as one would expect due to how
// discord deals with hierarchy. The more recent a role was created, the lower its hierarchy ranking when
// it shares the same position as another role.
return rTime.compareTo(thisTime);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expectedExceptions=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}
@Test(expected=NullPointerException.class)
public void test_compareTo_null() {
OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 30, 59, 0, OFFSET_PONE);
a.compareTo(null);
}