- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是java新手。我正在做我的学校项目,我遇到了这个错误消息的问题。
Class not found: ""Empty test suite.
我以前做过这样的测试,他们成功了。
我没有写所有的方法。我试着先运行文件。我一直在寻找解决方案,但没有一个适合我的情况。
这是我的测试代码:
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TestLab06 {
@Test
public void testIntListInsert() {
int[] arr = {1, 3, 5};
IntList test1 = new IntList(arr);
IntList test2 = new IntList();
test1.insert(2, 1);
test1.insert(4, 3);
assertEquals(5, test1.getSize());
assertEquals(3, test1.get(2));
assertEquals(4, test1.get(3));
test2.insert(1, 1);
assertEquals(1, test2.get(0));
assertEquals(1, test2.getSize());
test2.insert(10, 10);
assertEquals(10, test2.get(1));
}
@Test
public void testIntListMerge() {
int[] arr = {1, 3, 5};
IntList test1 = new IntList(arr);
int[] arr2 = {2, 4, 6, 8};
IntList test2 = new IntList(arr2);
IntList test = IntList.merge(test1, test2);
int[] expected ={1, 2, 3, 4, 5, 6, 8};
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], test.get(i));
}
}
@Test
public void testIntListReverse() {
int[] arr = {1, 2, 3, 4, 5, 6, 8};
IntList test1 = new IntList(arr);
test1.reverse();
int[] expected = {8, 6, 5, 4, 3, 2, 1};
for (int i = 0; i < expected.length; i++) {
assertEquals(expected[i], test1.get(i));
}
}
@Test
public void testDLLInsertRemove() {
DLList l = new DLList();
l.insertBack(2);
l.insertFront(1);
assertEquals(1, l.get(0));
l.insert(4, 1);
assertEquals(4, l.get(1));
l.insert(1, 10);
// List is 1, 4, 2, 1
assertEquals(l.sentinel, l.sentinel.next.next.next.next.prev.prev.prev.prev);
l.remove(1);
assertEquals(2, l.size);
l.remove(l.sentinel.next);
assertEquals(1, l.size);
assertEquals(2, l.sentinel.next.item);
}
@Test
public void testDLLDoubleReverse() {
DLList l = new DLList();
l.insertBack(4);
l.insertBack(2);
l.doubleInPlace();
assertEquals(4, l.size);
assertEquals(4, l.get(0));
assertEquals(4, l.get(1));
assertEquals(2, l.get(2));
assertEquals(2, l.get(3));
assertEquals(l.sentinel, l.sentinel.next.next.next.next.prev.prev.prev.prev);
l.reverse();
assertEquals(4, l.size);
assertEquals(4, l.get(3));
assertEquals(4, l.get(2));
assertEquals(2, l.get(1));
assertEquals(2, l.get(0));
assertEquals(l.sentinel, l.sentinel.next.next.next.next.prev.prev.prev.prev);
}
}
这是我的 IntList.java
/** A data structure to represent a Linked List of Integers.
* Each IntList represents one node in the overall Linked List.
* Encapsulated version.
*/
public class IntList {
/** The head of the list is the first node in the list. If the list
is empty, head is null **/
private IntListNode head;
private int size;
/** IntListNode is a nested class. It can be instantiated when associated with an instance of
* IntList.
* **/
public class IntListNode {
int item;
IntListNode next;
public IntListNode(int item, IntListNode next) {
this.item = item;
this.next = next;
}
}
public int getSize() {
return size;
}
public IntList() {}
public IntList(int[] initial) {
for (int i = initial.length - 1; i >= 0; i--) {
head = new IntListNode(initial[i], head);
}
size = initial.length;
}
/**
* Get the value at position pos. If the position does not exist, throw an
* IndexOutOfBoundsException.
* @param position to get from
* @return the int at the position in the list.
*/
public int get(int position) {
if (position >= size) throw new IndexOutOfBoundsException("Position larger than size of list.");
IntListNode curr = head;
while (position > 0) {
curr = curr.next;
position--;
}
return curr.item;
}
@java.lang.Override
public java.lang.String toString() {
return "IntList{" +
"head=" + head +
", size=" + size +
'}';
}
public boolean equals(Object object) {
if (this == object) return true;
if (!(object instanceof IntList)) return false;
if (!super.equals(object)) return false;
IntList intList = (IntList) object;
return size == intList.size &&
java.util.Objects.equals(head, intList.head);
}
/* Fill in below! */
/**
* Insert a new node into the IntList.
* @param x value to insert
* @param position position to insert into. If position exceeds the size of the list, insert into
* the end of the list.
*/
public void insert(int x, int position) {
// Fill me in!
//insert when the size of the list is 0
if (this.size == 0) {
head = new InListNode(x, head);
size++;
}
//insert at the beginning of the list
else if (position == 0) {
IntListNode new_node = new IntListNode(x, head);
head = new_node;
size++;
}
else {
IntListNode point = head;
while (position > 1 && point.next != null) {
point = point.next;
position--;
}
IntListNode newone = new IntListNode(x, point.next);
point.next = newone;
size++;
}
}
/**
* Merge two sorted IntLists a and b into one sorted IntList containing all of their elements.
* @return a new IntList without modifying either parameter
*/
public static IntList merge(IntList a, IntList b) {
// Fill me in!
return null;
}
/**
* Reverse the current list recursively, using a helper method.
*/
public void reverse() {
// Fill me in!
}
/* Optional! */
/**
* Remove the node at position from this list.
* @param position int representing the index of the node to remove. If greater than the size
* of this list, throw an IndexOutOfBoundsException.
*/
public void remove(int position) {
if (position >= size) throw new IndexOutOfBoundsException();
// fill me in
}
}
最佳答案
试试这个:
文件> 无效缓存/重启> 无效并重启
关于java - 智能 : Class not found: "" Empty test suite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50651971/
所以我有这个表格..有 2 个字段。 “Youtube”和“link”我想做如果你已经填了YouTube,应该这样做: if(!empty($youtube)) { if ($pos === fal
我有一个要验证的输入: 这是 JS: jQuery("#input").live('change', function() { if("#input:not(
假设我在 someNode 中注册了一些带有 id 的小部件(比如 id1、id2)。现在,如果我这样做,domConstruct.empty(someNode),这将通过执行 someNode.in
我需要确定 IQueryable 方法是返回数据,还是像这样将其应用于 RadGrid 的数据源时返回“空”: RadGrid.DataSource = Method(x); if (
我有以下不能正常工作的 $_GET['category'] 也可以等于 0。 if ( empty( $_GET['category'] ) ){ // do something } else
已关闭。此问题需要 debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and the
这个问题在这里已经有了答案: In C#, should I use string.Empty or String.Empty or "" to intitialize a string? (31
使用下面的内容,我检查每个输入字段是否为空 if ( $("input:empty").length > 0 ) { $(":text[value=]").css('background'
这是有原因的吗?我问是因为如果您需要使用大量空字符,那么您会遇到与使用大量空字符串时相同的情况。 编辑:这种用法的原因是: myString.Replace ('c', '') 因此从 myStrin
我对 Apache POI 有一个大问题。 A B C D 1 text text text text 2
在阅读 MarkLogic 时 Query Performance and Tuning Guide ,我了解了 empty greatest 和 empty least 以及如何将其与 order
我正在使用.NET 3.5。我正在创建一个简单的类,并希望确保处理后的类不应该为 null 或者也不应该是新的.. 所以如果我们可以像这样测试它 Dim objClass as new Class()
我有这个 HTML 页面 foo pre:empty { display: none; } some text here in the pre element 而且我想知道为
我知道我能做到 unless [1].empty? 但是我想知道有没有办法呢? 最佳答案 以及 davidrac 提到的 #any?,以及 ActiveSupport有 #present?这更像是其他
在调试某些东西时,我看到了 STL vector::empty() 实现: bool empty() const {return (size() == 0); } 我相信,每当我们探测
我有一个 NavigationDrawer 来启动 fragment 。我有一个来自 TabPageIndicator 的包含 4 个选项卡的 fragment ,其中 fragment 包含 Lis
我正在使用 Jackson XML 2.8.9,不幸的是我找不到任何方法将空/空集合序列化为空节点。 负责序列化为 XML 的方法: protected byte[] toXml(final Coll
嗨,所有 SO 用户我对 null 和 Empty 的理解有点困惑。我知道 null 是特例,它不等于自身。我想知道如何确定它是空的,你告诉它是空的依据是什么,空也一样 它是基于内存分配还是什么? 如
这个问题在这里已经有了答案: What is the difference between String and string in C#? (66 个答案) 关闭 10 年前。 C# 中的 str
如果要创建一个空的T类型的IEnumerable,可以使用静态泛型方法创建 Enumerable.Empty() 参见 here了解更多信息。 为什么 Microsoft 选择此选项而不是对泛型类型使
我是一名优秀的程序员,十分优秀!