com.google.common.truth.Subject.isNotEqualTo()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(79)

本文整理了Java中com.google.common.truth.Subject.isNotEqualTo()方法的一些代码示例,展示了Subject.isNotEqualTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.isNotEqualTo()方法的具体详情如下:
包路径:com.google.common.truth.Subject
类名称:Subject
方法名:isNotEqualTo

Subject.isNotEqualTo介绍

[英]Fails if the subject is equal to the given object. The meaning of equality is the same as for the #isEqualTo method.
[中]如果主体与给定对象相等,则失败。平等的含义与#isEqualTo方法相同。

代码示例

代码示例来源:origin: google/ExoPlayer

private static void assertNotEqual(DownloadAction action1, DownloadAction action2) {
 assertThat(action1).isNotEqualTo(action2);
 assertThat(action2).isNotEqualTo(action1);
}

代码示例来源:origin: google/ExoPlayer

private static void assertNotEqual(DownloadAction action1, DownloadAction action2) {
 assertThat(action1).isNotEqualTo(action2);
 assertThat(action2).isNotEqualTo(action1);
}

代码示例来源:origin: google/ExoPlayer

private static void assertNotEqual(DownloadAction action1, DownloadAction action2) {
 assertThat(action1).isNotEqualTo(action2);
 assertThat(action2).isNotEqualTo(action1);
}

代码示例来源:origin: google/guava

public void testWildcardCaptured_field_upperBound() throws Exception {
 TypeToken<Holder<?>> type = new TypeToken<Holder<?>>() {};
 TypeToken<?> matrixType =
   type.resolveType(Holder.class.getDeclaredField("matrix").getGenericType());
 assertEquals(List[].class, matrixType.getRawType());
 assertThat(matrixType.getType()).isNotEqualTo(new TypeToken<List<?>[]>() {}.getType());
}

代码示例来源:origin: google/guava

@Test
public void equivalent_nodeSetsDiffer() {
 network.addNode(N1);
 MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
 g2.addNode(N2);
 assertThat(network).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_nodeSetsDiffer() {
 graph.addNode(N1);
 MutableGraph<Integer> g2 = createGraph(edgeType);
 g2.addNode(N2);
 assertThat(graph).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_edgeSetsDiffer() {
 network.addEdge(N1, N2, E12);
 MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
 g2.addEdge(N1, N2, E13);
 assertThat(network).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
 public void equivalent_edgeDirectionsDiffer() {
  graph.putEdge(N1, N2);

  MutableGraph<Integer> g2 = createGraph(edgeType);
  g2.putEdge(N2, N1);

  switch (edgeType) {
   case UNDIRECTED:
    assertThat(graph).isEqualTo(g2);
    break;
   case DIRECTED:
    assertThat(graph).isNotEqualTo(g2);
    break;
   default:
    throw new IllegalStateException("Unexpected edge type: " + edgeType);
  }
 }
}

代码示例来源:origin: google/guava

@Test
 public void equivalent_edgeDirectionsDiffer() {
  network.addEdge(N1, N2, E12);

  MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
  g2.addEdge(N2, N1, E12);

  switch (edgeType) {
   case UNDIRECTED:
    assertThat(network).isEqualTo(g2);
    break;
   case DIRECTED:
    assertThat(network).isNotEqualTo(g2);
    break;
   default:
    throw new IllegalStateException("Unexpected edge type: " + edgeType);
  }
 }
}

代码示例来源:origin: google/guava

@Test
public void equivalent_directedVsUndirected() {
 graph.putEdge(N1, N2);
 MutableGraph<Integer> g2 = createGraph(oppositeType(edgeType));
 g2.putEdge(N1, N2);
 assertThat(graph).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_selfLoop_directedVsUndirected() {
 network.addEdge(N1, N1, E11);
 MutableNetwork<Integer, String> g2 = createNetwork(oppositeType(edgeType));
 g2.addEdge(N1, N1, E11);
 assertThat(network).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_selfLoop_directedVsUndirected() {
 graph.putEdge(N1, N1);
 MutableGraph<Integer> g2 = createGraph(oppositeType(edgeType));
 g2.putEdge(N1, N1);
 assertThat(graph).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_directedVsUndirected() {
 network.addEdge(N1, N2, E12);
 MutableNetwork<Integer, String> g2 = createNetwork(oppositeType(edgeType));
 g2.addEdge(N1, N2, E12);
 assertThat(network).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

public void testUtf8() {
 char[] charsA = new char[128];
 char[] charsB = new char[128];
 for (int i = 0; i < charsA.length; i++) {
  if (i < 100) {
   charsA[i] = 'a';
   charsB[i] = 'a';
  } else {
   // Both two-byte characters, but must be different
   charsA[i] = (char) (0x0180 + i);
   charsB[i] = (char) (0x0280 + i);
  }
 }
 String stringA = new String(charsA);
 String stringB = new String(charsB);
 assertThat(stringA).isNotEqualTo(stringB);
 assertThat(HASH_FN.hashUnencodedChars(stringA))
   .isNotEqualTo(HASH_FN.hashUnencodedChars(stringB));
 assertThat(fingerprint(stringA.getBytes(UTF_8)))
   .isNotEqualTo(fingerprint(stringB.getBytes(UTF_8)));
 // ISO 8859-1 only has 0-255 (ubyte) representation so throws away UTF-8 characters
 // greater than 127 (ie with their top bit set).
 // Don't attempt to do this in real code.
 assertEquals(
   fingerprint(stringA.getBytes(ISO_8859_1)), fingerprint(stringB.getBytes(ISO_8859_1)));
}

代码示例来源:origin: google/guava

@Test
public void immutableGraph() {
 MutableGraph<String> mutableGraph = GraphBuilder.directed().build();
 mutableGraph.addNode("A");
 ImmutableGraph<String> immutableGraph = ImmutableGraph.copyOf(mutableGraph);
 assertThat(immutableGraph).isNotInstanceOf(MutableValueGraph.class);
 assertThat(immutableGraph).isEqualTo(mutableGraph);
 mutableGraph.addNode("B");
 assertThat(immutableGraph).isNotEqualTo(mutableGraph);
}

代码示例来源:origin: google/guava

@Test
public void immutableValueGraph() {
 MutableValueGraph<String, Integer> mutableValueGraph = ValueGraphBuilder.directed().build();
 mutableValueGraph.addNode("A");
 ImmutableValueGraph<String, Integer> immutableValueGraph =
   ImmutableValueGraph.copyOf(mutableValueGraph);
 assertThat(immutableValueGraph.asGraph()).isInstanceOf(ImmutableGraph.class);
 assertThat(immutableValueGraph).isNotInstanceOf(MutableValueGraph.class);
 assertThat(immutableValueGraph).isEqualTo(mutableValueGraph);
 mutableValueGraph.addNode("B");
 assertThat(immutableValueGraph).isNotEqualTo(mutableValueGraph);
}

代码示例来源:origin: google/guava

@Test
public void immutableNetwork() {
 MutableNetwork<String, Integer> mutableNetwork = NetworkBuilder.directed().build();
 mutableNetwork.addNode("A");
 ImmutableNetwork<String, Integer> immutableNetwork = ImmutableNetwork.copyOf(mutableNetwork);
 assertThat(immutableNetwork.asGraph()).isInstanceOf(ImmutableGraph.class);
 assertThat(immutableNetwork).isNotInstanceOf(MutableNetwork.class);
 assertThat(immutableNetwork).isEqualTo(mutableNetwork);
 mutableNetwork.addNode("B");
 assertThat(immutableNetwork).isNotEqualTo(mutableNetwork);
}

代码示例来源:origin: google/guava

@Test
public void equivalent_connectionsDiffer() {
 network.addEdge(N1, N2, E12);
 network.addEdge(N1, N3, E13);
 MutableNetwork<Integer, String> g2 = createNetwork(edgeType);
 // connect E13 to N1 and N2, and E12 to N1 and N3 => not equivalent
 g2.addEdge(N1, N2, E13);
 g2.addEdge(N1, N3, E12);
 assertThat(network).isNotEqualTo(g2);
}

代码示例来源:origin: google/guava

@Test
 public void equivalence_considersEdgeValue() {
  graph = ValueGraphBuilder.undirected().build();
  graph.putEdgeValue(1, 2, "valueA");

  MutableValueGraph<Integer, String> otherGraph = ValueGraphBuilder.undirected().build();
  otherGraph.putEdgeValue(1, 2, "valueA");
  assertThat(graph).isEqualTo(otherGraph);

  otherGraph.putEdgeValue(1, 2, "valueB");
  assertThat(graph).isNotEqualTo(otherGraph); // values differ
 }
}

代码示例来源:origin: google/ExoPlayer

@Test
public void testNotEquals() throws Exception {
 DefaultContentMetadata metadata1 = createContentMetadata("metadata1", new byte[] {1, 2, 3});
 DefaultContentMetadata metadata2 = createContentMetadata("metadata1", new byte[] {3, 2, 1});
 assertThat(metadata1).isNotEqualTo(metadata2);
 assertThat(metadata1.hashCode()).isNotEqualTo(metadata2.hashCode());
}

相关文章